Set default connection for internet connectivity - ubuntu

2

I have two connections on my computer:

sudo route -n

Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0 192.168.1.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0 192.168.8.0 0.0.0.0 255.255.255.0 U 1 0 0 usb0

sudo ifconfig -a

eth0 Link encap:Ethernet
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::dafe:e3ff:fea8:3849/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:665046 errors:0 dropped:0 overruns:0 frame:0 TX packets:704568 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:353848993 (353.8 MB) TX bytes:160486634 (160.4 MB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:70800 errors:0 dropped:0 overruns:0 frame:0 TX packets:70800 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:11629088 (11.6 MB) TX bytes:11629088 (11.6 MB)

usb0 Link encap:Ethernet
inet addr:192.168.8.100 Bcast:192.168.8.255 Mask:255.255.255.0 inet6 addr: fe80::8c3e:63ff:fe53:fc9e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:58695 errors:0 dropped:0 overruns:0 frame:0 TX packets:51046 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:15793544 (15.7 MB) TX bytes:10477325 (10.4 MB)

ip route show

default via 192.168.1.1 dev eth0 proto static 169.254.0.0/16 dev eth0 scope link metric 1000 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.2 metric 1 192.168.8.0/24 dev usb0 proto kernel scope link src 192.168.8.100 metric 1

Normally, I will be using Wired connection1 which is wired connection using phone cable. But when I connect the USB device, the problem starts. New connection will appear as Wired connection3 and the device is a wifi router with a web interface to login and connect. After I connect the device to USB, every request to any website will be redirected to login page on 192.168.8.1 (which is quite normal). I can load websites for a short while when I manually click Wired connection1. But when I continue browsing or refresh the same page, browser will be redirected back to login page of Wired connection3(this is not the intended behavior, who choose Wired connection3 again?).

Now to use the Internet, I will have to either disconnect Wired connection3 (sometimes it appears as Wired connection4) from menu or unplug the device. Is there anyway, I can keep my Internet connection alive on Wired connection1 and still access the wifi router USB device on 192.168.8.1?

Update - More clarification


connection  -  name  -  router access  -  connected router
--------------------------------------------------------------------------
Wired connection1  -  eth0  -  192.168.1.1  -  beetel router
Wired connection3  -  usb0  -  192.168.8.1  -  usb wireless router with HSPA+

sudo route -n gives the same output on Wired connection1 and Wired connection3 when Wired connection3 is not disconnected:

Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0 192.168.1.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0 192.168.8.0 0.0.0.0 255.255.255.0 U 1 0 0 usb0

when Wired connection3 disconnects, it changes to:

Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0 192.168.1.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0



Update - After trying @MariusMatutiae's answer

Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0 192.168.1.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0 192.168.8.0 0.0.0.0 255.255.255.0 U 1 0 0 usb0

Still the result switch between login page and actual web-page after choosing Wired connection1 many times.

Unless I diconnect Wired connection3, the results where:

https://github.com/ https://mail.google.com/mail/u/0/#inbox https://www.digitalocean.com/

Showing Unable to connect

http://jsonlint.com/

Showing correct page

http://superuser.com/ http://askubuntu.com/ http://ionicframework.com/

Showing http://192.168.8.1/html/home.html

KrIsHnA

Posted 2016-03-21T18:16:08.583

Reputation: 121

No answers