📜 ⬆️ ⬇️

Cubietruck. Road mini server. Part 3

Configuring the HUAWEI E3372 modem


Install the usb-switchmodem package
sudo apt-get install usb-modeswitch 

We connect the modem and look with the help of the command, which network card will appear after the connection:
 ifconfig -a 


Interface eth1 has appeared
 eth1 Link encap:Ethernet HWaddr 0c:5b:8f:27:9a:64 BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) 

Or you can see the same thing in the dmesg message log:
 dmesg 

A view should appear.
 cdc_ether 3-1:1.0: eth1: register 'cdc_ether' at usb-sw-ehci-1, CDC Ethernet Device, 0c:5b:8f:27:9a:64 

Configuring the eth1 interface in the / etc / network / interfaces file
 sudo nano /etc/network/interfaces 

Add strings
 # allow-hotplug eth1 iface eth1 inet dhcp 

Now we take out the modem and after 5 seconds we put in place. Check whether the interface received eth1 address from the modem
 eth1 Link encap:Ethernet HWaddr 0c:5b:8f:27:9a:64 inet addr:192.168.8.100 Bcast:192.168.8.255 Mask:255.255.255.0 inet6 addr: fe80::e5b:8fff:fe27:9a64/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:17 errors:0 dropped:0 overruns:0 frame:0 TX packets:12 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:4366 (4.2 KiB) TX bytes:1364 (1.3 KiB) 

Make sure that interface eth1 received the address 192.168.8.100
Check which gateway is installed by default.
 ip route 

 default via 192.168.1.10 dev eth0 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.247 192.168.8.0/24 dev eth1 proto kernel scope link src 192.168.8.100 

As the gateway, we can see the interface eth0 192.168.1.10. This means that we will go to the Internet through the eth0 network, and we need to go through the eth1 modem. To do this, remove the default gateway
 sudo route del default 

And add modem 192.168.8.1 as a gateway.
 sudo route add default gw 192.168.8.1 

Check
 default via 192.168.8.1 dev eth1 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.247 192.168.8.0/24 dev eth1 proto kernel scope link src 192.168.8.100 

Now we go online via modem HUAWEI E3372

So far, only this method is used.
Now I understand how to do that:
1. With simultaneous connections to both the network and the modem, the gateway would be eth0
2. If the connection is lost or there is no connection on the eth0 interface upon power up, the gateway would automatically switch to eth1

If anyone has experience in this matter, please help.
')
Cubietruck. Road mini server. Part 1
Cubietruck. Road mini server. Part 2

Source: https://habr.com/ru/post/235361/


All Articles