Simple but extremely efficient network setup
I need to setup a small network, with about 15 persons racing on a 1 mbps internet connection.
The objective is to have high priority access to the company resources, such as the company website, email, webmail etc, and give reasonable access to other resources.
My recipe is rather simple:
1. Linksys WRT54GL.
2. Tomato firmware.
2. An old Pentium box loaded with Fedora Core 5 (or any linux distro).
3. OpenDNS
The old Pentium box is not really necessary here. It was a spare machine, so I just turn it into a web proxy.
The Linksys router loaded with Tomato firmware. It works pretty well, and the QoS feature is sweet. QoS is very important in this setup, as I need to shape all the traffic pass thru it, and make sure the company access get the fastest possible speed. It took some time to figure out and configure to exactly what I’ve wanted, but well worth the time spent — compare to doing it on the linux box over command line.
I turn the DHCP service OFF on the Linksys router, and use the linux box DHCP service instead. This would allow me to trick everyone treat the linux box as the router, instead of using the real router.
If your linux has no DHCP install, try:
yum install dhcp
Edit the /etc/dhcpd.conf file, DHCP configuration is like this:
option domain-name-servers 10.1.1.10;
option broadcast-address 10.1.1.255;
option subnet-mask 255.255.255.0;
ddns-update-style ad-hoc;
option routers 10.1.1.10;
subnet 10.1.1.0 netmask 255.255.255.0 {
range 10.1.1.250 10.1.1.20;
}
All traffics are passing thru the linux box, then routing out with the Linksys router.
Then, I hijack the http traffic on port 80 of the linux box, redirect them to port 3128, which is where I have my squid cache running.
iptables -t nat -A PREROUTING -i eth0 -p tcp –dport 80 -j REDIRECT –to-port 3128
By doing this, you will have to turn off the apache service on the same box, or make sure it listen on another port instead of 80.
If your linux box has no Squid install, try:
yum install squid
Make sure the squid has been configured as a transproxy, add the following lines in /etc/squid/squid.conf
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
To make sure the users did not abuse the traffic, you can set your router or the linux box to use the OpenDNS IP as the DNS, and disable many of the counter productive websites easily - that’s what I meant: allow reasonable access to other resources. It is rather easy to filter unwanted websites too with the Tomato firmware.
The linux box with squid also compliment the Tomato firmware nicely as it has no log on what URL the user has accessed to. By enable Samba service on the linux box, the Tomato data can be backup to the linux box periodically, without the worry of lost of the network status after a reboot - these network usage information is rather interesting on the Tomato firmware.
Voila, the network is set to go.
(And no body knows that I have deployed a transproxy and second level router on them so far
)




