ipfw kernel NAT

This sets up stupid-simple NAT to allow a bhyve instance to talk to the
internet. This is especially useful when your connection is wireless so
you can't just bridge it. Assumes IPFW is already loaded note that it
loads with a default deny all.

in /etc/rc.conf:

firewall_enable="YES"
firewall_type="OPEN"
firewall_quiet="NO"
firewall_logging="YES"
gateway_enable="YES"

Run:

#this needs to be the same tap the bhyve uses, 1 per bhyve
ifconfig tap0 create
ifconfig tap0 10.0.9.1/30

#Load the IPFW nat module if it isn't already
kldload ipfw_nat

#create an IPFW NAT instance on your internet interface
ipfw nat 9999 config if wlan0

#pass outbound traffic from the internal network through NAT
ipfw add 9001 nat 9999 ip from 10.0.9.0/24 to any out via wlan0
ipfw add 9002 nat 9999 ip from any to any in via wlan0

Then just configure the bhyve to have an IP in the 10.0.9.0/24 network

https://lists.freebsd.org/pipermail/freebsd-virtualization/2014-October/002998.html

kldload ipfw_nat は firewall_nat_enable="YES"


FreeBSD IPFW + Kernel NAT | どうでもいいブログ

Adventurist.me: Simple ipfw NAT for bhyve virtual machines and vnet jails

https://lists.freebsd.org/pipermail/freebsd-ipfw/2015-August/005928.html

natdを使用しない方法。natdを使用する方法は以下

FreeBSD NAT ipfw - external storage 1