系统版本 freebsd12.2
方法1
在 /etc/rc.conf中添加 gateway_enable=“YES” ,之后重启网络 /etc/netstart restart 。
方法2
临时开启:执行 sysctl net.inet.ip.forwarding=1
永久开启: 在 /etc/sysctl.conf 中添加 net.inet.ip.forwarding=1
检测
使用sysctl查询net.inet.ip.forwarding,值为1表示生效 (即使使用方式1,配置后net.inet.ip.forwarding值也会为1)。