The default behavior of a FreeBSD host is only to pick up packets that are destined for the same host. In case there are multiple network interfaces installed on the host, the system does not forward traffic between interfaces by default.
This behavior is changed by enabling IP forwarding using the sysctl(8)
utility:
# sysctl net.inet.ip.forwarding=1
# sysctl net.inet6.ip6.forwarding=1
The above commands will enable forwarding for IPv4 and IPv6 respectively.
To make these changes permanent, you can also add the following lines to the /etc/rc.conf
file:
gateway_enable="YES" ipv6_gateway_enable="YES"
By enabling IP Forwarding (routing) between interfaces, the system will pick up all the packets that have the layer2 destination, (MAC) address of the same host, and will forward it to an appropriate network interface, according to the system's routing table.
Once the forwarding is enabled, the forwarding behavior can be controlled by modifying the routing table. This is...