Ping 特定 IP 范围在 Mac 中不起作用

问题描述

我已经编辑了我的 /etc/hosts 文件,如下所示。我是 mac Os 的新手,并尝试运行一些代码并进行测试。为此,我必须编辑 /etc/hosts 文件。但是 ping 的 IP 没有按预期工作。请帮助我理解这个问题。

# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost
127.0.0.1       198.18.0.98
127.0.0.1       70.70.70.70
127.0.0.1       nipuna.lk
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section

ping nipuna.lk 工作正常。 ping 70.70.70.70 需要 300-400 毫秒,但 ping 有效。但 ping 198.18.0.98 不起作用。我不知道为什么会这样。

我的防火墙已关闭

macOs Big Sur
version 11.2.3 (20D91) 

ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
    inet 127.0.0.1 netmask 0xff000000 
    inet6 ::1 prefixlen 128 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
    nd6 options=201<PERFORMNUD,DAD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en5: flags=8863<UP,broADCAST,SMART,SIMPLEX,MULTICAST> mtu 1500
    ether ac:de:48:00:11:22 
    inet6 fe80::aede:48ff:fe00:1122%en5 prefixlen 64 scopeid 0x4 
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect (100baseTX <full-duplex>)
    status: active
ap1: flags=8802<broADCAST,MULTICAST> mtu 1500
    options=400<CHANNEL_IO>
    ether aa:e9:fe:87:df:7a 
    media: autoselect
    status: inactive
en0: flags=8863<UP,MULTICAST> mtu 1500
    options=400<CHANNEL_IO>
    ether 88:e9:fe:87:df:7a 
    inet6 fe80::808:35e:834f:b528%en0 prefixlen 64 secured scopeid 0x6 
    inet 192.168.1.4 netmask 0xffffff00 broadcast 192.168.1.255
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: active
awdl0: flags=8943<UP,PROMISC,MULTICAST> mtu 1500
    options=400<CHANNEL_IO>
    ether 9e:68:c9:36:de:63 
    inet6 fe80::9c68:c9ff:fe36:de63%awdl0 prefixlen 64 scopeid 0x7 
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: active
llw0: flags=8863<UP,MULTICAST> mtu 1500
    options=400<CHANNEL_IO>
    ether 9e:68:c9:36:de:63 
    inet6 fe80::9c68:c9ff:fe36:de63%llw0 prefixlen 64 scopeid 0x8 
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: active
en1: flags=8963<UP,MULTICAST> mtu 1500
    options=460<TSO4,TSO6,CHANNEL_IO>
    ether 82:23:8d:28:44:01 
    media: autoselect <full-duplex>
    status: inactive
en2: flags=8963<UP,CHANNEL_IO>
    ether 82:23:8d:28:44:00 
    media: autoselect <full-duplex>
    status: inactive
en3: flags=8963<UP,CHANNEL_IO>
    ether 82:23:8d:28:44:05 
    media: autoselect <full-duplex>
    status: inactive
en4: flags=8963<UP,CHANNEL_IO>
    ether 82:23:8d:28:44:04 
    media: autoselect <full-duplex>
    status: inactive
bridge0: flags=8863<UP,MULTICAST> mtu 1500
    options=63<RXCSUM,TSO4,TSO6>
    ether 82:23:8d:28:44:01 
    Configuration:
        id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
        maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
        root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
        ipfilter disabled flags 0x0
    member: en1 flags=3<LEARNING,disCOVER>
            ifmaxaddr 0 port 9 priority 0 path cost 0
    member: en2 flags=3<LEARNING,disCOVER>
            ifmaxaddr 0 port 10 priority 0 path cost 0
    member: en3 flags=3<LEARNING,disCOVER>
            ifmaxaddr 0 port 11 priority 0 path cost 0
    member: en4 flags=3<LEARNING,disCOVER>
            ifmaxaddr 0 port 12 priority 0 path cost 0
    nd6 options=201<PERFORMNUD,DAD>
    media: <unkNown type>
    status: inactive
utun0: flags=8051<UP,POINTOPOINT,MULTICAST> mtu 1380
    inet6 fe80::22d9:6676:ea11:6a32%utun0 prefixlen 64 scopeid 0xe 
    nd6 options=201<PERFORMNUD,DAD>
utun1: flags=8051<UP,MULTICAST> mtu 2000
    inet6 fe80::fbf9:4cfd:3512:fa43%utun1 prefixlen 64 scopeid 0xf 
    nd6 options=201<PERFORMNUD,DAD>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)