重啟後生效
開啟: chkconfig iptables on
關閉: chkconfig iptables off 或者 /sbin/chkconfig --level 2345 iptables off
2) 即時生效,重啟後失效
service 方式
開啟: service iptables start
關閉: service iptables stop
iptables方式
檢視防火牆狀態:
/etc/init.d/iptables status
暫時關閉防火牆:
/etc/init.d/iptables stop
重啟iptables:
/etc/init.d/iptables restart
從配置選單關閉防火牆是不起作用的,索性在安裝的時候就不要裝防火牆
檢視防火牆狀態:
/etc/init.d/iptables status
暫時關閉防火牆:
/etc/init.d/iptables stop
禁止防火牆在系統啟動時啟動
/sbin/chkconfig --level 2345 iptables off
重啟iptables:
/etc/init.d/iptables restart
題外話:
bt或者騾子速度慢用不著關防火牆,只要把相應埠開放就可以了
在檔案/etc/sysconfig/iptables
在系統原始配置的:rh-firewall-1-input規則鏈增加類似這樣的行:
-a rh-firewall-1-input -m state --state new -m tcp -p tcp --dport 39764 -j accept
-a rh-firewall-1-input -m state --state new -m udp -p udp --dport 39764 -j accept
如果發現原有-j reject一類的語句,上面兩句要放在它的前面
ssh 是有埠**功能的。
ssh的三個強大的埠**命令:
quote:
ssh -c -f -n -g -l listen_port:dst_host:dst_port user@tunnel_host
ssh -c -f -n -g -r listen_port:dst_host:dst_port user@tunnel_host
ssh -c -f -n -g -d listen_port user@tunnel_host
-f fork into background after authentication.
後台認證使用者/密碼,通常和-n連用,不用登入到遠端主機。
-p port connect to this port. server must be on the same port.
被登入的ssd伺服器的sshd服務埠。
-l port:host:hostport
將本地機(客戶機)的某個埠**到遠端指定機器的指定埠. 工作原理是這樣的, 本地機器上分配了乙個 socket 偵聽 port 埠, 一旦這個埠上有了連線, 該連線就經過安全通道**出去, 同時遠端主機和 host 的 hostport 埠建立連線. 可以在配置檔案中指定埠的**. 只有 root 才能**特權埠. ipv6 位址用另一種格式說明: port/host/hostport
-r port:host:hostport
將遠端主機(伺服器)的某個埠**到本地端指定機器的指定埠. 工作原理是這樣的, 遠端主機上分配了乙個 socket 偵聽 port 埠, 一旦這個埠上有了連線, 該連線就經過安全通道轉向出去, 同時本地主機和 host 的 hostport 埠建立連線. 可以在配置檔案中指定埠的**. 只有用 root 登入遠端主機才能**特權埠. ipv6 位址用另一種格式說明: port/host/hostport
-d port
指定乙個本地機器 「動態的'』 應用程式埠**. 工作原理是這樣的, 本地機器上分配了乙個 socket 偵聽 port 埠, 一旦這個埠上有了連線, 該連線就經過安全通道**出去, 根據應用程式的協議可以判斷出遠端主機將和**連線. 目前支援 socks4 協議, 將充當 socks4 伺服器. 只有 root 才能**特權埠. 可以在配置檔案中指定動態埠的**.
-c enable compression.
壓縮資料傳輸。
-n do not execute a shell or command.
不執行指令碼或命令,通常與-f連用。
-g allow remote hosts to connect to forwarded ports.
在-l/-r/-d引數中,允許遠端主機連線到建立的**的埠,如果不加這個引數,只允許本地主機建立連線
作者「loven」
linux防火牆與埠設定
1 編輯iptables檔案 sudo vi etc sysconfig iptables 新增如下一行 a input p tcp m state state new m tcp dport 3000 j accept 2 重啟防火牆 sudo service iptables restart 3...
防火牆 埠
1.dmz口 這個是非武裝區,用於伺服器 內 外網都可以訪問,但還是與內網隔離.就算是黑客把dmz伺服器拿下,也不能使用伺服器來控制內網的網路.起到安全的策略 外部能訪問dmz 內部能訪問dmz 2.trust口 可信任的介面.是區域網的介面.此介面外網和dmz無法訪問.外部不能訪問trust口 d...
linux防火牆新增埠並開閉防火牆
安裝 yum install firewalld 啟動 systemctl start firewalld 檢視狀態 systemctl status firewalld 禁用,禁止開機啟動 systemctl disable firewalld 開機啟用 systemctl enable fire...