Setiap kali saya menambahkan modem 4G saya ke raspberry saya, ia mendapat di atas rute default ou ip route list
, namun saya ingin semuanya melalui wlan, dan hanya menggunakan modem 4G untuk menerima koneksi SSH.
Saya menemukan jawaban ini tentang cara menonaktifkan rute default.
namun, setelah reboot, modem 4G kembali ke atas.
Bagaimana cara saya membuat wlan0
selalu menjadi aturan pertama pada default?
MEMPERBARUI:
Inilah output dmesg ketika saya menghubungkan dongle USB:
[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
Ini dia 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
PEMBARUAN 2
Saya memasangnya beberapa kali lagi sampai menunjukkan eth1
rute:
[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
Ini dia 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
Lihat yang saya lakukan ifmetric wlan0
agar dapat menggunakan wlan0
ke ssh
dalam raspberry saya
PEMBARUAN 09/10:
allow-hotplug wlan0
iface wlan0 inet dhcp
up ifmetric wlan0 0
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
Ini tidak akan membuat wlan0
metrik saya 0. Apa yang saya lakukan salah?
dmesg
dan syslog (gunakan journalctl
jika Anda memiliki systemd) setelah Anda mencolokkan dongle USB (indent 4 spasi untuk pemformatan yang tepat pada stackoverflow).
dhclient
, atau, jika modem menggunakan protokol point-to-point, dari protokol ini. Semua itu harus ditampilkan di suatu tempat di log, itulah sebabnya saya meminta log. Jika Anda tidak memiliki akses fisik ke RaspPi (Anda tidak menyebutkan ini), ip link
atau ip addr
juga harus menunjukkan apakah itu protokol point-to-point atau tidak (mungkin Anda memerlukan mode verbose).