Simple gateway with NAT

Enable gatewaying

For IPv4: # sysctl net.inet.ip.forwarding=1

For IPv6: # sysctl net.inet6.ip6.forwarding=1

Make permanent (OpenBSD, NetBSD) with

/etc/sysctl.conf

net.inet.ip.forwarding=1
net.inet6.ip6.forwarding=1

Make permanent (FreeBSD) with

/etc/rc.conf

gateway_enable="YES" #for ipv4
ipv6_gateway_enable="YES" #for ipv6