To configure static routing on a FreeBSD system, you can use the route
command.
For example, to add a static route for the network 192.168.1.0/24 via the gateway 10.0.0.1, you can use the following command:
route add -net 192.168.1.0/24 10.0.0.1
This will add a static route for the network 192.168.1.0/24 via the gateway 10.0.0.1.
To make the static route persistent across reboots, you can add the route to the /etc/rc.conf
file. For example:
static_routes="net1" route_net1="-net 192.168.1.0/24 10.0.0.1"
This will add the static route to the /etc/rc.conf
file, and the route will be automatically added when the system boots.
You can find more information about the route
command and its options in the route
documentation or by running the route --help
command.
You can also use the netstat
command to display the routing table on a FreeBSD system. For example:
netstat -rn
This will display the routing table on the system, showing the destination networks and the corresponding gateways.
You can find more information about the netstat
command and its options in the netstat
documentation or by running the netstat --help
command.