NAT模式下,物理机无法访问虚拟机,问题解决方案

我这问题的现象是,虚拟机可以访问物理机,但是物理机无法访问虚拟机:

虚拟机网络配置:

br-7a2629a7d7a1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.18.0.1  netmask 255.255.0.0  broadcast 172.18.255.255
        ether 02:42:39:2d:4d:16  txqueuelen 0  (Ethernet)
        RX packets 70  bytes 9588 (9.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 83  bytes 9557 (9.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        inet6 fe80::42:85ff:fe3d:a19  prefixlen 64  scopeid 0x20<link>
        ether 02:42:85:3d:0a:19  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 34  bytes 4240 (4.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

docker_gwbridge: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.19.0.1  netmask 255.255.0.0  broadcast 172.19.255.255
        ether 02:42:76:57:7c:39  txqueuelen 0  (Ethernet)
        RX packets 70  bytes 9588 (9.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 83  bytes 9557 (9.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.115.129  netmask 255.255.255.0  broadcast 192.168.115.255
        inet6 fe80::20c:29ff:feeb:6677  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:eb:66:77  txqueuelen 1000  (Ethernet)
        RX packets 70  bytes 9588 (9.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 83  bytes 9557 (9.3 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 1000  (Local Loopback)
        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

veth8036f8b: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::3c95:cdff:fe7e:622b  prefixlen 64  scopeid 0x20<link>
        ether 3e:95:cd:7e:62:2b  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 42  bytes 4896 (4.7 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:6f:4e:ae  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

本地网络配置:

=========================================================================

 

尝试ping虚拟机:

问题解决:

增加默认网关配置:

 网络正常:

 

猜你喜欢

转载自blog.csdn.net/jason_jiahongfei/article/details/121054445