我的iptables的版本是1.3.7的,添加了以下几条命令
iptables -I FORWARD -p tcp -s 192.168.0.200 --sport 80 -d 192.168.0.201 --dport 90 -j DROP
iptables -t nat -I PREROUTING -i eth1 -d 192.168.0.200 -p tcp --dport 80 -j DNAT --to-destination 192.168.1.1:80
然后用iptables -t nat -L 和iptables -L来显示是否添加成功的时候却提示
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
然后就停在这边了,但是可以用iptables-save > test保存到test文件中:
# Generated by iptables-save v1.3.7 on Thu Jan 1 01:33:05 1970
*raw
:PREROUTING ACCEPT [9411:603036]
:OUTPUT ACCEPT [5299:485185]
COMMIT
# Completed on Thu Jan 1 01:33:05 1970
# Generated by iptables-save v1.3.7 on Thu Jan 1 01:33:05 1970
*nat
:PREROUTING ACCEPT [7269:460516]
:POSTROUTING ACCEPT [12:841]
:OUTPUT ACCEPT [12:841]
-A PREROUTING -d 192.168.0.200 -i eth1 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.1.1:80
COMMIT
# Completed on Thu Jan 1 01:33:05 1970
# Generated by iptables-save v1.3.7 on Thu Jan 1 01:33:05 1970
*mangle
:PREROUTING ACCEPT [9411:603036]
:INPUT ACCEPT [2176:146844]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [5299:485185]
:POSTROUTING ACCEPT [5299:485185]
COMMIT
# Completed on Thu Jan 1 01:33:05 1970
# Generated by iptables-save v1.3.7 on Thu Jan 1 01:33:05 1970
*filter
:INPUT ACCEPT [2176:146844]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [5299:485185]
-A FORWARD -s 192.168.0.200 -d 192.168.0.201 -p tcp -m tcp --sport 80 --dport 90 -j DROP
COMMIT
# Completed on Thu Jan 1 01:33:05 1970
应该是添加成功了,但就是无法通过iptables -L来正确显示呢?
--------------------next---------------------
阅读(1023) | 评论(0) | 转发(0) |