本人使用的一般是centos
下面是centos6版本的操作
1:修改防火牆
[root@localhost nexus]# vi /etc/sysconfig/iptables
# firewall configuration written by system-config-firewall
# manual customization of this file is not recommended.
*filter
:input accept [0:0]
:forward accept [0:0]
:output accept [0:0]
-a input -m state --state established,related -j accept
-a input -p icmp -j accept
-a input -i lo -j accept
-a input -m state --state new -m tcp -p tcp --dport 22 -j accept
//在這裡增加要允許訪問的埠即可
-a input -m state --state new -m tcp -p tcp --dport 8081 -j accept
-a input -j reject --reject-with icmp-host-prohibited
-a forward -j reject --reject-with icmp-host-prohibited
commit
2:service重啟/關閉防火牆(即時生效,重啟後失效)
//重啟防火牆
service iptables restart
//開啟防火牆
service iptables start
//關閉防火牆
service iptables stop
3:chkconfig 方式(重啟後生效 )
//啟動
chkconfig iptables on
//關閉
chkconfig iptables off
下面是centos7版本的操作
1:修改防火牆
linux關閉防火牆或者修改防火牆配置的命令
開啟 chkconfig iptables on 關閉 chkconfig iptables off 開啟 service iptables start 關閉 service iptables stop vi etc sysconfig iptables a rh firewall 1 input ...
Linux系統修改防火牆配置
修改linux系統防火牆配置需要修改 etc sysconfig iptables 這個檔案 1 vim etc sysconfig iptables在vim編輯器,會看到下面的內容 1 firewall configuration written by system config firewall...
Linux系統修改防火牆配置
修改linux系統防火牆配置需要修改 etc sysconfig iptables 這個檔案 1 vim etc sysconfig iptables 在vim編輯器,會看到下面的內容 1 firewall configuration written by system config firewal...