Content
Introductory
During a big storm last Saturday night, my Digi net took off - which only finally recovered on Sunday morning. I had no choice but to share my mobilnet on my desktop computer so I could do my most important tasks. I thought, if such an inconvenience had already slipped in, let’s take advantage of it, so I made this short guide.
In this description, we will learn about tethering, so let's see how we can share our mobile internet with a USB cable on our desktop computer, for example, if you lose your wired internet connection and have no WLAN connection.
Mobile phone set
Me one Huawei P20 Pro i have a handset so i will show you how to set up your mobile phone in a few steps. Other device types may have different menu item names, etc.
Connect your phone to the computer with the USB cable. Then go to the settings menu:
Here, select Wireless and Other Networks (or something similar on other device types):
Select Share and portable hotspot here. Then the following screen will receive:
Turn on USB tethering here. After powering on, a small USB icon will appear at the top of the screen between the status icons to indicate that a connection has been established.
This is how we get the mobile phone part, so come the connection of the computer.
Connecting a Computer
My computer at that time runs a Debian 9 (Stretch) system, so this is how I set it up. Regardless, I think this option will work everywhere on Debian-based distributions, as we will only use two basic commands.
I now have a working Internet connection at the time of writing, so I'm unplugging the ethernet cable for the sake of the test.
Log in as root to a terminal window and run the ifconfig command first without switches:
ifconfig
The output of this is for me:
Here we see one It's called Debian 9 enp2s0 network card device (which I have fixed by default IP address is configured, just for that reason there is now an IP address.) and an internal (localhost) feedback called "lo". The physical network device name may vary by machine.
Then, if you run the ifconfig command again with the -a switch
ifconfig -a
then your USB phone will appear:
As you can see, the device exists but is not yet active: There is no "UP" flag next to its name and no IP address.
Copy the name of your newly released device and activate it first with the ifconfig command:
ifconfig enp0s29u1u5 up
After that, if we look again at the ifconfig command, the UP flag will appear next to it:
enp0s29u1u5: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether b6:36:63:4a:0b:3a txqueuelen 1000 (Ethernet)
RX packets 36 bytes 6358 (6.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 18 bytes 3421 (3.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[...]
So the device is active but still doesn't have an IP address, so we need to connect to one DHCP client, which in this case is Debian's "factory" dhclient will have the command:
dhclient enp0s29u1u5
Mobile internet is now connected to an IPv6 network at most providers. So if your home computer used an IPv4 address, such as a fixed IP address setup, etc., -4 switch:
dhclient -4 enp0s29u1u5
Then, if we look at it again with the ifconfig command, we can see that it already has an IPv4 and an IPv6 address attached to it, which our mobile phone has assigned to the machine, which also functions as a DHCP server, as in the case of a router:
And by this time, we are already accessing the Internet via our mobile phone's Internet connection:
Conclusion
Wherever you are with your laptop or when your internet connection is interrupted at home, you can quickly share your mobile phone's internet connection with this quick setup. Just keep in mind that using the internet on your computer generates a lot more data traffic, so we often check the data traffic on our mobile phone to keep it out of the box.
- To post registration and login required
- 890 views