Trying to add host route via specific interface in Solaris 10

routingsolaris

I have added a second ethernet to a host in order to route backups traffic over a second wire (to avoid saturating the main link). I have to rely on network admins on the other side of planet for this, and they gave me a second IP in the same subnet as the main interface.

I attempted to add a route like this to force traffic via the backups link (e1000g1) rather than the main link (e1000g0):

route add 10.0.1.19 192.168.2.1 -ifp e1000g1

where:

  • 10.0.1.19 is my backup server
  • 192.168.2.1 is the gateway for the local subnet

This did not work. If I try to ping the backup server from the host, snooping on both interfaces shows that packets never even go out. I just get ICMP unreachable.

On the suggestion of a coworker, I also tried this variation:

route add 10.0.1.19 192.168.2.5 -ifp e1000g1

Where 192.168.2.5 is the interface address for e1000g1. That has the same result.

Is it possible to make this work, or do I need to have two separate subnets for this to work?

Best Answer

You should be able to this, you just need to add a higher metric for the secondary route.

By default the primary route will have metric 1 so in order to add the second one you just need any higher value.

route add 10.0.1.19 192.168.2.5 -ifp e1000g1 metric 2

This way when the first route goes down the traffic will automatically go through the secondary network