我试图用iptables打开IMAP端口993和143。 我想过这样的规则:
-A INPUT -p TCP --dport 993 -j ACCEPT
我已经运行了命令,添加到链中。 iptables -L -v返回:
Chain INPUT (policy ACCEPT 1358 packets, 105K bytes) pkts bytes target prot opt in out source destination 40587 4761K fail2ban-ssh tcp -- any any anywhere anywhere multiport dports ssh 96 5199 ACCEPT tcp -- any any anywhere anywhere tcp dpt:smtp 11 580 ACCEPT tcp -- any any anywhere anywhere tcp dpt:imaps 4 176 ACCEPT tcp -- any any anywhere anywhere tcp dpt:imap2 2 88 ACCEPT tcp -- any any anywhere anywhere tcp dpt:8888 Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 1205 packets, 2969K bytes) pkts bytes target prot opt in out source destination Chain fail2ban-ssh (1 references) pkts bytes target prot opt in out source destination 39398 4668K RETURN all -- any any anywhere anywhere
然后我很恐慌,因为没有办法保存规则。 或者我不知道如果按input保存他们,但iptables save不是一个公认的命令, iptables --help没有说任何关于应用规则。 我也不确定, iptables -L的输出意味着规则是激活的,直到重新启动,或者它还没有被激活。
Starting Nmap 6.40 ( http://nmap.org ) at 2016-02-14 11:51 CET Nmap scan report for localhost (127.0.0.1) Host is up (0.000013s latency). Not shown: 993 closed ports PORT STATE SERVICE 22/tcp open ssh 25/tcp open smtp 80/tcp open http 443/tcp open https 3306/tcp open mysql 7777/tcp open cbt 9200/tcp open wap-wsp
我已经打开了一个在线端口扫描器的Web服务,也返回了相同的结果。
这是iptables v1.4.2和一个Ubuntu 14.10。
在Ubuntu中保存IPTables
从Ubuntu的iptables文档
sudo sh -c“iptables-save> /etc/iptables.rules”
不要惊慌。