centos7 ping domain name is not available (unable to download)

Posted by Nexus10 on Sat, 15 Feb 2020 19:28:29 +0100

Specific settings

1. First, set the network connection mode of virtual machine and host computer to NAT mode
 
2. It is very important to modify that the network of the virtual machine is in the same network segment as the intranet segment of the host computer (in the same LAN), otherwise, you cannot connect centos through the ssh of the host computer
In VMware: Edit - virtual network editor
Select the network card used by the virtual machine to set NAT:
 
From the above figure, we can see that the subnet ip of the host is 192.168.1.0, so our new network segment can only be:
192.168.1.x ensure the same network segment as the host, and then set the two mapped input ports to 22(ssh login port number)

Verification settings

1. Verify whether the network segment of centos and the host belong to the same network segment: 192.168.1. X (host host host LAN segment)
ssh logs in to the virtual machine, logs in successfully, and checks the ip address. It can be seen that it is in the same network segment as the host computer

[root@localhost ~]# ifconfig 
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.128  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::8133:d98a:f7e8:c2b1  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:a9:4d:e4  txqueuelen 1000  (Ethernet)
        RX packets 224  bytes 19916 (19.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 153  bytes 18599 (18.1 KiB)
        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 1  (Local Loopback)
        RX packets 72  bytes 6252 (6.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 72  bytes 6252 (6.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

2. Verify whether centos can access to the Internet: it can ping and access to the Internet normally

[root@localhost ~]# 
[root@localhost ~]# ping www.baidu.com
PING www.a.shifen.com (61.135.169.121) 56(84) bytes of data.
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=1 ttl=128 time=6.41 ms
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=2 ttl=128 time=6.57 ms
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=3 ttl=128 time=8.02 ms

Topics: network CentOS ssh Vmware