Hi,
My freebsd has multiple network interfaces and have one default gateway e.g. 192.168.0.1/24 . I want that the gateway should be 10.0.0.1/24 when any request/traffic arrives on the IP 10.0.0.20/24, I mean it should not consider the default gateway when the traffic comes for IP 10.0.0.20/24 . Is this something I can achieve ?

Regards
 
The interface that's connected to the 10.0.0.0/24 network will receive the traffic. It's a so-called directly connected network, there's already an implicit route for it. The 'default' gateway is only used if there's no other, more appropriate, route.
 
Thanks for your reply :)
The problem is I receive public-IP traffic on both the interfaces i.e. 10.0.0.20 and on 192.168.0.20, in this case only one default gateway can work, but what I want is when the public IP traffic comes on interface 10.0.0.20 the default gateway should be 10.0.0.1 and when the public IP traffic comes to interface 192.168.0.20 the default gateway should be 192.168.0.1. Do we have some work around for this ?

Regards
 
Hi again,
Many thanks, just one more question, does it work with the logical interfaces as well ? I have a lagg0 interfaces made up of physical interfaces bxe0,bxe1. Then further two interfaces are created on lagg0 say vlan20 and vlan30, now using fib can I have two default gateway 1st for vlan20 logical interface and 2nd for vlan30 logical interface ?

Regards
 
Hi again,
Many thanks, just one more question, does it work with the logical interfaces as well ? I have a lagg0 interfaces made up of physical interfaces bxe0,bxe1. Then further two interfaces are created on lagg0 say vlan20 and vlan30, now using fib can I have two default gateway 1st for vlan20 logical interface and 2nd for vlan30 logical interface ?

Regards
I don't know, never used vlan. But, reading ifconfig(8), this seems not easy.

fib fib_number
Specify interface FIB. A FIB fib_number is assigned to all
frames or packets received on that interface. The FIB is not
inherited, e.g., vlans or other sub-interfaces will use the de-
fault FIB (0) irrespective of the parent interface's FIB. The
kernel needs to be tuned to support more than the default FIB
using the ROUTETABLES kernel configuration option, or the
net.fibs tunable.
 
Back
Top