Dynamic routing in Ubuntu 18

Asked by Nikhil

My server is on a Cruze ship.
Its has two NIC ports attached to it. And both are connected to different internet provider.

OS : Ubuntu 18.04 LTS

Interface ENO1 - Slower Satellite network - and its always available. Static IP is assigned to it.
Interface ENO2 - Faster LTE network - its available only when ship is near the Sea Shore. IP is assigned via DHCP
Both IP are in different subnets.

Requirement : I want to switch between these two network effectively / dynamically.

Scenario -
When ship is sailing ( in the sea) I want to use Satellite network to connect to server. ( ENO1 )
When ship comes near to the sea shore ( where we have a 4G LTE network available - ENO2 ) I want to switch the default connection to ENO2. - So that my dev team can do application deployment on faster internet.
And same when ship goes back into the sea - want to switch back to satellite network again ( ENO 1)

Solutions I considered :

1. NIC binding / teaming : Since both NICs are in different subnets - don’t think NIC binding is possible.

2 . I wrote a script to keep pinging 8.8.8.8 via faster network card ( ENO2 ) and Change the metric of ENO1 to 0 - so it will have a higher priority and traffic will go through it.
And when my Ping to 8.8.8.8 fails to reach via ENO2 , I Change the metric from 0 to 100 to lower its priority over ENO1 (default metric of ENO2 is set to 50 )
This Solution is working as of now : But i still think it's a workaround.

 I am Looking for a better solution for this Scenario. Well, I have a sandbox server to try out your suggestions, so feel free to shoot.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

Yes, bonding will work fine. The subnet shouldn't matter. It's the interface being present that is bonded

https://www.tecmint.com/configure-network-bonding-teaming-in-ubuntu/

Can you help with this problem?

Provide an answer of your own, or ask Nikhil for more information if necessary.

To post a message you must log in.