0

I have two network interfaces in Linux machine , eth0 and eth1. IP is assigned to both interface from two different VLANs and default gateway to eth0. Now if interface eth0 is down I am unable to route traffic outside as default gateway is also unavailable.

Is there is any way to address this scenarios?

0

it's not clear from your description, are both interfaces connected to the same network.
Anyway,:
let's assume
you have
eth0 - 192.168.10.10/24, gw 192.168.10.1
eth0 - 170.10.0.10/24, gw 170.10.0.1

  1. create new rule
    #ip ru add table 5 prio 20000 from 170.10.0.10
  2. create new default rule
    `#ip ro add table 5 default via 170.10.0.1'

so, you can check the settings by:
#ip ru sh - see rules
0: from all lookup local
20000: from 170.10.0.10 lookup 5

#ip ro sh ta 5 - see routing for you table
default via 170.10.0.1 dev eth1

BTW, there is a good reading concerning linux routing Linux Advanced Routing & Traffic Control

  • hi, It is connected to same network but different VLAN. From above solution if eth0 is goes down , then eth1 default gw will work? – user50879 Nov 8 '13 at 9:55
  • this solution will work independently to VLANs, but it has some obvious limitation - if you receive IPs via DHCP/SLAAC - it will be difficult to add such rule/route – vasily-vm Nov 8 '13 at 12:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.