I am using couple interfaces on my board. eth2 is my control interface - I want to control board through ssh on this interface. eth1 is my back-2-back interface with another board I have.

My problem occurs after reboot. Defult ip route is first set for eth1, then for eht2. This forces me to ssh through eth1 (back-2-back), as all of replies to my ssh traffic going to eth2, will be ip forwarded and push out of eht1.

How can I configure interface's boot order so that eth2 is first to register default ip route?


You need to add the new defaut gatway , Remove the old one then save routing information to a configuration file:

route add default via xx.xx.xx.xx
route del default via yy.yy.yy.yy
ip route add default gw xx.xx.xx.xx
ip route del default gw yy.yy.yy.yy

The new gatway = xx.xx.xx.xx

the old gatway = yy.yy.yy.yy

Save routing information:

nano /etc/network/interfaces

add the following line:

gateway xx.xx.xx.xx

Restart networking:

/etc/init.d/networking restart
  • 1
    thanks, in the end I discovered that I had GATEWAY field in my 'ifcfg-eth1' and that was causing linux to add that defualt rule to routing table. – GoTTimw Oct 5 '16 at 11:27

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.