8
November
2024
Using a smartphone for Internet access from Linux OS
17:02

Using a smartphone for Internet access from Linux OS

8 November 2024 17:02

Any PC can be connected to the Internet via a USB cable and a smartphone.

The first case is PC without the Internet

At work, it took me in stock to remove the characteristics of several computers without OS using LSHW. In BIOS I chose loading from a USB disk and launched Antix Linux с "флешки". Мне потребовалась утилита lshw для просмотра конфигурации ПК. Для работы apt необходим доступ в Интернет (sudo apt update && sudo apt install lshw && sudo lshw). The solution is obvious - Android smartphone and the "USB modem" mode. No operating system settings are required, since the smartphone is the only network card, traffic automatically switches to a smartphone gateway and Internet access on a personal computer works.

The second case - you need another Internet provider

I decided to simulate the situation - I need to urgently go to the Internet, for example, to create an application for repairs, but the Internet is not available from the provider. Of course, you can use the Android application, but you can connect a smartphone running as a second network card. The problem is that traffic goes through the first network card in which the Internet will fail. This problem can be solved by Network Manager, the icon of which is located on the panel next to the clock.

1) connected the smartphone with a cable to the USB nest
2) turned on the "USB" modem mode in a smartphone ( Settings - network and Internet - access point and modem mode - USB modem - SOOVE).

3) In Linux in the Applet Network Manager, I disconnected the first (main) network card. Traffic will automatically switch to a smartphone - network card No. 2.

OTKL

The Internet has appeared, no action in the terminal is required.

Exp2

Checking on the Whaitsmyip website or similar showed that the IP address of a fixed Internet provider has changed to the IP address of the mobile operator :

Exp

Wi-Fi in the smartphone should be disconnected, otherwise traffic will go through the gateway according to the "old" scheme without a smartphone.

The third case - you need to change the default gateway using the terminal

ip route list

ip route | grep default

sudo ip route delete default

sudo ip route add default via 192.168.42.129 dev usb0

where 192.168.42.129 is an IP address that gives itself a smartphone in the "USB modem" mode.



Related publications