os : centos 6.5
iptables : 1.4.7
forward dest port : 9090
forward dest ip : 192.168.0.100
my machine lan : eth0 : 192.168.0.200
my machine wan : eth1 : 100.100.100.100
[ my machine work ]
vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
sysctl -p /etc/sysctl.conf
cat /proc/sys/net/ipv4/ip_forward
5222, 9090, 8766
iptables -A PREROUTING -t nat -i eth1 -p tcp --dport 9090 -j DNAT --to 192.168.0.100:9090
iptables -A FORWARD -p tcp -d 192.168.0.100 --dport 9090 -j ACCEPT
iptables -t nat -A POSTROUTING -j MASQUERADE -o eth0
/etc/init.d/iptables save
[ forword rule delete ]
iptables -L FORWARD --line-numbers
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 ACCEPT tcp -- anywhere 192.168.0.100 tcp dpt:xmpp-client
2 ACCEPT tcp -- anywhere 192.168.0.100 tcp dpt:websm
iptables -D FORWARD 2
## iptables all delete
iptables -F
댓글 없음:
댓글 쓰기