Linux的DNS的53端口

天客戶那邊有臺服務器同一個局域網中都無法訪問,排除lamp環境問題,發現時服務器中的防火牆沒有開啓80端口。於是去網上搜索了一下,在腳本之家看到一種添加代碼的方法

vi /etc/sysconfig/iptables 

-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT(允許80端口通過防火牆) 

-A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT(允許3306端口通過防火牆)

按照這種方法測試,發現重啓防火牆的時候,回報這兩行錯誤。

[root@localhost ~]# /etc/init.d/iptables restart 

iptables:清除防火牆規則:                                 [確定]

iptables:將鏈設置爲政策 ACCEPT:filter                    [確定]

iptables:正在卸載模塊:                                   [確定]

iptables:應用防火牆規則:Bad argument `–-state'

Error occurred at line: 11

Try `iptables-restore -h' or 'iptables-restore --help' for more information.

                                                           [失敗]

發現這種方法並不好使,於是嘗試另外一種,通過命令去添加端口的方法。

[root@centos httpd]# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT

[root@centos httpd]# /etc/rc.d/init.d/iptables save

[root@centos httpd]# /etc/init.d/iptables restart

這樣就搞定了,查看效果

[root@centos httpd]# /etc/init.d/iptables status

 

 

[root@localhost ~]# /etc/init.d/iptables restart

iptables: Setting chains to policy ACCEPT: filter [  OK  ]

iptables: Flushing firewall rules: [  OK  ]

iptables: Unloading modules: [  OK  ]

iptables: Applying firewall rules: Bad argument `–state'

Error occurred at line: 11

Try `iptables-restore -h' or 'iptables-restore --help' for more information.

[FAILED]


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章