赞
踩
配置静态网络:https://blog.csdn.net/qq_46237746/article/details/124532376
[root@hadoop100 ~]# hostname -i
192.168.10.100
[root@hadoop100 ~]# ifconfig docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255 inet6 fe80::42:3aff:fe6a:334a prefixlen 64 scopeid 0x20<link> ether 02:42:3a:6a:33:4a txqueuelen 0 (Ethernet) RX packets 106775 bytes 32705809 (31.1 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 106785 bytes 34201827 (32.6 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.10.50 netmask 255.255.255.0 broadcast 192.168.10.255 inet6 fe80::4858:ffc9:dee5:1904 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:27:4d:95 txqueuelen 1000 (Ethernet) RX packets 1163694 bytes 86105685 (82.1 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1830739 bytes 513445790 (489.6 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 //TODO
[root@hadoop100 ~]# ping www.baidu.com
PING www.a.shifen.com (14.215.177.38) 56(84) bytes of data.
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=1 ttl=128 time=11.5 ms
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=2 ttl=128 time=11.4 ms
[root@hadoop100 ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since 二 2022-05-03 20:36:45 CST; 56min ago # running说明防火墙正在打开
Docs: man:firewalld(1)
Main PID: 783 (firewalld)
Memory: 30.1M
CGroup: /system.slice/firewalld.service
└─783 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
[root@hadoop100 ~]# systemctl stop firewalld
[root@hadoop100 ~]# systemctl start firewalld
[root@hadoop100 ~]# systemctl restart firewalld.service
[root@hadoop100 ~]# systemctl enable firewalld.service
Created symlink from /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service to /usr/lib/systemd/system/firewalld.service.
Created symlink from /etc/systemd/system/basic.target.wants/firewalld.service to /usr/lib/systemd/system/firewalld.service.
[root@hadoop100 ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@hadoop100 ~]# netstat -ntulp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 3472/docker-proxy
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 3430/docker-proxy
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd
tcp 0 0 0.0.0.0:9200 0.0.0.0:* LISTEN 3679/docker-proxy
参数说明:
[root@hadoop100 ~]# netstat -ntulp |grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 3164/docker-proxy
tcp6 0 0 :::3306 :::* LISTEN 3170/docker-proxy
[root@hadoop100 ~]# firewall-cmd --add-port=801/tcp --permanent
success
[root@hadoop100 ~]# firewall-cmd --reload
success
[root@hadoop100 ~]# firewall-cmd --query-port=801/tcp
yes
注意:打开端口并不意味着端口被监听或者被占用,若端口只打开未被监听,则查看端口监听情况依旧为空,具体如下:
[root@hadoop100 ~]# netstat -ntulp |grep 801
[root@hadoop100 ~]#
[root@hadoop100 ~]# firewall-cmd --permanent --remove-port=801/tcp
success
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。