Come consentire alla mia VM di connettere la rete?

4

Sul mio Mac, utilizzo VMware Fusion creato una VM, il mio ifconfig del mio Mac è come di seguito:

aircraftdeMacBook-Pro:.ssh ldl$ 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
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether a0:99:9b:17:50:07 
    inet6 fe80::8e2:5999:6f70:e3f5%en0 prefixlen 64 secured scopeid 0x4 
    inet 192.168.1.6 netmask 0xffffff00 broadcast 192.168.1.255
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: active
en1: flags=963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX> mtu 1500
    options=60<TSO4,TSO6>
    ether 4a:00:02:2c:3b:30 
    media: autoselect <full-duplex>
    status: inactive
en2: flags=963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX> mtu 1500
    options=60<TSO4,TSO6>
    ether 4a:00:02:2c:3b:31 
    media: autoselect <full-duplex>
    status: inactive
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
    ether 02:99:9b:17:50:07 
    media: autoselect
    status: inactive
awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1484
    ether 7e:0a:8c:55:bc:b4 
    inet6 fe80::7c0a:8cff:fe55:bcb4%awdl0 prefixlen 64 scopeid 0x8 
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: active
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=63<RXCSUM,TXCSUM,TSO4,TSO6>
    ether 4a:00:02:2c:3b:30 
    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 0x2
    member: en1 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 5 priority 0 path cost 0
    member: en2 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 6 priority 0 path cost 0
    nd6 options=201<PERFORMNUD,DAD>
    media: <unknown type>
    status: inactive
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
    inet6 fe80::5f08:8c57:f439:8b6%utun0 prefixlen 64 scopeid 0xa 
    nd6 options=201<PERFORMNUD,DAD>
vmnet1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 00:50:56:c0:00:01 
    inet 172.16.111.1 netmask 0xffffff00 broadcast 172.16.111.255
vmnet8: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 00:50:56:c0:00:08 
    inet 192.168.220.1 netmask 0xffffff00 broadcast 192.168.220.255

E nella mia VM, ip a è come questa:

[root@localhost yangmi]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:47:93:4b brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.25/24 brd 192.168.1.255 scope global eno16777736
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe47:934b/64 scope link 
       valid_lft forever preferred_lft forever
3: eno33554992: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:50:56:26:58:01 brd ff:ff:ff:ff:ff:ff
    inet 192.168.220.129/24 brd 192.168.220.255 scope global dynamic eno33554992
       valid_lft 1688sec preferred_lft 1688sec
    inet6 fe80::250:56ff:fe26:5801/64 scope link 
       valid_lft forever preferred_lft forever
4: eno50332216: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:47:93:5f brd ff:ff:ff:ff:ff:ff
    inet 192.168.220.130/24 brd 192.168.220.255 scope global dynamic eno50332216
       valid_lft 1688sec preferred_lft 1688sec
    inet6 fe80::20c:29ff:fe47:935f/64 scope link 
       valid_lft forever preferred_lft forever
5: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN 
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
6: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN qlen 500
    link/ether 52:54:00:4a:68:e5 brd ff:ff:ff:ff:ff:ff

vedi eno16777736 ip è 192.168.1.25/24 , è la stessa WLAN con l'interfaccia en0 del mio Mac.

Ma nella VM, non posso ping l'IP di baidu:

[root@localhost yangmi]# ping 220.181.57.217
PING 220.181.57.217 (220.181.57.217) 56(84) bytes of data.
From 192.168.1.25 icmp_seq=1 Destination Host Unreachable
From 192.168.1.25 icmp_seq=2 Destination Host Unreachable
From 192.168.1.25 icmp_seq=3 Destination Host Unreachable
From 192.168.1.25 icmp_seq=4 Destination Host Unreachable
From 192.168.1.25 icmp_seq=5 Destination Host Unreachable
From 192.168.1.25 icmp_seq=6 Destination Host Unreachable
From 192.168.1.25 icmp_seq=7 Destination Host Unreachable

Come posso usare la VM per connettere la rete?

Il sistema del mio ospite è: macOS Sierra 10.12.2
Il sistema della mia VM è: CentOS 7.2

Modifica

Uso ip route show :

[root@localhost yangmi]# ip route show
default via 192.168.1.1 dev eno16777736 
default via 192.168.220.2 dev eno33554992  proto static  metric 100 
default via 192.168.220.2 dev eno50332216  proto static  metric 101 
169.254.0.0/16 dev eno16777736  scope link  metric 1002 
192.168.1.0/24 dev eno16777736  proto kernel  scope link  src 192.168.1.25 
192.168.122.0/24 dev virbr0  proto kernel  scope link  src 192.168.122.1 
192.168.220.0/24 dev eno33554992  proto kernel  scope link  src 192.168.220.129  metric 100 
192.168.220.0/24 dev eno50332216  proto kernel  scope link  src 192.168.220.130  metric 101 

EDIT -2

Uso il comando traceroute per ottenere le seguenti informazioni:

[yangmi@localhost ~]$ traceroute 220.181.57.217
traceroute to 220.181.57.217 (220.181.57.217), 30 hops max, 60 byte packets
 1  192.168.1.25 (192.168.1.25)  3006.884 ms !H  3006.653 ms !H  3006.635 ms !H

EDIT -3

Nel /etc/sysconfig/network-scripts/ , c'è solo una sola interfaccia di rete, ma nella parte superiore si vede che uso ip a ne ho tre:

[yangmi@localhost network-scripts]$ ls
ifcfg-eno16777736  ifdown-ppp       ifup-ib      ifup-Team
ifcfg-lo           ifdown-routes    ifup-ippp    ifup-TeamPort
ifdown             ifdown-sit       ifup-ipv6    ifup-tunnel
ifdown-bnep        ifdown-Team      ifup-isdn    ifup-wireless
ifdown-eth         ifdown-TeamPort  ifup-plip    init.ipv6-global
ifdown-ib          ifdown-tunnel    ifup-plusb   network-functions
ifdown-ippp        ifup             ifup-post    network-functions-ipv6
ifdown-ipv6        ifup-aliases     ifup-ppp
ifdown-isdn        ifup-bnep        ifup-routes
ifdown-post        ifup-eth         ifup-sit
    
posta aircraft 07.07.2017 - 11:47
fonte

1 risposta

3

CentOS VM è configurato con tre interfacce di rete (Ethernet) in VMware:

In il tuo sistema Linux appaiono come:

  • eno16777736 (un'interfaccia collegata all'interfaccia Wi-Fi fisica del tuo Mac en0)
  • eno33554992 (un'interfaccia collegata al tuo Mac vmnet8="Condividi con il mio Mac"
  • eno50332216 (una seconda interfaccia collegata al tuo Mac vmnet8="Condividi con il mio Mac"

vmnet1 / vmnet8 sono dispositivi di rete virtuali creati da VMware Fusion e forniscono una VM solo per host e una rete NAT.

Ora il tuo host Linux è NAT'ed due volte alla tua rete 192.168.1.0/24 tramite vmnet8 e si trova nella stessa rete 192.168.1.0/24 allo stesso tempo - che è un po 'esagerato e causa problemi di routing nel tuo ambiente.

Quindi spegni la VM e rimuovi le due interfacce "Condividi con il mio Mac" nelle impostazioni > Dispositivi rimovibili di CentOS VM o rimuovere l'interfaccia a ponte e una delle interfacce "Condividi con il mio Mac". Quale procedura scegliere / il percorso da percorrere dipende dallo scopo della VM.

    
risposta data 08.07.2017 - 05:05
fonte

Leggi altre domande sui tag