允許ip 傳送
- # echo "1" > /proc/sys/net/ipv4/ip_forward
- #iptables -t nat -L
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
設定iptables
- # iptables -t nat -A POSTROUTING -s 192.168.182.0/24 -o eth0 -j SNAT --to 140.137.217.94
- -t nat (nat table)
- -A (append)
- POSTROUTING (post routing在路由之後進行)
- eth0 (server上的網卡代號)
- -o (output)
- -s (source)
- 192.168.182.0/24 (如果沒有/24,表示以單機192.168.182.0處理)
- -j (jump)
- SNAT (source NAT)
- --to (超過二個字的指令要用--)
- #iptables -t nat -L
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
SNAT all -- 192.168.182.0/24 anywhere to:140.137.217.94
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
沒有留言:
張貼留言