4

On my Mac, I use VMware Fusion created a VM, my Mac's ifconfig is like below:

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

And in my VM, the ip a is like this :

[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

you see the eno16777736 ip is 192.168.1.25/24, is the same WLAN with my Mac's en0 interface.

But in the VM, I can not ping the baidu's ip:

[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

How can I use the VM connect the network?


My host's system is: macOS Sierra 10.12.2
My VM's system is: CentOS 7.2


EDIT

I use the 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

I use the traceroute command get the below information:

[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

In the /etc/sysconfig/network-scripts/, there is only only one network interface, but in the upper you see I use ip a I have three:

[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

migrated from serverfault.com Jul 7 '17 at 10:03

This question came from our site for system and network administrators.

  • @Allan No, they are not a same IP, they are in a same WLAN, you see one is 192.168.1.25(My VM), the other is 192.168.1.6(My mac). – aircraft Jul 7 '17 at 10:24
  • @klanomath I have updated my post. – aircraft Jul 7 '17 at 10:28
  • What do you get when you issue the command in CentOS ip route show? – Allan Jul 7 '17 at 10:36
  • You have three default route entries two of which are for the same gateway for different adapters. Set a new gateway: sudo vi /etc/sysconfig/network and make sure the only line is GATEWAY=192.168.1.1 (comment out any other lines) then reboot. If networking works, this is a CentOS issue and how it's configured, not an Apple one. – Allan Jul 7 '17 at 10:58
  • 1
    @aircraft You've configured three network interfaces in VMware for your VM. Remove the two which show "Share with my Mac" and only leave the one bridged to Wi-Fi. Or edit the file /etc/sysconfig/network/ifcfg-eno16777736 and change DEFROUTE to yes and BOOTPROTO to static. Then either restart the network service or reboot. I don't know if the latter (edit ifcfg...) really works - it should though. – klanomath Jul 8 '17 at 2:13
3

Your CentOS VM is configured with three network interfaces (Ethernet) in VMware:

In your Linux system they appear as:

  • eno16777736 (an interface bridged to your Mac's physical Wi-Fi interface en0)
  • eno33554992 (an interface connected to your Mac's vmnet8 = "Share with my Mac"
  • eno50332216 (a second interface connected to your Mac's vmnet8 = "Share with my Mac"

vmnet1/vmnet8 are virtual network devices created by VMware Fusion and provide a host-only and a NAT'ed network to VMs.

Now your Linux host is NAT'ed two times to your 192.168.1.0/24 network via vmnet8 and is in the 192.168.1.0/24 network itself at the same time - which is a bit over the top and causes routing problems in your environment.

So shut down the VM and either remove the two "Share with my Mac" interfaces in the settings > Removable devices of the CentOS VM or remove the bridged interface and one of the "Share with my Mac" interfaces. Which procedure to choose/path to go depends on the purpose of the VM.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .