Now that the router is all set to go lets play

20 Apr 2008

So what game should we play…well lets not get to far ahead of our selves. First we must set up the field

apt-get install apache2

apt-get install squid

edit /etc/apache2/sites-available/default

change /var/www/apache2-default to /var/www/html

close the file

mkdir /var/www/html

chown -R www-data:www-data /var/www/html

rm -rf /var/www/apache2-default

/etc/init.d/apache2 restart

Now you have a webserver running. Put documents in the /var/www/html folder for them to show up

edit /etc/squid/squid.conf

find http_port 3128

and replace it with

http_port :3128 transparent

find acl all src

add on the line above it

acl lan src /24 where is the broadcast. If your router ip is then probably put

find http_access allow

add on the line above it

http_access allow lan

close the file

/etc/init.d/squid start

if it complains about some hostname thing

edit /etc/squid/squid.conf

find visible_hostname

down below that below the line #Default:

add visible_hostname

/etc/init.d/squid restart

iptables -t nat -A PREROUTING -i eth1 -p tcp –dport 80 -j DNAT –to

iptables -t nat -A PREROUTING -i eth0 -p tcp –dport 80 -j REDIRECT –to-port 3128

Don’t forget to change the eth1 and eth0 to the respected external and internal device. In this example eth1 is the internal and eth0 is the external.

Also you will need to change to your router’s internal ip address

Sweet, now your router is a proxy server so it caches all internet traffic without anybody having to do anything on their computer.

Why did we install the web server?

Well web servers are fun and you can setup web pages and have people’s web traffic directed to them no matter where they try to go. In case maybe somebody forgot to pay rent or something you could have a page on your web server that says “You need to pay rent” and they can’t get to the internet only to that page until they pay rent

echo “You need to pay rent” > /var/www/html/index.html

iptables -t nat -I PREROUTING -s 192.168.1.x -i eth1 -p tcp –dport 80 -j DNAT –to

Today’s play time is over, but I’ll be back out soon to play with my sweet command line based image editing + squidcache toys later.

«« Previous Post Next Post »»