Ubuntu in bhyve cannot connect to outside network

I've installed Ubuntu 14.04 in bhyve. However, networking cannot connect to the outside world. "ping 8.8.8.8" and "host google" does not work at all.

Here's from the INSIDE of the Ubuntu environment:

Code:
serveradmin@ubuntu:~$ ifconfig -a
eth0      Link encap:Ethernet  HWaddr 58:9c:fc:01:a3:2d
          inet addr:172.16.0.11  Bcast:172.16.0.255  Mask:255.255.255.0
          inet6 addr: fe80::5a9c:fcff:fe01:a32d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10 errors:0 dropped:0 overruns:0 frame:0
          TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:636 (636.0 B)  TX bytes:3220 (3.2 KB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

serveradmin@ubuntu:~$

Code:
serveradmin@ubuntu:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.16.0.1      0.0.0.0         UG    0      0        0 eth0
172.16.0.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
serveradmin@ubuntu:~$

And, here's my pf file (in the FreeBSD host environment):

Code:
set skip on lo

include "/bhyve/.config/pf-nat.conf"

pass in quick on igb0 inet proto tcp from any to 172.9.177.174 port 22
pass out quick on igb0 inet proto { tcp, udp } from 172.9.177.174 to any port 53
pass out quick on igb0 inet proto { tcp, udp } from 172.9.177.174 to any port 123

block drop log all

#bhyve
pass in on bridge0 keep state
pass out on bridge0 keep state

I've also tried "set skip on bridge0". It didn't work.

The .config/pf-nat.conf (automatically generated, in FreeBSD host environment):

Code:
# vm-bhyve nat
nat on igb0 from {172.16.0.0/24} to any -> (igb0)

And the ifconfig output (FreeBSD host environment):
Code:
bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        description: vm-public
        ether 02:9d:d7:9b:f8:00
        inet 172.16.0.1 netmask 0xffffff00 broadcast 172.16.0.255
        nd6 options=1<PERFORMNUD>
        groups: bridge
        id 00:00:00:00:00:00 priority 0 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
        root id 00:00:00:00:00:00 priority 0 ifcost 0 port 0
        member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 5 priority 128 path cost 2000000
tap0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        description: vmnet-ubuntu-0-public
        options=80000<LINKSTATE>
        ether 00:bd:50:0a:f7:00
        hwaddr 00:bd:50:0a:f7:00
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: active
        groups: tap
        Opened by PID 61667

Code:
# vm switch info
------------------------
Virtual Switch: public
------------------------
  type: auto
  ident: bridge0
  vlan: -
  nat: yes
  physical-ports:
  bytes-in: 4052 (3.957K)
  bytes-out: 636 (636.000B)

  virtual-port
    device: tap0
    vm: ubuntu

Code:
# vm switch list
NAME            TYPE       IDENT       VLAN      NAT          PORTS
public          auto       bridge0     -         yes          -

I've noticed that the IP address within Ubuntu environment is "172.16.0.11". But this does not show up anywhere in the bridge0 or tap0 of the FreeBSD host environment. The bridge0 shows "172.16.0.1" which is the gateway.

What am I missing? How do I solve my problem?

Any help would be greatly appreciated. Thanks in advance!
 
The first thing you need to fix is your bridge: it has only one member tap0. It should also contain at least one real network interface.
Please refer to the handbook.
 
aragats You mean "em0" as my real network interface. Yes, I have that. I omitted posting here because is too long it contains many IP addresses including those for jails. The "em0" is working properly. Please clarify if this is what you mean.
 
Your bridge0 has only one member: tap0. It must have at least one more member: your host system's network interface.
Eth0 is your guest's interface, it has nothing to do with the bridge.
 
Back
Top