ping:http://google.com:名称或服务未知
问题描述:
我在windows上使用virtualbox中的centos7。流浪汉做了它,用http或https获得ping错误。也卷曲。有人可以帮助我如何解决并让它工作。ping:http://google.com:名称或服务未知
[[email protected] ~]# ping google.com
PING google.com (61.91.161.217) 56(84) bytes of data.
64 bytes from chatenabled.mail.google.com (61.91.161.217): icmp_seq=1 ttl=43 time=404 ms
64 bytes from chatenabled.mail.google.com (61.91.161.217): icmp_seq=2 ttl=43 time=408 ms
64 bytes from chatenabled.mail.google.com (61.91.161.217): icmp_seq=3 ttl=43 time=407 ms
64 bytes from chatenabled.mail.google.com (61.91.161.217): icmp_seq=4 ttl=43 time=408 ms
^C
--- google.com ping statistics ---
5 packets transmitted, 4 received, 20% packet loss, time 4000ms
rtt min/avg/max/mdev = 404.297/407.234/408.956/1.887 ms
[[email protected] ~]# ping https://google.com
ping: https://google.com: Name or service not known
[[email protected] ~]# ping https://61.91.161.217
ping: https://61.91.161.217: Name or service not known
`
的resolv.conf
[[email protected] ~]# cat /etc/resolv.conf
nameserver 10.0.2.3
nameserver 8.8.8.8
nameserver 8.8.4.4
search localhost
`
的ifconfig
[[email protected] ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255
inet6 fe80::5054:ff:fe73:fb1 prefixlen 64 scopeid 0x20<link>
ether 52:54:00:73:0f:b1 txqueuelen 1000 (Ethernet)
RX packets 610587 bytes 48453952 (46.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 468759 bytes 41290880 (39.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.33.10 netmask 255.255.255.0 broadcast 192.168.33.255
inet6 fe80::a00:27ff:fe0e:ae16 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:0e:ae:16 txqueuelen 1000 (Ethernet)
RX packets 3069145 bytes 2674132747 (2.4 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2531212 bytes 213727091 (203.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
网络文件自动从流浪
创建[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
NAME="eth0"
ONBOOT=yes
NETBOOT=yes
UUID="704aa015-53dd-4ba7-9689-b9b8bf6e09a5"
IPV6INIT=yes
BOOTPROTO=dhcp
TYPE=Ethernet
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
HWADDR=52:54:00:73:0f:b1
DNS1=8.8.8.8
[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
NM_CONTROLLED=no
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.33.10
NETMASK=255.255.255.0
DEVICE=eth1
PEERDNS=no
DNS1=8.8.8.8
答
平无关与HTTP或HTTPS:
平将使用ICMP协议,它属于TCP/IP
平通过发送互联网控制消息协议(ICMP)回送请求分组进行操作到目标主机并等待ICMP响应。
其实ping的工作水平比HTTP或HTTPS低得多,只接受主机名,而不接受URL。
答
首先确保您的虚拟机设置中启用了网络适配器。
您用于连接到互联网的网络接口可能不是主动的。
要检查这一点,使用 “须藤nmcli d” 命令。
如果它断开,用“须藤nmtui” - >编辑连接,选择您的网络界面,选择‘自动连接’选项(通过 按下空格键),然后选择确定。
“sudo reboot now”登录后,执行“ping www.google.com”。
您应该能够立即连接。 “
”实际上ping的工作级别比HTTP或HTTPS低得多,只接受主机名,而不接受URL。“是的。同意。不可能更简洁。 –