My router config:
DD-WRT v24-sp2 (08/07/10) mega
Filesystem Size Used Avail Use% Mounted on rootfs 5.7M 5.7M 0 100% / /dev/root 5.7M 5.7M 0 100% / /dev/mtdblock/4 25M 900K 24M 4% /jffs /dev/discs/disc0/part1 504M 314M 165M 66% /opt /dev/sda3 6.8G 1.1G 5.4G 17% /mnt
I will not provide specific information how to install squid and DNSMasq (DNSMasq is installed by default), but my settings of those daemons.
So here are the main changes that I’ve done in squid configuration:
http_port 192.168.1.1:3128 transparent cache_mem 8 MB maximum_object_size_in_memory 32 KB cache_dir ufs /mnt/squid/cache 1024 16 256 minimum_object_size 0 KB maximum_object_size 4 MB
Then I’ve created file:
And put in it:
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 3128
So all the traffic to http is redirect to squid cache.
Squid proxy is almost done, but You need to configure above firewall to start up automatically when router starts:
nvram set rc_firewall=/opt/etc/rc.firewall nvram commit chmod 755 /opt/etc/rc.firewall
From now on You router will automatically redirect all http traffic through You own squid cache server, what will cause speed improvement while browsing sites in internet.
Despite it was faster I wanted to do it much better, and I started to digging up what is taking too long to load the page, and I realized that DNS queries takes too long, so I decided to use DNSMasq to cach dns queries.
To turn on caching just put
In Services->Services->Additional DNSMasq Options box, click Save, and Apply Settings.
It will cache 2000 dns queries in routers memory.
Ok, but what I’ve achieved by those modifications:
- faster DNS queries responses (before modifications: +/- 40ms, after modifications: +/- 1ms)
- faster page loading (before modifications: +/- 8s, after modifications: +/- 3s – it all depends on site, for example – facebook.com from 34s to 12s)
I will try to do some more modifications to speed up internet browsing with dd-wrt, so stay tuned.