#啟動iptables
service iptables start
chkconfig iptables on
#偽裝請求
iptables -t nat -A POSTROUTING -s 10.1.0.0
/16
-j MASQUERADE
#保存規則, 避免重啟丟失
/etc/init
.d
/iptables
save
#設置允許轉發
sysctl -w net.ipv4.ip_forward=1
#允許轉發
vi
/etc/sysctl
.conf 中加入 net.ipv4.ip_forward=1 然后保存
#查看現有nat規則
iptables -t nat --list
#增加默認路由, 需要先刪除老路由, 重啟后不需要
ip route add default via 10.1.5.11
或者: (重啟后不需要)
route add default gw 10.1.5.11 eth0
route del default gw 10.1.5.1
#改網關, 重啟后自動設置缺省路由
/etc/sysconfig/network-scripts/ifcfg-eth0
中將 gateway改為 10.1.5.11
ip route flush cache
posted on 2013-01-10 00:01 Scud(飛云小俠) 閱讀(818) 評論(0) 編輯 收藏 所屬分類: 其他
Powered by: BlogJava Copyright © Scud(飛云小俠)