Cubietruck. Travel 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 command which network card will appear after the connection:
    ifconfig -a
    


    Appeared interface eth1
    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 in the dmesg message log:
    dmesg
    

    A view entry 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
    

    Configure eth1 interface in / etc / network / interfaces
    sudo nano /etc/network/interfaces
    

    Add lines
    #
    allow-hotplug eth1
    iface eth1 inet dhcp
    

    Now we take out the modem and after 5 seconds we put into place. Check if the eth1 interface received an 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)
    

    We made sure that the eth1 interface received the address 192.168.8.100. We
    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 a gateway, we see the 192.168.1.10 eth0 interface. This means that we will go online through the eth0 network, and we need through the eth1 modem. To do this, delete the default gateway
    sudo route del default
    

    And add the 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 the HUAWEI E3372 modem.

    So far, only such a method has been used.
    Now I’m figuring out how to do it:
    1. If both the network and the modem are connected at the same time, the gateway would be eth0
    2. If the connection was disconnected or there was no connection on the eth0 interface when it was turned on, the gateway would automatically switch to eth1

    If anyone has experience in this matter, I ask to help.

    Cubietruck. Travel mini server. Part 1
    Cubietruck. Travel mini server. Part 2

    Also popular now: