Monthly ArchiveApril 2007
Linux vishal on 15 Apr 2007
how to use squid proxy as transparent mode
in transparent squid ne need to configure browser to perticular port like 8080 and 3128.
in this mode first edit your squid.conf file
by typing in terminal
vim /etc/squid/squid.conf
edit line may be 89 in 2.6 version
http_port 192.168.0.1:3128 transparent
( where 192.168.0.1 is your local interface address )
and set visible_hostname to localhost
and insert below lines under tag
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
acl our_networks src 192.168.0.0/24 192.168.2.0/24
http_access allow our_networks
(use gedit if not familier with vim )
now start squid by typing
/usr/sbin/squid -z
now flush all rules of iptabes for transparent mode
iptables -F
iptables -t nat -F
iptables -t mangle -F
now delete this chanis bye
iptables -X
iptables -t nat -X
iptables -t mangle -X
now time to save iptables so type
service iptables save
service iptables restart
now all rules and chains will clear !
check it by /etc/sysconfig/iptables which has all defaults rules set to accept.
now /etc/rc.d/rc.local
and insert line
echo ” 1 “> /proc/sys/net/ipv4/ip_forward
and then save and close.
now asuming that your internet interface is eth0 then type :
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
service iptables save
service iptables restart
note:- check your service of iptables is set to start during boot up .
or check status of your iptables service
chkconfig –list iptables
if level 5 is on then its ok othewise start service at level 5 or level 2345.
Linux admin on 15 Apr 2007
How to masquerade ( internet connection sharing ) in Linux
its very simple to masquerade ( internet connection sharing in window’s language ) in linux with few lines of iptables and ip_forward commands.
first of all you have to flush and delete existing firewall rules which are be default bye linux .
so flush rules bye typing in terminal
iptables -F
iptables -t nat -F
iptables -t mangle -F
now delete this chanis bye
iptables -X
iptables -t nat -X
iptables -t mangle -X
now time to save iptables so type
service iptables save
service iptables restart
now all rules and chains will clear !
check it by /etc/sysconfig/iptables which has all defaults rules set to accept.
now /etc/rc.d/rc.local
and insert line
echo ” 1 “> /proc/sys/net/ipv4/ip_forward
and then save and close.
now asuming that your internet interface is eth0 then type :
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
service iptables save
service iptables restart
note:- check your service of iptables is set to start during boot up .
or check status of your iptables service
chkconfig –list iptables
if level 5 is on then its ok othewise start service at level 5 or level 2345.