How to make wlan to always be the default route? (ip route list)

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
6
down vote

favorite
1












Whenever I add my 4G modem to my raspberry, it gets on top of the default routes ou ip route list, however I want everything to go through wlan, and only use the 4G modem to receive SSH connections.



I've found this answer on how to disable the default routes: https://serverfault.com/a/836708



however, after reboot, the 4G modem comes back to the top.



How do I make wlan0 to always be the first rule on default?



UPDATE:



Here's the dmesg output when I connect the USB dongle:



[426102.910168] usb 1-1.5.1: new full-speed USB device number 6 using dwc_otg
[426103.046670] usb 1-1.5.1: not running at top speed; connect to a high speed hub
[426103.056674] usb 1-1.5.1: New USB device found, idVendor=12d1, idProduct=1f01
[426103.056693] usb 1-1.5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[426103.056704] usb 1-1.5.1: Product: HUAWEI_MOBILE
[426103.056714] usb 1-1.5.1: Manufacturer: HUAWEI_MOBILE
[426103.056724] usb 1-1.5.1: SerialNumber: 0123456789ABCDEF
[426103.121355] usb-storage 1-1.5.1:1.0: USB Mass Storage device detected
[426103.122875] scsi host0: usb-storage 1-1.5.1:1.0
[426103.987177] usb 1-1.5.1: USB disconnect, device number 6
[426105.470211] usb 1-1.5.1: new full-speed USB device number 7 using dwc_otg
[426105.606666] usb 1-1.5.1: not running at top speed; connect to a high speed hub
[426105.615673] usb 1-1.5.1: New USB device found, idVendor=12d1, idProduct=14dc
[426105.615692] usb 1-1.5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[426105.615703] usb 1-1.5.1: Product: HUAWEI_MOBILE
[426105.615713] usb 1-1.5.1: Manufacturer: HUAWEI_MOBILE
[426105.766297] usb-storage 1-1.5.1:1.2: USB Mass Storage device detected
[426105.766768] scsi host0: usb-storage 1-1.5.1:1.2
[426105.855053] cdc_ether 1-1.5.1:1.0 eth1: register 'cdc_ether' at usb-3f980000.usb-1.5.1, CDC Ethernet Device, 0c:5b:8f:27:9a:64
[426105.855593] usbcore: registered new interface driver cdc_ether
[426106.785653] scsi 0:0:0:0: Direct-Access HUAWEI TF CARD Storage 2.31 PQ: 0 ANSI: 2
[426106.803758] sd 0:0:0:0: Attached scsi generic sg0 type 0
[426106.820687] sd 0:0:0:0: [sda] Attached SCSI removable disk


Here's ip addr



eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 0c:5b:8f:27:9a:64 brd ff:ff:ff:ff:ff:ff
inet6 fe80::584f:751f:bb3e:e26b/64 scope link
valid_lft forever preferred_lft forever


UPDATE 2



I attached it a few more times until it showed the eth1 route:



[10787.229141] usb 1-1.5: new full-speed USB device number 7 using dwc_otg
[10787.363515] usb 1-1.5: New USB device found, idVendor=05e3, idProduct=0606
[10787.363533] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[10787.363544] usb 1-1.5: Product: USB Hub 2.0
[10787.363555] usb 1-1.5: Manufacturer: ALCOR
[10787.365166] hub 1-1.5:1.0: USB hub found
[10787.369831] hub 1-1.5:1.0: 4 ports detected
[10797.419094] usb 1-1.5.1: new full-speed USB device number 8 using dwc_otg
[10797.555636] usb 1-1.5.1: not running at top speed; connect to a high speed hub
[10797.565759] usb 1-1.5.1: New USB device found, idVendor=12d1, idProduct=1f01
[10797.565777] usb 1-1.5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[10797.565789] usb 1-1.5.1: Product: HUAWEI_MOBILE
[10797.565799] usb 1-1.5.1: Manufacturer: HUAWEI_MOBILE
[10797.565808] usb 1-1.5.1: SerialNumber: 0123456789ABCDEF
[10797.630477] usb-storage 1-1.5.1:1.0: USB Mass Storage device detected
[10797.631101] scsi host0: usb-storage 1-1.5.1:1.0
[10798.472745] usb 1-1.5.1: USB disconnect, device number 8
[10799.469081] usb 1-1.5.1: new full-speed USB device number 9 using dwc_otg
[10799.630768] usb 1-1.5.1: not running at top speed; connect to a high speed hub
[10799.646891] usb 1-1.5.1: New USB device found, idVendor=12d1, idProduct=14dc
[10799.646909] usb 1-1.5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[10799.646920] usb 1-1.5.1: Product: HUAWEI_MOBILE
[10799.646930] usb 1-1.5.1: Manufacturer: HUAWEI_MOBILE
[10799.814489] usb-storage 1-1.5.1:1.2: USB Mass Storage device detected
[10799.815008] scsi host0: usb-storage 1-1.5.1:1.2
[10799.897788] cdc_ether 1-1.5.1:1.0 eth1: register 'cdc_ether' at usb-3f980000.usb-1.5.1, CDC Ethernet Device, 0c:5b:8f:27:9a:64
[10799.898127] usbcore: registered new interface driver cdc_ether
[10800.889652] scsi 0:0:0:0: Direct-Access HUAWEI TF CARD Storage 2.31 PQ: 0 ANSI: 2
[10800.910585] sd 0:0:0:0: Attached scsi generic sg0 type 0
[10800.923297] sd 0:0:0:0: [sda] Attached SCSI removable disk


Here's route -n



Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0
0.0.0.0 192.168.8.1 0.0.0.0 UG 207 0 0 eth1
0.0.0.0 192.168.1.1 0.0.0.0 UG 303 0 0 wlan0
169.254.0.0 0.0.0.0 255.255.0.0 U 202 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 204 0 0 docker0
169.254.0.0 0.0.0.0 255.255.0.0 U 206 0 0 veth4557ad2
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 303 0 0 wlan0
192.168.8.0 0.0.0.0 255.255.255.0 U 207 0 0 eth1


See that I did ifmetric wlan0 in order to be able to use the wlan0 to ssh into my raspberry







share|improve this question

















  • 1




    First step is to find out why the 4G modem gets a default route. Does it do DHCP? If yes, figure out what calls it (network manager? traditional ifup/ifdown?), and configure dhclient etc. in that call to not set the default route for that particular interface.
    – dirkt
    Jul 5 at 5:49










  • @dirkt it's a USB dongle, so when it is connected it gets a new interface by default. There's no rule for eth1 on /etc/network/interfaces, however this is the ethernet device assigned to it. Do you know why? I don't know if it does DHCP, the interface is pretty simple, there's no advanced things to change or look. It's a huawei modem. Could you give soe help?
    – Guerlando OCs
    Jul 5 at 13:41






  • 1




    Please edit the question with the output of dmesg and syslog (use journalctl if you have systemd) after you plug in the USB dongle (indent 4 spaces for proper formatting on stackoverflow).
    – dirkt
    Jul 5 at 14:13










  • @dirkt I'll post the dmesg soon when I get somebody to plug the 4G modem for me. In the meantime, how do I find which thing is giving an IP address for my router? I'm using raspbian which is debian based so do you have an idea?
    – Guerlando OCs
    Jul 16 at 21:45










  • In general, you'll get IP addresses via DHCP, usually by calling dhclient, or, if the modem uses a point-to-point protocol, from this protocol. All that should be shown somewhere in the logs, which is why I was asking for the logs. If you don't have physical access to the RaspPi (you didn't mention this), ip link or ip addr should also show if it's a point-to-point protocol or not (possibly you need verbose mode).
    – dirkt
    Jul 17 at 5:43














up vote
6
down vote

favorite
1












Whenever I add my 4G modem to my raspberry, it gets on top of the default routes ou ip route list, however I want everything to go through wlan, and only use the 4G modem to receive SSH connections.



I've found this answer on how to disable the default routes: https://serverfault.com/a/836708



however, after reboot, the 4G modem comes back to the top.



How do I make wlan0 to always be the first rule on default?



UPDATE:



Here's the dmesg output when I connect the USB dongle:



[426102.910168] usb 1-1.5.1: new full-speed USB device number 6 using dwc_otg
[426103.046670] usb 1-1.5.1: not running at top speed; connect to a high speed hub
[426103.056674] usb 1-1.5.1: New USB device found, idVendor=12d1, idProduct=1f01
[426103.056693] usb 1-1.5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[426103.056704] usb 1-1.5.1: Product: HUAWEI_MOBILE
[426103.056714] usb 1-1.5.1: Manufacturer: HUAWEI_MOBILE
[426103.056724] usb 1-1.5.1: SerialNumber: 0123456789ABCDEF
[426103.121355] usb-storage 1-1.5.1:1.0: USB Mass Storage device detected
[426103.122875] scsi host0: usb-storage 1-1.5.1:1.0
[426103.987177] usb 1-1.5.1: USB disconnect, device number 6
[426105.470211] usb 1-1.5.1: new full-speed USB device number 7 using dwc_otg
[426105.606666] usb 1-1.5.1: not running at top speed; connect to a high speed hub
[426105.615673] usb 1-1.5.1: New USB device found, idVendor=12d1, idProduct=14dc
[426105.615692] usb 1-1.5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[426105.615703] usb 1-1.5.1: Product: HUAWEI_MOBILE
[426105.615713] usb 1-1.5.1: Manufacturer: HUAWEI_MOBILE
[426105.766297] usb-storage 1-1.5.1:1.2: USB Mass Storage device detected
[426105.766768] scsi host0: usb-storage 1-1.5.1:1.2
[426105.855053] cdc_ether 1-1.5.1:1.0 eth1: register 'cdc_ether' at usb-3f980000.usb-1.5.1, CDC Ethernet Device, 0c:5b:8f:27:9a:64
[426105.855593] usbcore: registered new interface driver cdc_ether
[426106.785653] scsi 0:0:0:0: Direct-Access HUAWEI TF CARD Storage 2.31 PQ: 0 ANSI: 2
[426106.803758] sd 0:0:0:0: Attached scsi generic sg0 type 0
[426106.820687] sd 0:0:0:0: [sda] Attached SCSI removable disk


Here's ip addr



eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 0c:5b:8f:27:9a:64 brd ff:ff:ff:ff:ff:ff
inet6 fe80::584f:751f:bb3e:e26b/64 scope link
valid_lft forever preferred_lft forever


UPDATE 2



I attached it a few more times until it showed the eth1 route:



[10787.229141] usb 1-1.5: new full-speed USB device number 7 using dwc_otg
[10787.363515] usb 1-1.5: New USB device found, idVendor=05e3, idProduct=0606
[10787.363533] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[10787.363544] usb 1-1.5: Product: USB Hub 2.0
[10787.363555] usb 1-1.5: Manufacturer: ALCOR
[10787.365166] hub 1-1.5:1.0: USB hub found
[10787.369831] hub 1-1.5:1.0: 4 ports detected
[10797.419094] usb 1-1.5.1: new full-speed USB device number 8 using dwc_otg
[10797.555636] usb 1-1.5.1: not running at top speed; connect to a high speed hub
[10797.565759] usb 1-1.5.1: New USB device found, idVendor=12d1, idProduct=1f01
[10797.565777] usb 1-1.5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[10797.565789] usb 1-1.5.1: Product: HUAWEI_MOBILE
[10797.565799] usb 1-1.5.1: Manufacturer: HUAWEI_MOBILE
[10797.565808] usb 1-1.5.1: SerialNumber: 0123456789ABCDEF
[10797.630477] usb-storage 1-1.5.1:1.0: USB Mass Storage device detected
[10797.631101] scsi host0: usb-storage 1-1.5.1:1.0
[10798.472745] usb 1-1.5.1: USB disconnect, device number 8
[10799.469081] usb 1-1.5.1: new full-speed USB device number 9 using dwc_otg
[10799.630768] usb 1-1.5.1: not running at top speed; connect to a high speed hub
[10799.646891] usb 1-1.5.1: New USB device found, idVendor=12d1, idProduct=14dc
[10799.646909] usb 1-1.5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[10799.646920] usb 1-1.5.1: Product: HUAWEI_MOBILE
[10799.646930] usb 1-1.5.1: Manufacturer: HUAWEI_MOBILE
[10799.814489] usb-storage 1-1.5.1:1.2: USB Mass Storage device detected
[10799.815008] scsi host0: usb-storage 1-1.5.1:1.2
[10799.897788] cdc_ether 1-1.5.1:1.0 eth1: register 'cdc_ether' at usb-3f980000.usb-1.5.1, CDC Ethernet Device, 0c:5b:8f:27:9a:64
[10799.898127] usbcore: registered new interface driver cdc_ether
[10800.889652] scsi 0:0:0:0: Direct-Access HUAWEI TF CARD Storage 2.31 PQ: 0 ANSI: 2
[10800.910585] sd 0:0:0:0: Attached scsi generic sg0 type 0
[10800.923297] sd 0:0:0:0: [sda] Attached SCSI removable disk


Here's route -n



Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0
0.0.0.0 192.168.8.1 0.0.0.0 UG 207 0 0 eth1
0.0.0.0 192.168.1.1 0.0.0.0 UG 303 0 0 wlan0
169.254.0.0 0.0.0.0 255.255.0.0 U 202 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 204 0 0 docker0
169.254.0.0 0.0.0.0 255.255.0.0 U 206 0 0 veth4557ad2
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 303 0 0 wlan0
192.168.8.0 0.0.0.0 255.255.255.0 U 207 0 0 eth1


See that I did ifmetric wlan0 in order to be able to use the wlan0 to ssh into my raspberry







share|improve this question

















  • 1




    First step is to find out why the 4G modem gets a default route. Does it do DHCP? If yes, figure out what calls it (network manager? traditional ifup/ifdown?), and configure dhclient etc. in that call to not set the default route for that particular interface.
    – dirkt
    Jul 5 at 5:49










  • @dirkt it's a USB dongle, so when it is connected it gets a new interface by default. There's no rule for eth1 on /etc/network/interfaces, however this is the ethernet device assigned to it. Do you know why? I don't know if it does DHCP, the interface is pretty simple, there's no advanced things to change or look. It's a huawei modem. Could you give soe help?
    – Guerlando OCs
    Jul 5 at 13:41






  • 1




    Please edit the question with the output of dmesg and syslog (use journalctl if you have systemd) after you plug in the USB dongle (indent 4 spaces for proper formatting on stackoverflow).
    – dirkt
    Jul 5 at 14:13










  • @dirkt I'll post the dmesg soon when I get somebody to plug the 4G modem for me. In the meantime, how do I find which thing is giving an IP address for my router? I'm using raspbian which is debian based so do you have an idea?
    – Guerlando OCs
    Jul 16 at 21:45










  • In general, you'll get IP addresses via DHCP, usually by calling dhclient, or, if the modem uses a point-to-point protocol, from this protocol. All that should be shown somewhere in the logs, which is why I was asking for the logs. If you don't have physical access to the RaspPi (you didn't mention this), ip link or ip addr should also show if it's a point-to-point protocol or not (possibly you need verbose mode).
    – dirkt
    Jul 17 at 5:43












up vote
6
down vote

favorite
1









up vote
6
down vote

favorite
1






1





Whenever I add my 4G modem to my raspberry, it gets on top of the default routes ou ip route list, however I want everything to go through wlan, and only use the 4G modem to receive SSH connections.



I've found this answer on how to disable the default routes: https://serverfault.com/a/836708



however, after reboot, the 4G modem comes back to the top.



How do I make wlan0 to always be the first rule on default?



UPDATE:



Here's the dmesg output when I connect the USB dongle:



[426102.910168] usb 1-1.5.1: new full-speed USB device number 6 using dwc_otg
[426103.046670] usb 1-1.5.1: not running at top speed; connect to a high speed hub
[426103.056674] usb 1-1.5.1: New USB device found, idVendor=12d1, idProduct=1f01
[426103.056693] usb 1-1.5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[426103.056704] usb 1-1.5.1: Product: HUAWEI_MOBILE
[426103.056714] usb 1-1.5.1: Manufacturer: HUAWEI_MOBILE
[426103.056724] usb 1-1.5.1: SerialNumber: 0123456789ABCDEF
[426103.121355] usb-storage 1-1.5.1:1.0: USB Mass Storage device detected
[426103.122875] scsi host0: usb-storage 1-1.5.1:1.0
[426103.987177] usb 1-1.5.1: USB disconnect, device number 6
[426105.470211] usb 1-1.5.1: new full-speed USB device number 7 using dwc_otg
[426105.606666] usb 1-1.5.1: not running at top speed; connect to a high speed hub
[426105.615673] usb 1-1.5.1: New USB device found, idVendor=12d1, idProduct=14dc
[426105.615692] usb 1-1.5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[426105.615703] usb 1-1.5.1: Product: HUAWEI_MOBILE
[426105.615713] usb 1-1.5.1: Manufacturer: HUAWEI_MOBILE
[426105.766297] usb-storage 1-1.5.1:1.2: USB Mass Storage device detected
[426105.766768] scsi host0: usb-storage 1-1.5.1:1.2
[426105.855053] cdc_ether 1-1.5.1:1.0 eth1: register 'cdc_ether' at usb-3f980000.usb-1.5.1, CDC Ethernet Device, 0c:5b:8f:27:9a:64
[426105.855593] usbcore: registered new interface driver cdc_ether
[426106.785653] scsi 0:0:0:0: Direct-Access HUAWEI TF CARD Storage 2.31 PQ: 0 ANSI: 2
[426106.803758] sd 0:0:0:0: Attached scsi generic sg0 type 0
[426106.820687] sd 0:0:0:0: [sda] Attached SCSI removable disk


Here's ip addr



eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 0c:5b:8f:27:9a:64 brd ff:ff:ff:ff:ff:ff
inet6 fe80::584f:751f:bb3e:e26b/64 scope link
valid_lft forever preferred_lft forever


UPDATE 2



I attached it a few more times until it showed the eth1 route:



[10787.229141] usb 1-1.5: new full-speed USB device number 7 using dwc_otg
[10787.363515] usb 1-1.5: New USB device found, idVendor=05e3, idProduct=0606
[10787.363533] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[10787.363544] usb 1-1.5: Product: USB Hub 2.0
[10787.363555] usb 1-1.5: Manufacturer: ALCOR
[10787.365166] hub 1-1.5:1.0: USB hub found
[10787.369831] hub 1-1.5:1.0: 4 ports detected
[10797.419094] usb 1-1.5.1: new full-speed USB device number 8 using dwc_otg
[10797.555636] usb 1-1.5.1: not running at top speed; connect to a high speed hub
[10797.565759] usb 1-1.5.1: New USB device found, idVendor=12d1, idProduct=1f01
[10797.565777] usb 1-1.5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[10797.565789] usb 1-1.5.1: Product: HUAWEI_MOBILE
[10797.565799] usb 1-1.5.1: Manufacturer: HUAWEI_MOBILE
[10797.565808] usb 1-1.5.1: SerialNumber: 0123456789ABCDEF
[10797.630477] usb-storage 1-1.5.1:1.0: USB Mass Storage device detected
[10797.631101] scsi host0: usb-storage 1-1.5.1:1.0
[10798.472745] usb 1-1.5.1: USB disconnect, device number 8
[10799.469081] usb 1-1.5.1: new full-speed USB device number 9 using dwc_otg
[10799.630768] usb 1-1.5.1: not running at top speed; connect to a high speed hub
[10799.646891] usb 1-1.5.1: New USB device found, idVendor=12d1, idProduct=14dc
[10799.646909] usb 1-1.5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[10799.646920] usb 1-1.5.1: Product: HUAWEI_MOBILE
[10799.646930] usb 1-1.5.1: Manufacturer: HUAWEI_MOBILE
[10799.814489] usb-storage 1-1.5.1:1.2: USB Mass Storage device detected
[10799.815008] scsi host0: usb-storage 1-1.5.1:1.2
[10799.897788] cdc_ether 1-1.5.1:1.0 eth1: register 'cdc_ether' at usb-3f980000.usb-1.5.1, CDC Ethernet Device, 0c:5b:8f:27:9a:64
[10799.898127] usbcore: registered new interface driver cdc_ether
[10800.889652] scsi 0:0:0:0: Direct-Access HUAWEI TF CARD Storage 2.31 PQ: 0 ANSI: 2
[10800.910585] sd 0:0:0:0: Attached scsi generic sg0 type 0
[10800.923297] sd 0:0:0:0: [sda] Attached SCSI removable disk


Here's route -n



Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0
0.0.0.0 192.168.8.1 0.0.0.0 UG 207 0 0 eth1
0.0.0.0 192.168.1.1 0.0.0.0 UG 303 0 0 wlan0
169.254.0.0 0.0.0.0 255.255.0.0 U 202 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 204 0 0 docker0
169.254.0.0 0.0.0.0 255.255.0.0 U 206 0 0 veth4557ad2
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 303 0 0 wlan0
192.168.8.0 0.0.0.0 255.255.255.0 U 207 0 0 eth1


See that I did ifmetric wlan0 in order to be able to use the wlan0 to ssh into my raspberry







share|improve this question













Whenever I add my 4G modem to my raspberry, it gets on top of the default routes ou ip route list, however I want everything to go through wlan, and only use the 4G modem to receive SSH connections.



I've found this answer on how to disable the default routes: https://serverfault.com/a/836708



however, after reboot, the 4G modem comes back to the top.



How do I make wlan0 to always be the first rule on default?



UPDATE:



Here's the dmesg output when I connect the USB dongle:



[426102.910168] usb 1-1.5.1: new full-speed USB device number 6 using dwc_otg
[426103.046670] usb 1-1.5.1: not running at top speed; connect to a high speed hub
[426103.056674] usb 1-1.5.1: New USB device found, idVendor=12d1, idProduct=1f01
[426103.056693] usb 1-1.5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[426103.056704] usb 1-1.5.1: Product: HUAWEI_MOBILE
[426103.056714] usb 1-1.5.1: Manufacturer: HUAWEI_MOBILE
[426103.056724] usb 1-1.5.1: SerialNumber: 0123456789ABCDEF
[426103.121355] usb-storage 1-1.5.1:1.0: USB Mass Storage device detected
[426103.122875] scsi host0: usb-storage 1-1.5.1:1.0
[426103.987177] usb 1-1.5.1: USB disconnect, device number 6
[426105.470211] usb 1-1.5.1: new full-speed USB device number 7 using dwc_otg
[426105.606666] usb 1-1.5.1: not running at top speed; connect to a high speed hub
[426105.615673] usb 1-1.5.1: New USB device found, idVendor=12d1, idProduct=14dc
[426105.615692] usb 1-1.5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[426105.615703] usb 1-1.5.1: Product: HUAWEI_MOBILE
[426105.615713] usb 1-1.5.1: Manufacturer: HUAWEI_MOBILE
[426105.766297] usb-storage 1-1.5.1:1.2: USB Mass Storage device detected
[426105.766768] scsi host0: usb-storage 1-1.5.1:1.2
[426105.855053] cdc_ether 1-1.5.1:1.0 eth1: register 'cdc_ether' at usb-3f980000.usb-1.5.1, CDC Ethernet Device, 0c:5b:8f:27:9a:64
[426105.855593] usbcore: registered new interface driver cdc_ether
[426106.785653] scsi 0:0:0:0: Direct-Access HUAWEI TF CARD Storage 2.31 PQ: 0 ANSI: 2
[426106.803758] sd 0:0:0:0: Attached scsi generic sg0 type 0
[426106.820687] sd 0:0:0:0: [sda] Attached SCSI removable disk


Here's ip addr



eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 0c:5b:8f:27:9a:64 brd ff:ff:ff:ff:ff:ff
inet6 fe80::584f:751f:bb3e:e26b/64 scope link
valid_lft forever preferred_lft forever


UPDATE 2



I attached it a few more times until it showed the eth1 route:



[10787.229141] usb 1-1.5: new full-speed USB device number 7 using dwc_otg
[10787.363515] usb 1-1.5: New USB device found, idVendor=05e3, idProduct=0606
[10787.363533] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[10787.363544] usb 1-1.5: Product: USB Hub 2.0
[10787.363555] usb 1-1.5: Manufacturer: ALCOR
[10787.365166] hub 1-1.5:1.0: USB hub found
[10787.369831] hub 1-1.5:1.0: 4 ports detected
[10797.419094] usb 1-1.5.1: new full-speed USB device number 8 using dwc_otg
[10797.555636] usb 1-1.5.1: not running at top speed; connect to a high speed hub
[10797.565759] usb 1-1.5.1: New USB device found, idVendor=12d1, idProduct=1f01
[10797.565777] usb 1-1.5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[10797.565789] usb 1-1.5.1: Product: HUAWEI_MOBILE
[10797.565799] usb 1-1.5.1: Manufacturer: HUAWEI_MOBILE
[10797.565808] usb 1-1.5.1: SerialNumber: 0123456789ABCDEF
[10797.630477] usb-storage 1-1.5.1:1.0: USB Mass Storage device detected
[10797.631101] scsi host0: usb-storage 1-1.5.1:1.0
[10798.472745] usb 1-1.5.1: USB disconnect, device number 8
[10799.469081] usb 1-1.5.1: new full-speed USB device number 9 using dwc_otg
[10799.630768] usb 1-1.5.1: not running at top speed; connect to a high speed hub
[10799.646891] usb 1-1.5.1: New USB device found, idVendor=12d1, idProduct=14dc
[10799.646909] usb 1-1.5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[10799.646920] usb 1-1.5.1: Product: HUAWEI_MOBILE
[10799.646930] usb 1-1.5.1: Manufacturer: HUAWEI_MOBILE
[10799.814489] usb-storage 1-1.5.1:1.2: USB Mass Storage device detected
[10799.815008] scsi host0: usb-storage 1-1.5.1:1.2
[10799.897788] cdc_ether 1-1.5.1:1.0 eth1: register 'cdc_ether' at usb-3f980000.usb-1.5.1, CDC Ethernet Device, 0c:5b:8f:27:9a:64
[10799.898127] usbcore: registered new interface driver cdc_ether
[10800.889652] scsi 0:0:0:0: Direct-Access HUAWEI TF CARD Storage 2.31 PQ: 0 ANSI: 2
[10800.910585] sd 0:0:0:0: Attached scsi generic sg0 type 0
[10800.923297] sd 0:0:0:0: [sda] Attached SCSI removable disk


Here's route -n



Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0
0.0.0.0 192.168.8.1 0.0.0.0 UG 207 0 0 eth1
0.0.0.0 192.168.1.1 0.0.0.0 UG 303 0 0 wlan0
169.254.0.0 0.0.0.0 255.255.0.0 U 202 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 204 0 0 docker0
169.254.0.0 0.0.0.0 255.255.0.0 U 206 0 0 veth4557ad2
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 303 0 0 wlan0
192.168.8.0 0.0.0.0 255.255.255.0 U 207 0 0 eth1


See that I did ifmetric wlan0 in order to be able to use the wlan0 to ssh into my raspberry









share|improve this question












share|improve this question




share|improve this question








edited Jul 17 at 17:52
























asked Jul 4 at 12:09









Guerlando OCs

1067




1067







  • 1




    First step is to find out why the 4G modem gets a default route. Does it do DHCP? If yes, figure out what calls it (network manager? traditional ifup/ifdown?), and configure dhclient etc. in that call to not set the default route for that particular interface.
    – dirkt
    Jul 5 at 5:49










  • @dirkt it's a USB dongle, so when it is connected it gets a new interface by default. There's no rule for eth1 on /etc/network/interfaces, however this is the ethernet device assigned to it. Do you know why? I don't know if it does DHCP, the interface is pretty simple, there's no advanced things to change or look. It's a huawei modem. Could you give soe help?
    – Guerlando OCs
    Jul 5 at 13:41






  • 1




    Please edit the question with the output of dmesg and syslog (use journalctl if you have systemd) after you plug in the USB dongle (indent 4 spaces for proper formatting on stackoverflow).
    – dirkt
    Jul 5 at 14:13










  • @dirkt I'll post the dmesg soon when I get somebody to plug the 4G modem for me. In the meantime, how do I find which thing is giving an IP address for my router? I'm using raspbian which is debian based so do you have an idea?
    – Guerlando OCs
    Jul 16 at 21:45










  • In general, you'll get IP addresses via DHCP, usually by calling dhclient, or, if the modem uses a point-to-point protocol, from this protocol. All that should be shown somewhere in the logs, which is why I was asking for the logs. If you don't have physical access to the RaspPi (you didn't mention this), ip link or ip addr should also show if it's a point-to-point protocol or not (possibly you need verbose mode).
    – dirkt
    Jul 17 at 5:43












  • 1




    First step is to find out why the 4G modem gets a default route. Does it do DHCP? If yes, figure out what calls it (network manager? traditional ifup/ifdown?), and configure dhclient etc. in that call to not set the default route for that particular interface.
    – dirkt
    Jul 5 at 5:49










  • @dirkt it's a USB dongle, so when it is connected it gets a new interface by default. There's no rule for eth1 on /etc/network/interfaces, however this is the ethernet device assigned to it. Do you know why? I don't know if it does DHCP, the interface is pretty simple, there's no advanced things to change or look. It's a huawei modem. Could you give soe help?
    – Guerlando OCs
    Jul 5 at 13:41






  • 1




    Please edit the question with the output of dmesg and syslog (use journalctl if you have systemd) after you plug in the USB dongle (indent 4 spaces for proper formatting on stackoverflow).
    – dirkt
    Jul 5 at 14:13










  • @dirkt I'll post the dmesg soon when I get somebody to plug the 4G modem for me. In the meantime, how do I find which thing is giving an IP address for my router? I'm using raspbian which is debian based so do you have an idea?
    – Guerlando OCs
    Jul 16 at 21:45










  • In general, you'll get IP addresses via DHCP, usually by calling dhclient, or, if the modem uses a point-to-point protocol, from this protocol. All that should be shown somewhere in the logs, which is why I was asking for the logs. If you don't have physical access to the RaspPi (you didn't mention this), ip link or ip addr should also show if it's a point-to-point protocol or not (possibly you need verbose mode).
    – dirkt
    Jul 17 at 5:43







1




1




First step is to find out why the 4G modem gets a default route. Does it do DHCP? If yes, figure out what calls it (network manager? traditional ifup/ifdown?), and configure dhclient etc. in that call to not set the default route for that particular interface.
– dirkt
Jul 5 at 5:49




First step is to find out why the 4G modem gets a default route. Does it do DHCP? If yes, figure out what calls it (network manager? traditional ifup/ifdown?), and configure dhclient etc. in that call to not set the default route for that particular interface.
– dirkt
Jul 5 at 5:49












@dirkt it's a USB dongle, so when it is connected it gets a new interface by default. There's no rule for eth1 on /etc/network/interfaces, however this is the ethernet device assigned to it. Do you know why? I don't know if it does DHCP, the interface is pretty simple, there's no advanced things to change or look. It's a huawei modem. Could you give soe help?
– Guerlando OCs
Jul 5 at 13:41




@dirkt it's a USB dongle, so when it is connected it gets a new interface by default. There's no rule for eth1 on /etc/network/interfaces, however this is the ethernet device assigned to it. Do you know why? I don't know if it does DHCP, the interface is pretty simple, there's no advanced things to change or look. It's a huawei modem. Could you give soe help?
– Guerlando OCs
Jul 5 at 13:41




1




1




Please edit the question with the output of dmesg and syslog (use journalctl if you have systemd) after you plug in the USB dongle (indent 4 spaces for proper formatting on stackoverflow).
– dirkt
Jul 5 at 14:13




Please edit the question with the output of dmesg and syslog (use journalctl if you have systemd) after you plug in the USB dongle (indent 4 spaces for proper formatting on stackoverflow).
– dirkt
Jul 5 at 14:13












@dirkt I'll post the dmesg soon when I get somebody to plug the 4G modem for me. In the meantime, how do I find which thing is giving an IP address for my router? I'm using raspbian which is debian based so do you have an idea?
– Guerlando OCs
Jul 16 at 21:45




@dirkt I'll post the dmesg soon when I get somebody to plug the 4G modem for me. In the meantime, how do I find which thing is giving an IP address for my router? I'm using raspbian which is debian based so do you have an idea?
– Guerlando OCs
Jul 16 at 21:45












In general, you'll get IP addresses via DHCP, usually by calling dhclient, or, if the modem uses a point-to-point protocol, from this protocol. All that should be shown somewhere in the logs, which is why I was asking for the logs. If you don't have physical access to the RaspPi (you didn't mention this), ip link or ip addr should also show if it's a point-to-point protocol or not (possibly you need verbose mode).
– dirkt
Jul 17 at 5:43




In general, you'll get IP addresses via DHCP, usually by calling dhclient, or, if the modem uses a point-to-point protocol, from this protocol. All that should be shown somewhere in the logs, which is why I was asking for the logs. If you don't have physical access to the RaspPi (you didn't mention this), ip link or ip addr should also show if it's a point-to-point protocol or not (possibly you need verbose mode).
– dirkt
Jul 17 at 5:43










3 Answers
3






active

oldest

votes

















up vote
3
down vote



+25










For changing the routing priority for an interface you change metrics.



By default, all are 0, which is the highest priority. So, you can do:



allow-hotplug eth1
iface eth1 inet dhcp
up ifmetric eth1 30


To use ifmetric in Debian, you have got to install it:



sudo apt-get install ifmetric



ifmetric



Set routing metrics for a network interface



ifmetric is a Linux tool for setting the metrics of all IPv4 routes
attached to a given network interface at once. This may be used to
change the priority of routing IPv4 traffic over the interface. Lower
metrics correlate with higher priorities.



The metric 0 means the highest priority route and is the default one.
The larger metric value means lower priority routes. The IP address of
the active interface with the lowest metric value becomes the
originating one. See ifmetric(8).







share|improve this answer



















  • 1




    Maybe you should also explain why this will help getting DHCP from a particular interface (instead of ignoring it) if there are other interfaces present.
    – dirkt
    Jul 20 at 6:13

















up vote
0
down vote













One way to Persist the ip route add/del in debian is to write them down into /etc/network/interfaces like below:



allow-hotplug eth1
iface eth1 inet dhcp
post-up ip route del default
post-up ip route add default via <gateway IP> dev wlan0





share|improve this answer




























    up vote
    0
    down vote













    I think the matter on default gateway. Here is the tutorial.



    I briefly explain the steps. First, you need to delete the default gateway and add the one you want to add. Then, you edit "/etc/network/interfaces" for permanent change. Finally, you restart the service.



    https://www.wikihow.com/Add-or-Change-the-Default-Gateway-in-Linux






    share|improve this answer





















      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );








       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f453414%2fhow-to-make-wlan-to-always-be-the-default-route-ip-route-list%23new-answer', 'question_page');

      );

      Post as a guest






























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      3
      down vote



      +25










      For changing the routing priority for an interface you change metrics.



      By default, all are 0, which is the highest priority. So, you can do:



      allow-hotplug eth1
      iface eth1 inet dhcp
      up ifmetric eth1 30


      To use ifmetric in Debian, you have got to install it:



      sudo apt-get install ifmetric



      ifmetric



      Set routing metrics for a network interface



      ifmetric is a Linux tool for setting the metrics of all IPv4 routes
      attached to a given network interface at once. This may be used to
      change the priority of routing IPv4 traffic over the interface. Lower
      metrics correlate with higher priorities.



      The metric 0 means the highest priority route and is the default one.
      The larger metric value means lower priority routes. The IP address of
      the active interface with the lowest metric value becomes the
      originating one. See ifmetric(8).







      share|improve this answer



















      • 1




        Maybe you should also explain why this will help getting DHCP from a particular interface (instead of ignoring it) if there are other interfaces present.
        – dirkt
        Jul 20 at 6:13














      up vote
      3
      down vote



      +25










      For changing the routing priority for an interface you change metrics.



      By default, all are 0, which is the highest priority. So, you can do:



      allow-hotplug eth1
      iface eth1 inet dhcp
      up ifmetric eth1 30


      To use ifmetric in Debian, you have got to install it:



      sudo apt-get install ifmetric



      ifmetric



      Set routing metrics for a network interface



      ifmetric is a Linux tool for setting the metrics of all IPv4 routes
      attached to a given network interface at once. This may be used to
      change the priority of routing IPv4 traffic over the interface. Lower
      metrics correlate with higher priorities.



      The metric 0 means the highest priority route and is the default one.
      The larger metric value means lower priority routes. The IP address of
      the active interface with the lowest metric value becomes the
      originating one. See ifmetric(8).







      share|improve this answer



















      • 1




        Maybe you should also explain why this will help getting DHCP from a particular interface (instead of ignoring it) if there are other interfaces present.
        – dirkt
        Jul 20 at 6:13












      up vote
      3
      down vote



      +25







      up vote
      3
      down vote



      +25




      +25




      For changing the routing priority for an interface you change metrics.



      By default, all are 0, which is the highest priority. So, you can do:



      allow-hotplug eth1
      iface eth1 inet dhcp
      up ifmetric eth1 30


      To use ifmetric in Debian, you have got to install it:



      sudo apt-get install ifmetric



      ifmetric



      Set routing metrics for a network interface



      ifmetric is a Linux tool for setting the metrics of all IPv4 routes
      attached to a given network interface at once. This may be used to
      change the priority of routing IPv4 traffic over the interface. Lower
      metrics correlate with higher priorities.



      The metric 0 means the highest priority route and is the default one.
      The larger metric value means lower priority routes. The IP address of
      the active interface with the lowest metric value becomes the
      originating one. See ifmetric(8).







      share|improve this answer















      For changing the routing priority for an interface you change metrics.



      By default, all are 0, which is the highest priority. So, you can do:



      allow-hotplug eth1
      iface eth1 inet dhcp
      up ifmetric eth1 30


      To use ifmetric in Debian, you have got to install it:



      sudo apt-get install ifmetric



      ifmetric



      Set routing metrics for a network interface



      ifmetric is a Linux tool for setting the metrics of all IPv4 routes
      attached to a given network interface at once. This may be used to
      change the priority of routing IPv4 traffic over the interface. Lower
      metrics correlate with higher priorities.



      The metric 0 means the highest priority route and is the default one.
      The larger metric value means lower priority routes. The IP address of
      the active interface with the lowest metric value becomes the
      originating one. See ifmetric(8).








      share|improve this answer















      share|improve this answer



      share|improve this answer








      edited Jul 20 at 7:45


























      answered Jul 19 at 23:20









      Rui F Ribeiro

      34.1k1268113




      34.1k1268113







      • 1




        Maybe you should also explain why this will help getting DHCP from a particular interface (instead of ignoring it) if there are other interfaces present.
        – dirkt
        Jul 20 at 6:13












      • 1




        Maybe you should also explain why this will help getting DHCP from a particular interface (instead of ignoring it) if there are other interfaces present.
        – dirkt
        Jul 20 at 6:13







      1




      1




      Maybe you should also explain why this will help getting DHCP from a particular interface (instead of ignoring it) if there are other interfaces present.
      – dirkt
      Jul 20 at 6:13




      Maybe you should also explain why this will help getting DHCP from a particular interface (instead of ignoring it) if there are other interfaces present.
      – dirkt
      Jul 20 at 6:13












      up vote
      0
      down vote













      One way to Persist the ip route add/del in debian is to write them down into /etc/network/interfaces like below:



      allow-hotplug eth1
      iface eth1 inet dhcp
      post-up ip route del default
      post-up ip route add default via <gateway IP> dev wlan0





      share|improve this answer

























        up vote
        0
        down vote













        One way to Persist the ip route add/del in debian is to write them down into /etc/network/interfaces like below:



        allow-hotplug eth1
        iface eth1 inet dhcp
        post-up ip route del default
        post-up ip route add default via <gateway IP> dev wlan0





        share|improve this answer























          up vote
          0
          down vote










          up vote
          0
          down vote









          One way to Persist the ip route add/del in debian is to write them down into /etc/network/interfaces like below:



          allow-hotplug eth1
          iface eth1 inet dhcp
          post-up ip route del default
          post-up ip route add default via <gateway IP> dev wlan0





          share|improve this answer













          One way to Persist the ip route add/del in debian is to write them down into /etc/network/interfaces like below:



          allow-hotplug eth1
          iface eth1 inet dhcp
          post-up ip route del default
          post-up ip route add default via <gateway IP> dev wlan0






          share|improve this answer













          share|improve this answer



          share|improve this answer











          answered Jul 18 at 9:49









          Ezwig

          320212




          320212




















              up vote
              0
              down vote













              I think the matter on default gateway. Here is the tutorial.



              I briefly explain the steps. First, you need to delete the default gateway and add the one you want to add. Then, you edit "/etc/network/interfaces" for permanent change. Finally, you restart the service.



              https://www.wikihow.com/Add-or-Change-the-Default-Gateway-in-Linux






              share|improve this answer

























                up vote
                0
                down vote













                I think the matter on default gateway. Here is the tutorial.



                I briefly explain the steps. First, you need to delete the default gateway and add the one you want to add. Then, you edit "/etc/network/interfaces" for permanent change. Finally, you restart the service.



                https://www.wikihow.com/Add-or-Change-the-Default-Gateway-in-Linux






                share|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  I think the matter on default gateway. Here is the tutorial.



                  I briefly explain the steps. First, you need to delete the default gateway and add the one you want to add. Then, you edit "/etc/network/interfaces" for permanent change. Finally, you restart the service.



                  https://www.wikihow.com/Add-or-Change-the-Default-Gateway-in-Linux






                  share|improve this answer













                  I think the matter on default gateway. Here is the tutorial.



                  I briefly explain the steps. First, you need to delete the default gateway and add the one you want to add. Then, you edit "/etc/network/interfaces" for permanent change. Finally, you restart the service.



                  https://www.wikihow.com/Add-or-Change-the-Default-Gateway-in-Linux







                  share|improve this answer













                  share|improve this answer



                  share|improve this answer











                  answered Jul 20 at 1:39









                  jefferyear

                  3318




                  3318






















                       

                      draft saved


                      draft discarded


























                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f453414%2fhow-to-make-wlan-to-always-be-the-default-route-ip-route-list%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Bahrain

                      Postfix configuration issue with fips on centos 7; mailgun relay