iptables

iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
iptables -t nat -X
iptables -t mangle -X
iptables -P INPUT ACCETP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
echo 1>/proc/sys/net/ipv4/ip_forward
iptables -A FORWARD -s 192.168.0.0/24 -j ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j SNAT - - to 208.216.201.144
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE
service iptables save
#  透明代理        將所有www請求轉發到3128短口
iptables  -t  nat  -A PROROUTING  -i  eth0 -p tcp - -dport 80 -j  REDIRECT - -to-ports 3128
iptables -A POSTROUTING -t nat -s 192.168.1.0/24 -o eth0 -j SNAT --to-source 218.206.201.44
#echo 1 >/proc/sys/net/ipv4/ip_forward
這一條最好是更改配置文件,/etc/sysctl.conf把ip_forward的值改爲1纔是最穩定的

發佈網內web服務器
iptables -t nat  -A PREROUTING -d [url]www.example.com[/url]  -p tcp  --dport  80 -j DNAT  - - to-dest 192.168.0.10
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章