Linux solves the problem that The IP address cannot be pinged from Google:
Set the Linux network segment to the computer network segment:
-
Change the IPV4 properties of VM8 in the network adapter options
After VMware is installed, two nics are installed on Windows by default, one is VMnet1 and the other is VMnet8.
You can run the ncpa. CPL command in win + r.
1、In ** host-only mode ** : Windows ** communicates with the VIRTUAL machine using VMnet1's network card **.
2、In **NAT mode ** : Windows ** uses VMnet8 nic to communicate with the VIRTUAL machine **.Win + r Run the ncpa. CPL command to view two nics installed on VMware. One is VMnet1 and the other is VMnet8.
Changed the mode of automatically assigning Linux addresses to fixed IP addresses because network segment reset after system update will assign an incorrect address
Note: The IPV4 IP address segment of VM8 must be the same as that of the PC
The computer network segment is 192.168.150.43, and the IP address of VM8 is 192.168.150.55.
Ipconfig Displays the IP address of a Windows PC
- ** Select bridge mode for the VM **
The dhclient command provides the following functions:Use dynamic host configuration protocol ** to dynamically configure network parameters for network interfaces **,BOOTP is also supported. Syntax format: dhClient [Parameter] [Network interface] Common parameters: -p Specifies the port number monitored by the DHCP client
[redhat@localhost ~]$ su
Password:
[root@localhost redhat]# dhclient
[root@localhost redhat]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# ll
total 4
-rwxrwxr-x. 1 root root 283 Apr 9 10:58 ifcfg-ens160
[root@localhost network-scripts]# cat ifcfg-ens160
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens160
UUID=6fbd8904-cb1d-4b64-932b-f96599b229e6
DEVICE=ens160
ONBOOT=yes
In /etc/sysconfig/network-scripts/ifcfg-ens160 (confirm ONBOOT=yes), ens160 is ** device name **
**ONBOOT specifies whether to activate the nic during system startup. Only the nic in the activated state can connect to the network for network communication
'Modify parameter ONBOOT=yes'
[root@localhost network-scripts]# vim ifcfg-ens160
[root@localhost network-scripts]#
Some tutorials add parameters such as IP gateway, but here the DHclient command is used to dynamically configure the network parameters of the network interface. No additional configuration.
The dhclient command provides the following functions:Use dynamic host configuration protocol ** To dynamically configure network parameters for network interfaces. **
Then restart the network adapter
[root@localhost network-scripts]# service network restart
Try ping after the restart
[root@localhost network-scripts]# ping www.google.com
PING www.wshifen.com (119.63.197.139) 56(84) bytes of data.
64 bytes from 119.63.197.139 (119.63.197.139): icmp_seq=1 ttl=54 time=4.70 ms
64 bytes from 119.63.197.139 (119.63.197.139): icmp_seq=2 ttl=54 time=5.51 ms
--- www.wshifen.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 10ms
rtt min/avg/max/mdev = 4.699/5.184/5.506/0.348 ms
` If no, use the dynamically configured IP address: Check whether the dynamically configured IP address segment is the same as that of the PC
If the IP gateway is configured, check whether the IP4 address of VM8 in Windows matches the configured IP gateway address.
[root@localhost redhat]# ping www.google.com
PING www.wshifen.com (119.63.197.139) 56(84) bytes of data.
^C
--- www.wshifen.com ping statistics ---
6 packets transmitted, 0 received, 100% packet loss, time 134ms
[root@localhost redhat]#
However, there is a special problem here, 100% packet loss. The investigation found that the reason is that my **WIFI connection needs to be verified **.
This problem is resolved after the Firefox browser of RHEL Linux is used to authenticate the WIFI login. If there is no WIFI connection verification, ignore it.
Run the ifconfig -a command to view the dynamically configured IP address, 192.168.150.34
[root@localhost network-scripts]# ifconfig -a
ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.150.34 netmask 255.255.255.0 broadcast 192.168.150.255
inet6 fe80::2276:1028:f2e5:f135 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:02:ef:75 txqueuelen 1000 (Ethernet)
RX packets 22426 bytes 10635866 (10.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 10730 bytes 2627072 (2.5 MiB)
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>
loop txqueuelen 1000 (Local Loopback)
RX packets 60 bytes 7020 (6.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 60 bytes 7020 (6.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:2d:69:47 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
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
virbr0-nic: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 52:54:00:2d:69:47 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
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
[root@localhost network-scripts]#
Solve the Linux NIC loss problem
Sometimes when using ifConfig, if you find that the network card is lost, do as follows to solve the problem
- Location location
[root@localhost network-scripts]# cd /etc/sysconfig/network-scripts/
- View this file
[root@localhost network-scripts]# ll
total 4
-rwxrwxr-x. 1 root root 283 Apr 9 10:58 ifcfg-ens160
[root@localhost network-scripts]# cat ifcfg-ens160
-
Check whether the IP address and gateway address correspond
· If not, modify -
Run the following command after the modification is complete
[root@localhost network-scripts]# service NetworkManager stop
- Restart again
[root@localhost network-scripts]# service network restart
The vm cannot be pinged www.google.com for the first time since the computer system was updated. Ping 8.8.8.8 is also 100% packet loss.
Turns out my network segment was reset after the system update.
Set the Linux network segment to the computer network segment.