Centos 7
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::9169:54b:c56:a3aa prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:26:0a:91 txqueuelen 1000 (Ethernet)
RX packets 304 bytes 27572 (26.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 749 bytes 71715 (70.0 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 68 bytes 5912 (5.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 68 bytes 5912 (5.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:d1:e9:ea 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 ~]#
设置VMware虚拟网卡中的网关IP
ncpa.cpl中虚拟网卡的配置,不需要配置网关
VMnet1的地址要与物理网卡属于同一网段,
在windows防火墙里开启放行
开启任何ip的放行
这个好像是对的
=============================================
验证
=============================================
虚拟机可以同物理机
[yyf@localhost ~]$
[yyf@localhost ~]$
[yyf@localhost ~]$ su - root
密码:
上一次登录:日 11月 20 21:39:37 PST 2022从 gatewaypts/2 上
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# ping 192.168.1.129
PING 192.168.1.129 (192.168.1.129) 56(84) bytes of data.
64 bytes from 192.168.1.129: icmp_seq=1 ttl=128 time=0.316 ms
64 bytes from 192.168.1.129: icmp_seq=2 ttl=128 time=0.295 ms
64 bytes from 192.168.1.129: icmp_seq=3 ttl=128 time=0.132 ms
64 bytes from 192.168.1.129: icmp_seq=4 ttl=128 time=0.239 ms
^C
--- 192.168.1.129 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3002ms
rtt min/avg/max/mdev = 0.132/0.245/0.316/0.073 ms
[root@localhost ~]#
主机也可以ping通虚拟机
C:\Users\Administrator>
C:\Users\Administrator>ping 192.168.1.100
正在 Ping 192.168.1.100 具有 32 字节的数据:
来自 192.168.1.100 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.1.100 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.1.100 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.1.100 的回复: 字节=32 时间<1ms TTL=64
192.168.1.100 的 Ping 统计信息:
数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
最短 = 0ms,最长 = 0ms,平均 = 0ms
C:\Users\Administrator>