1、查看系统
[root@PC1 network-scripts]# hostnamectl Static hostname: PC1 Icon name: computer-vm Chassis: vm Machine ID: 43d69e6f6dc9444d83a0047a6a16c037 Boot ID: 60f34b965e934969ac756f9f953defd9 Virtualization: vmware Operating System: Red Hat Enterprise Linux 9.0 (Plow) CPE OS Name: cpe:/o:redhat:enterprise_linux:9::baseos Kernel: Linux 5.14.0-70.13.1.el9_0.x86_64 Architecture: x86-64 Hardware Vendor: VMware, Inc. Hardware Model: VMware Virtual Platform
2、查看当前IP
[root@PC1 network-scripts]# ifconfig | head ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.3.123 netmask 255.255.255.0 broadcast 192.168.3.255 inet6 fe80::20c:29ff:fe97:a973 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:97:a9:73 txqueuelen 1000 (Ethernet) RX packets 1056 bytes 1375388 (1.3 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1004 bytes 74434 (72.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
3、在终端输入:nmtui
[root@PC1 network-scripts]# nmtui
4、选中,回车:
5、选中,回车
6、选中,回车:
7、选中,回车
8、选中,回车
9、选中,回车
10、编辑:
11、选中,回车
12、选中,回车
13、选中,回车
14、重启网络服务
[root@PC1 network-scripts]# nmcli c reload [root@PC1 network-scripts]# nmcli c up ens160 Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3)
15、检查,测试网路:
[root@PC1 network-scripts]# ifconfig | head ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.3.66 netmask 255.255.255.0 broadcast 192.168.3.255 inet6 fe80::20c:29ff:fe97:a973 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:97:a9:73 txqueuelen 1000 (Ethernet) RX packets 1100 bytes 1379044 (1.3 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1087 bytes 82141 (80.2 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 [root@PC1 network-scripts]# ping -c 3 www.baidu.com PING www.wshifen.com (103.235.46.39) 56(84) bytes of data. 64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=1 ttl=42 time=54.7 ms 64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=2 ttl=42 time=54.3 ms 64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=3 ttl=42 time=54.7 ms --- www.wshifen.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2004ms rtt min/avg/max/mdev = 54.345/54.573/54.720/0.163 ms