Sunday, 21 December 2014

Well have you ever had a problem with Windows Firewall? Here is a simple and effective solution and you can still use your Windows Firewall aswell.
Connect your Windows OS to a Linux router to route all your browsing traffic through the Linux Firewall - Iptables.
And if you want extra functionality you can turn your Linux Router into VPN server.
Step 1.
Its a simple process to turn you Linux Box into a router here's how:
#!/bin/bash

sysctl net.ipv4.ip_forward=1
iptables --flush
iptables -I FORWARD -o eth0 -i ppp0 -p tcp -j DROP
iptables -I FORWARD -o eth0 -i ppp0 -p udp -j ACCEPT
iptables -I FORWARD -o eth0 -i ppp0 -p tcp  --dport 80 -j ACCEPT
iptables -I FORWARD -o eth0 -i ppp0 -p tcp  --dport 8080 -j ACCEPT
iptables -I FORWARD -o eth0 -i ppp0 -p tcp  --dport 443 -j ACCEPT

Just put that into a script on Linux and run it. Save iptables and that's it. When you connect to your Linux box via ppp0 (substitute with the network device your using for the connection) and eth0 (substitute with the device used to connect to your Internets router). You can include more rules to restrict UDP aswell. ie:
#!/bin/bash

sysctl net.ipv4.ip_forward=1
iptables --flush
iptables -I FORWARD -o eth0 -i ppp0 -p tcp -j DROP
iptables -I FORWARD -o eth0 -i ppp0 -p udp -j DROP
iptables -I FORWARD -o eth0 -i ppp0 -p tcp  --dport 80 -j ACCEPT
iptables -I FORWARD -o eth0 -i ppp0 -p tcp  --dport 8080 -j ACCEPT
iptables -I FORWARD -o eth0 -i ppp0 -p tcp  --dport 443 -j ACCEPT

It is very interesting to see that just browsing the web requires additional UDP ports and not just TCP
ports 80,8080,443

Enjoy.