Solved How do I configure bhyve with a static ip?

Greg Fitzgerald

Member

Reaction score: 5
Messages: 58

I'm trying to configure bhyve to use a static ip address on my network. I know I can use nat and dhcp but I'm trying to learn how to configure a static ip as a learning lesson.

I used the vm utility to configure bhyve like so

Code:
betsy# vm switch list
NAME  TYPE  IDENT  VLAN  NAT  PORTS
public  auto  bridge1  -        -      re0

I created a debian based vm and configured a static ip.

Code:
root@debian:~# cat /etc/network/interfaces
auto eth0
iface eth0 inet static
   address 192.168.1.213
   netmask 255.255.255.0
   gateway 192.168.1.1

root@debian:~# netstat -arn
Kernel IP routing table
Destination  Gateway  Genmask  Flags  MSS Window  irtt Iface
0.0.0.0  192.168.1.1  0.0.0.0  UG  0 0  0 eth0
192.168.1.0  0.0.0.0  255.255.255.0  U  0 0  0 eth0

I can't ping the gateway or any other ips from the debian box.

Code:
root@debian:~# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
From 192.168.1.213 icmp_seq=1 Destination Host Unreachable
From 192.168.1.213 icmp_seq=2 Destination Host Unreachable
From 192.168.1.213 icmp_seq=3 Destination Host Unreachable

From the host machine this is what re0 looks like.

Code:
betsy# ifconfig re0
re0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
   options=82099<RXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
   ether 78:24:af:43:2b:7f
   inet 192.168.1.209 netmask 0xffffff00 broadcast 192.168.1.255
   nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
   media: Ethernet autoselect (1000baseT <full-duplex>)
   status: active
 

usdmatt

Daemon

Reaction score: 601
Messages: 1,543

First thing would be to confirm that you have a bridge1 interface, and that it has re0 and the guest's tap interface as members. Other than that is should just work, unless you have some firewall rules blocking the traffic.
 
OP
Greg Fitzgerald

Greg Fitzgerald

Member

Reaction score: 5
Messages: 58

First thing would be to confirm that you have a bridge1 interface, and that it has re0 and the guest's tap interface as members. Other than that is should just work, unless you have some firewall rules blocking the traffic.

Yeah that was pretty much it. My bridge configuration wasn't right. Thanks for the hint.
 
Top