ipv4 routing from bhyve

Allan Jude allanjude at freebsd.org
Mon Jan 12 16:54:42 UTC 2015


On 2015-01-11 16:32, williamecowell at hush.ai wrote:
> Hello, I hope I can have some assistance.
> 
> I am trying to get networking via wlan0 but without NAT or bridging (doesn't work on wifi unless WDS).
> 
> say my my main network is 10.10.2.0/24, gateway/internet is 10.10.2.1, my ip is 10.10.2.252.
> 
> I started to config my bhyve network on 172.16.32.0/24
> 
> I added a bridge interface with an ip of 172.16.32.1
> 
> enable forwarding and fastforwarding. from my understanding of the handbook chapter things should work when I type:
> 
> # route add -net 172.16.32.0/24 10.10.2.252
> route: writing to routing socket: File exists
> add net 172.16.32.0: gateway 10.10.2.252 fib 0: route already in table
> # 
> 
> # netstat -4nr
> Routing tables
> 
> Internet:
> Destination        Gateway            Flags      Netif Expire
> default            10.10.2.1        UGS       lagg0
> 127.0.0.1          link#3             UH          lo0
> 10.10.2.0/24     link#5             U         lagg0
> 10.10.2.252      link#5             UHS         lo0
> 172.16.32.0/24    link#4             U       bridge0
> 172.16.32.1       link#4             UHS         lo0
> # 
> 
> bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
> 	ether 00:bd:0f:fc:01:10
> 	inet 172.16.32.1 netmask 0xffffff00 broadcast 172.16.32.255 
> 	nd6 options=9<PERFORMNUD,IFDISABLED>
> 	id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
> 	maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
> 	root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
> 	member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
> 	        ifmaxaddr 0 port 6 priority 128 path cost 2000000
> lagg0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
> ...
> 	inet 10.10.2.252 netmask 0xffffff00 broadcast 10.10.2.255 
> 	nd6 options=9<PERFORMNUD,IFDISABLED>
> 	media: Ethernet autoselect
> 	status: active
> 	laggproto failover lagghash l2,l3,l4
> 	laggport: alc0 flags=1<MASTER>
> 	laggport: wlan0 flags=4<ACTIVE>
> tap0: flags=8903<UP,BROADCAST,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
> 	options=80000<LINKSTATE>
> 	ether 00:bd:8f:62:67:10
> 	nd6 options=9<PERFORMNUD,IFDISABLED>
> 	media: Ethernet autoselect
> 	status: no carrier
> wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
> ...
> pflog0: flags=141<UP,RUNNING,PROMISC> metric 0 mtu 33160
> tap9: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
> 	options=80000<LINKSTATE>
> 	ether 00:bd:cb:46:02:09
> 	nd6 options=1<PERFORMNUD>
> 	media: Ethernet autoselect
> 	status: no carrier
> tap1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
> 	options=80000<LINKSTATE>
> 	ether 00:bd:58:61:02:01
> 	nd6 options=1<PERFORMNUD>
> 	media: Ethernet autoselect
> 	status: no carrier
> 
> Willy,
> 
> PS. sorry for the x post as wasn't sure which list..
> 
> _______________________________________________
> freebsd-virtualization at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
> To unsubscribe, send any mail to "freebsd-virtualization-unsubscribe at freebsd.org"
> 

You can use ip forwarding (or fast forwarding) to send traffic generated
on the new subnet (172.16.32.0/24) out to your network. But unless you
configure a static route (or setup a routing protocol like RIP), the
other hosts on your network will not know how to reach 172.16.32.0/24 to
reply. So the static route you were trying to add, would need to be
added to every machine EXCEPT the VM Host, which already has an IP in
that subnet.

-- 
Allan Jude

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-virtualization/attachments/20150112/3c7d3adb/attachment.sig>


More information about the freebsd-virtualization mailing list