redhat5 防火牆命令

2021-08-30 23:16:36 字數 1117 閱讀 4997

防火牆新增埠與強制關閉埠

#cd /etc/sysconfig

#ls#vi iptables (gedit iptables)

在其中加入

-a rh-firewall-1-input -m state --state new -m tcp -p tcp --dport 3306(埠號,port) -j accept

強制關閉埠

#lsof -i:port(埠號)

#kill -9 埠號(這個埠號是輸入lsof -i:port後顯示出來的值)

文章分類:作業系統

今天遇到這樣的問題,將部有websphere應用的伺服器進行重啟後,部在上面的應用全部訪問不了,連was控制台也進不去,經查證是防火牆的問題,關閉防火牆後一切正常。

關閉/etc/rc.d/init.d/iptables stop

開啟/etc/rc.d/init.d/iptables start

檢視當前配置:iptables -l

redhat :

chkconfig --level 2345 iptables off

service iptables stop

但是不推薦關閉防火牆

1) 重啟後生效 

開啟: chkconfig iptables on 

關閉: chkconfig iptables off 

2) 即時生效,重啟後失效 

開啟: service iptables start 

關閉: service iptables stop 

需要說明的是對於linux下的其它服務都可以用以上命令執行開啟和關閉操作。 

在開啟了防火牆時,做如下設定,開啟相關埠, 

修改/etc/sysconfig/iptables 檔案,新增以下內容: 

-a rh-firewall-1-input -m state --state new -m tcp -p tcp --dport 80 -j accept 

-a rh-firewall-1-input -m state --state new -m tcp -p tcp --dport 22 -j accept

防火牆命令

一 防火牆的啟動和關閉 1 防火牆的永久性啟動和關閉 開啟 chkconfig iptables on 關閉 chkconfig iptables off 2 防火牆的臨時啟動和關閉 service iptables start 啟動防火牆 stop 關閉防火牆 restart 重啟防火牆 二 ch...

redhat配置網路,防火牆問題

網路問題 在virtualbox中安裝完redhat之後 設定virtualbox網路鏈結方式為bridged adapter 全域性設定中網路為host only 在redhat中執行ifconfig發現沒有eth0,沒有任何網路裝置 vim etc sysconfig network scrip...

RedHat 關閉防火牆 優化SELinux

關閉防火牆 立即關閉防火牆 service iptables stop 永久關閉防火牆 下次開機才會生效 chkconfig iptables off 檢視防火牆開機啟動模式 chkconfig list iptables優化selinux 當前臨時切換selinux模式到permissive se...