machyve / xhyve

xhyve, a lightweight OS X virtualization solution
Other
6.44k stars 356 forks source link

No network inside Linux guest #185

Open horacelau opened 4 years ago

horacelau commented 4 years ago

Host is MacOS 10.14.6.

I've tried TinyCoreLinux and Ubuntu (16.04.6-server-amd64). Guest unable to get DHCP response. Tried manually configuring network with IP in 192.168.64.x subnet (i.e., 192.168.64.5) but unable to ping host and host also unable to ping guest.

Tried both virtio-net and e1000.

Using brew xhyve (HEAD-1f46a3d).

Here's ifconfig with Linux guest booted:

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
XHC0: flags=0<> mtu 0
XHC20: flags=0<> mtu 0
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 8c:85:90:41:b9:de 
    inet 192.168.1.44 netmask 0xffffff00 broadcast 192.168.1.255
    media: autoselect
    status: active
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
    ether 0e:85:90:41:b9:de 
    media: autoselect
    status: inactive
awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1484
    ether ce:28:12:46:df:6a 
    inet6 fe80::cc28:12ff:fe46:df6a%awdl0 prefixlen 64 scopeid 0x8 
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: active
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    options=60<TSO4,TSO6>
    ether 1a:00:00:d1:86:01 
    media: autoselect <full-duplex>
    status: inactive
en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    options=60<TSO4,TSO6>
    ether 1a:00:00:d1:86:00 
    media: autoselect <full-duplex>
    status: inactive
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=63<RXCSUM,TXCSUM,TSO4,TSO6>
    ether 1a:00:00:d1:86:00 
    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 10 priority 0 path cost 0
    member: en2 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 9 priority 0 path cost 0
    media: <unknown type>
    status: inactive
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
    inet6 fe80::fb0f:de05:5f1b:1b16%utun0 prefixlen 64 scopeid 0xc 
    nd6 options=201<PERFORMNUD,DAD>
en10: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    ether 62:01:2e:77:e7:61 
    media: autoselect
    status: active
bridge100: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=3<RXCSUM,TXCSUM>
    ether 8e:85:90:14:45:64 
    inet 192.168.64.1 netmask 0xffffff00 broadcast 192.168.64.255
    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: en10 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 13 priority 0 path cost 0
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: active
horacelau commented 4 years ago

No one has any ideas on how to debug this issue?

xpepermint commented 4 years ago

+1

xpepermint commented 4 years ago

@horacelau I figured this out:

  1. You need to run it with sudo.
  2. You need to add -s 2,virtio-net,tap0 into the executable.
horacelau commented 4 years ago

@horacelau I figured this out:

You need to run it with sudo. You need to add -s 2,virtio-net,tap0 into the executable.

Thanks @xpepermint, but that doesn't seem to fix my problem.

dijitaltrix commented 3 years ago

@horacelau FWIW I had to install my guest with the -U ... option before it could see out

horacelau commented 3 years ago

@horacelau FWIW I had to install my guest with the -U ... option before it could see out

Can you provide details on exactly what you did?

dijitaltrix commented 3 years ago

@horacelau Create a UUID (from a Mac shell prompt use uuid), copy that into your vm startup script, then run the VM and install the guest OS. You'll need to run it with sudo, I've added an example run script (for FreeBSD) here https://gist.github.com/dijitaltrix/2986ec7953600217933e5af504a09352