How to set static routing

Is this a right way
Code:
ifconfig_re0="-inet 192.168.0.1 netmask 0xffffff00 fib 1
 route add -net 192.168.0.0/24 192.168.0.1 -fib 1
 
Last edited:
Note, this has nothing to do with source routing. Source routing is a horrible security nightmare and most, if not all, routers simply ignore it.

What you're trying to do is just normal routing but using two or more different routing tables.
 
  • Thanks
Reactions: pit
Try to insert in rc.conf(5) something like this
Code:
static_routes="foo bar"
route_foo="-host 172.16.0.100 192.168.0.1"
route_bar="-net 172.16.1.0/24 192.168.1.1"
 
Code:
ifconfig_re0="-inet 192.168.0.1 netmask 0xffffff00 fib 1 route add -net 192.168.0.0/24 192.168.0.1 -fib 1
Note that there's no need to add a route for 192.168.0.0/24 as it is an implied route because the interface is in that network.
 
Back
Top