0

Presently, my fixed phone line is out of order, so I use my smartphone to keep accessing internet with my PC through a USB connection to the smartphone (my PC is fixed and has neither bluetooth nor wi-fi device).

That fixed PC works under Windows 10 and has 2 LAN cards: one goes to the internet box, and the other one to an ethernet switch to integrate the local home network. When I connect my smartphone to the PC, I can see a 3rd LAN card in the list of LAN devices.

But here is the problem: the Internet access doesn't work though the smartphone is shared, until I de-activate both my LAN cards (I'm in this case right now as I'm writing these lines).

So here's my question: How can I keep access to Internet through my smartphone without having to de-activate my LAN cards?

Thank you by advance for your help.

  • I’m voting to close this question because it is not an Elementary OS specific question. – Paul Sep 12 at 5:00
0

The best way seems to be to edit your adapters' priority.

  1. Install ifmetric:
    sudo apt-get install ifmetric

  2. Connect your USB adapter and run route -n to see the current priority (in my case: wlp7s0 - wifi, enp0s20f0u3 - usb):

     Kernel IP routing table
     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
     0.0.0.0         192.168.100.254 0.0.0.0         UG    100    0        0 wlp7s0
     0.0.0.0         192.168.42.129  0.0.0.0         UG    600    0        0 enp0s20f0u3
    
  3. Looking at the Metric values, the highest priority is now set to wlp7s0 (the lowest number is the highest priority). So in order to set for example enp0s20f0u3 as prioritary, run something like sudo ifmetric wlp7s0 100000. Running route -n again outputs:

      Kernel IP routing table
      Destination     Gateway         Genmask         Flags Metric   Ref    Use Iface
      0.0.0.0         192.168.42.129  0.0.0.0         UG    600       0        0 enp0s20f0u3
      0.0.0.0         192.168.100.254 0.0.0.0         UG    100000    0        0 wlp7s0
    

Now, the USB connection will be used, whenever it is available. The point is to set the permanent LAN connections to really big numbers, so that when you plug in the USB cable, the new adapter gets alocated a low metric. Since the USB's adapter metric is reset when you unplug it, it doesn't really make sense to set it to a low value. Succesive plugs and unplugs of the USB connection in my case resulted in its metric values shifting between 100 and 20100, but they always seem to be lower than 100000.

No reboot needed to see the changes take effect.

| improve this answer | |
  • Well, thank you for your help, but it's not quite in the target since I'm under windows 10 and not Linux. Nevertheless, I suppose I can use your ideas to find some corresponding technique under Windows, but if you know this Windows technique yourself, thanks to help me again. – BBBreiz Sep 11 at 19:08
  • Oh, my bad, I assumed you were using elementary OS, since you posted your question in the elementary OS Stack Exchange. Since elementary OS is a Linux distribution, you might have more success in posting it on some Windows dedicated forums. – Vlad Sep 11 at 22:47
  • Thank you, I'm sorry I had not realized this forum was specifically dedicated to Linux. I'm sorry, so I'll try to post my question again on the right forum. Thank you for helping though. – BBBreiz Sep 12 at 2:13

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.