0

On my Ubuntu 16.04 I'm using local net and mobile internet via Android phone. I'm completely novice at routing but this is what I have. Just after connecting phone I have routes table:

default via 10.205.103.1 dev enp2s0  proto static  metric 100
default via 192.168.42.129 dev enp0s29f7u5  proto static  metric 101 
10.205.32.136 via 10.205.103.1 dev enp2s0  proto dhcp  metric 100 
10.205.103.0/24 dev enp2s0  proto kernel  scope link  src 10.205.103.53  metric 100 
169.254.0.0/16 dev enp2s0  scope link  metric 1000 
192.168.42.0/24 dev enp0s29f7u5  proto kernel  scope link  src 192.168.42.72  metric 100

To have local net (gate 10.205.103.1) and internet both I used

sudo route add default gw 192.168.42.129 metric 2
sudo route add -net 10.205.0.0/16 gw 10.205.103.1 metric 1

So I have

default via 192.168.42.129 dev enp0s29f7u5  metric 2 
default via 10.205.103.1 dev enp2s0  proto static  metric 100 
default via 192.168.42.129 dev enp0s29f7u5  proto static  metric 101 
10.205.0.0/16 via 10.205.103.1 dev enp2s0  scope link  metric 1
etc. 

All work good, these 2 routes have been added to the table but I have a problem because of some mysterious for me reason - my first route drops every some minutes (~10-15, don't know what it depends on) and I got another table:

default via 10.205.103.1 dev enp2s0  proto static  metric 100 
default via 192.168.42.129 dev enp0s29f7u5  proto static  metric 101
10.205.0.0/16 via 10.205.103.1 dev enp2s0  scope link  metric 1
etc.

So I have to re-run command sudo route add default gw 192.168.42.129 metric 2. Why does it happen and how to avoid it? Removing default route via 192.168.42.129 (that one with metric 101) before adding mine has no effect - when my created route drops this route returns into table.

0

I would suggest do this with network-manager (in GUI/desktop network settings so) not on bash directly.

For 10.205.103.1 in IPv4 settings / Routes... / uncheck:

use this connection only for resources on its network

Your route table should be clean this way and it resists unplugs and reboots.

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.