0

我尝试在我的 Ubuntu 18.04 上连接 USB 华为 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接口。network-manager 服务添加此设备(来自 的日志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)

但我无法访问互联网。而且,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,以及 network-manager 日志:

[1561202049.0339] device (enx0c5b8f279a64): carrier: link connected
[1561202049.0415] device (enx0c5b8f279a64): carrier: link connected

我希望网络管理器服务自动设置调制解调器的接口,而不需要像运行dhclient这样的任何手动步骤。怎么做?

谢谢。

4

1 回答 1

1

在 ubuntu 18.04 中使用 netplan,只需为您的接口编写 enx0c5b8f279a64: "dhcp: true"" (参见此处的示例:https ://netplan.io/examples )

于 2019-06-22T20:10:27.593 回答