我尝试在Ubuntu 18.04上连接USB Huawei E8372调制解调器。 dmesg 命令提供了以下信息:
[ 371.616615] cdc_ether 1-6:1.0 eth0: register 'cdc_ether' at usb-0000:00:14.0-6, CDC Ethernet Device, 0c:5b:8f:27:9a:64
[ 371.616948] usb-storage 1-6:1.2: USB Mass Storage device detected
[ 371.617603] scsi host4: usb-storage 1-6:1.2
[ 371.625478] cdc_ether 1-6:1.0 enx0c5b8f279a64: renamed from eth0
[ 372.636698] scsi 4:0:0:0: Direct-Access HUAWEI TF CARD Storage 2.31 PQ: 0 ANSI: 2
[ 372.637021] sd 4:0:0:0: Attached scsi generic sg2 type 0
[ 372.637270] sd 4:0:0:0: Power-on or device reset occurred
[ 372.637965] sd 4:0:0:0: [sdc] Attached SCSI removable disk
[ 372.856712] usbcore: registered new interface driver usbserial_generic
[ 372.856727] usbserial: USB Serial support registered for generic
[ 372.860310] usbcore: registered new interface driver option
[ 372.860325] usbserial: USB Serial support registered for GSM modem (1-port)
所以我有 enx0c5b8f279a64 界面。网络管理器服务添加了该设备(来自service network-manager status
的日志):
[1561201979.1919] devices added (path: /sys/devices/pci0000:00/0000:00:14.0/usb1/1-6/1-6:1.0/net/enx0c5b8f279a64, iface: enx0c5b8f279a64)
[1561201979.1919] device added (path: /sys/devices/pci0000:00/0000:00:14.0/usb1/1-6/1-6:1.0/net/enx0c5b8f279a64, iface: enx0c5b8f279a64)
但是我无法访问Internet。此外, ifconfig 不显示此界面。
我可以使用 dhclient :
dhclient -v enx0c5b8f279a64
:
Listening on LPF/enx0c5b8f279a64/0c:5b:8f:27:9a:64
Sending on LPF/enx0c5b8f279a64/0c:5b:8f:27:9a:64
Sending on Socket/fallback
DHCPREQUEST of 192.168.8.100 on enx0c5b8f279a64 to 255.255.255.255 port 67 (xid=0x36f4d377)
DHCPNAK from 192.168.8.1 (xid=0x77d3f436)
DHCPDISCOVER on enx0c5b8f279a64 to 255.255.255.255 port 67 interval 3 (xid=0x5ad85374)
DHCPDISCOVER on enx0c5b8f279a64 to 255.255.255.255 port 67 interval 7 (xid=0x5ad85374)
DHCPREQUEST of 192.168.8.100 on enx0c5b8f279a64 to 255.255.255.255 port 67 (xid=0x7453d85a)
DHCPOFFER of 192.168.8.100 from 192.168.8.1
DHCPACK of 192.168.8.100 from 192.168.8.1
bound to 192.168.8.100 -- renewal in 41121 seconds.
然后,我将访问Internet和网络管理器日志:
[1561202049.0339] device (enx0c5b8f279a64): carrier: link connected
[1561202049.0415] device (enx0c5b8f279a64): carrier: link connected
我希望网络管理器服务自动设置调制解调器的接口,而无需运行 dhclient 之类的任何手动步骤。怎么做?
谢谢。
答案 0 :(得分:1)
在使用ubuntu 18.04 netplan的情况下,只需为您的接口enx0c5b8f279a64编写:“ dhcp:true””(请参见此处的示例:https://netplan.io/examples)