Setup a Router using Linux

Procedures of setting a router with cache function are as follows:

Router section:

1. install dnsmasq

2. iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

3. modify /etc/network/interfaces with following lines

auto eth0 static
iface eth0 inet static
address 192.168.18.1
netmask 255.255.255.0
network 192.168.18.0
broadcast 192.168.18.255

4. echo “1” > /proc/sys/net/ipv4/ip_forward or modify /etc/sysctl.conf

5. install pppoeconf for pppoe connection

6. install apache http://fusionstrike.com/2012/installing-apache2-raspberry-pi-debian

Cache session:

1. install squid

2. configure squid.conf

3. iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp –dport 80 -j REDIRECT –to-ports 3128   # http proxy transparency setting

Connecting to other proxy servers for breaking great firewall:

1. configure squid.acl.gfwed.config   # used to distinguish which websites need to other proxy servers.

2. configure squid_cache_peers.conf   # set which other proxy servers we are connecting to.

3. configure stunnel.conf   # set which other proxy servers we are connecting to.

Other proxy server side’s setting is as follows:

1. install squid

2. install stunnel4

3. configure stunnel4.conf

4. create stunnel.pem for stunnel

Leave a Reply