NAT網(wǎng)絡(luò)下,虛擬機(jī)與物理機(jī)互通

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 ~]# 

設(shè)置VMware虛擬網(wǎng)卡中的網(wǎng)關(guān)IP

ncpa.cpl中虛擬網(wǎng)卡的配置,不需要配置網(wǎng)關(guān)

VMnet1的地址要與物理網(wǎng)卡屬于同一網(wǎng)段,

在windows防火墻里開(kāi)啟放行

開(kāi)啟任何ip的放行

這個(gè)好像是對(duì)的

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

驗(yàn)證

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

虛擬機(jī)可以同物理機(jī)

[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 ~]# 

主機(jī)也可以ping通虛擬機(jī)

C:\Users\Administrator>
C:\Users\Administrator>ping 192.168.1.100

正在 Ping 192.168.1.100 具有 32 字節(jié)的數(shù)據(jù):
來(lái)自 192.168.1.100 的回復(fù): 字節(jié)=32 時(shí)間<1ms TTL=64
來(lái)自 192.168.1.100 的回復(fù): 字節(jié)=32 時(shí)間<1ms TTL=64
來(lái)自 192.168.1.100 的回復(fù): 字節(jié)=32 時(shí)間<1ms TTL=64
來(lái)自 192.168.1.100 的回復(fù): 字節(jié)=32 時(shí)間<1ms TTL=64

192.168.1.100 的 Ping 統(tǒng)計(jì)信息:
    數(shù)據(jù)包: 已發(fā)送 = 4,已接收 = 4,丟失 = 0 (0% 丟失),
往返行程的估計(jì)時(shí)間(以毫秒為單位):
    最短 = 0ms,最長(zhǎng) = 0ms,平均 = 0ms

C:\Users\Administrator>
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容