Linux的防火牆設定

2021-10-07 10:55:41 字數 1561 閱讀 8291

1、暴力點,直接關閉防火前(如果在生產環境下,不安全,在開發或測試環境嘛,隨便!)

[root@192

~]# systemctl stop firewalld

[root@192

~]# systemctl status firewalld

● firewalld.service - firewalld - dynamic firewall daemon

loaded: loaded (

/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)

active: inactive (dead) since sun 2020-03

-0801:

14:35 est;

8s ago

docs: man:

firewalld(1

) process:

718 execstart=

/usr/sbin/firewalld --nofork --nopid $firewalld_args (code=exited, status=

0/success)

main pid:

718(code=exited, status=

0/success)

mar 0720:

32:59 localhost.localdomain systemd[1]

: starting firewalld - dynamic firewall daemon...

mar 0720:

33:00 localhost.localdomain systemd[1]

: started firewalld - dynamic firewall daemon.

mar 0801:

14:34192.168

.159

.136 systemd[1]

: stopping firewalld - dynamic firewall daemon...

mar 0801:

14:35192.168

.159

.136 systemd[1]

: stopped firewalld - dynamic firewall daemon.

2、在生產環境中,出於安全考慮,開啟防火前,並在防火牆新增指定的通行埠
[root@192

~]# firewall-cmd --zone=

public

--add-port=

23000

/tcp --permanent

success

[root@192

~]# firewall-cmd --zone=

public

--add-port=

22122

/tcp --permanent

success

[root@192

~]# firewall-cmd --reload

success

Linux防火牆設定

修改防火牆配置需要修改 etc sysconfig iptables 這個檔案,如果要開放哪個埠,在裡面新增一條 a rh firewall 1 input m state state new m tcp p tcp dport 1521 j accept 就可以了,其中 1521 是要開放的埠號,...

Linux防火牆設定

1 重啟後永久性生效 開啟 chkconfig iptables on 關閉 chkconfig iptables off 2 即時生效,重啟後失效 開啟 service iptables start 關閉 service iptables stop 需要說明的是對於linux下的其它服務都可以用以...

LINUX防火牆設定

在終端中輸入如下命令開啟防火牆 chkconfig iptables on 如閉防火牆則輸入 chkconfig iptables off 上述兩條命令均要重啟系統才能生效。如果不想通過重啟系統而即時生效的話,可以用 service 命令。缺點是重啟系統後設定會丟失。開啟了防火牆 service i...