1、系统
[root@PC1 network-scripts]# hostnamectl Static hostname: PC1 Icon name: computer-vm Chassis: vm Machine ID: 7d8c7dacd42740ff9603a3e8bbf222da Boot ID: 2111150973e94f82bb5297c08639adf4 Virtualization: vmware Operating System: Red Hat Enterprise Linux 8.5 (Ootpa) CPE OS Name: cpe:/o:redhat:enterprise_linux:8::baseos Kernel: Linux 4.18.0-348.el8.x86_64 Architecture: x86-64
2、重启网络服务: nmcli c reload ens160 (ens160为网卡名称)
[root@PC1 network-scripts]# ifconfig | head ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 ether 00:0c:29:a8:a2:ab txqueuelen 1000 (Ethernet) RX packets 26 bytes 1847 (1.8 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> [root@PC1 network-scripts]# nmcli c reload ens160 ## 重启网络服务 [root@PC1 network-scripts]# ifconfig | head ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.3.33 netmask 255.255.255.0 broadcast 192.168.3.255 inet6 fe80::20c:29ff:fea8:a2ab prefixlen 64 scopeid 0x20<link> ether 00:0c:29:a8:a2:ab txqueuelen 1000 (Ethernet) RX packets 29 bytes 2039 (1.9 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 28 bytes 3328 (3.2 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
3、测试网络
[root@PC1 network-scripts]# ping -c 3 www.baidu.com PING www.a.shifen.com (39.156.66.14) 56(84) bytes of data. 64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=1 ttl=51 time=11.7 ms 64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=2 ttl=51 time=11.7 ms 64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=3 ttl=51 time=11.5 ms --- www.a.shifen.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2004ms rtt min/avg/max/mdev = 11.548/11.648/11.700/0.143 ms