darkencraft
Posts: 2
Joined: Mon Jun 04, 2018 7:05 am

Using Wifi/USB and wlan for internet and direct access

Mon Jun 04, 2018 7:17 am

Hi,
I have a rpi that is directly connected to my laptop through ethernet cable for ssh access from my laptop.
With wlan or usb I am connected to internet either through wireless router or usb tethering from my phone.

The problem is that when I have rpi connected to my laptop for ssh, my rpi does not have any access to internet even though I am connected either through wlan or usb. When I pull off my direct connection to my laptop (and reboot), rpi gets connected to internet.

Is there anyways to configure rpi that the rpi receives internet connection from wlan/usb while have access from ssh through direct connection?

I am aware that there can be some workaround, such as having my direct connection bridged to internet enabled adapter to gain access to internet, but I currently have no such option due to a company restriction (blocked bridging).

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Using Wifi/USB and wlan for internet and direct access

Mon Jun 04, 2018 10:24 am

From a terminal, run

Code: Select all

route
Post the output. The lowest metric has priority. The ethernet connection normally has the lowest metric, therefore the highest priority.

You can change the metric for the interfaces in /etc/dhcpcd.conf.

Code: Select all

interface eth0
metric 500

darkencraft
Posts: 2
Joined: Mon Jun 04, 2018 7:05 am

Re: Using Wifi/USB and wlan for internet and direct access

Tue Jun 05, 2018 2:26 am

Thank you, that totally worked.

I already had metric setup as below :

Code: Select all

interface usb0
metric 200

interface wlan0
metric 201

interface eth0
metric 300
which did not work, but when I changed metric for eth0 to 500, it started working.
I thought usb0 and wlan0 still had priority over eth0 when the metric was 300, but oh well, it's working now.

Thank you again!

Return to “Networking and servers”