我正在使用 Ubuntu 15.10,遇到了一些有线连接问题。使用 grub 后,使用启用了网络的 Ubuntu 恢复选项弄乱了我的有线连接设置。
使用:
ifconfig eth0 up
返回:
eth0: ERROR while getting interface flags: No such device
使用:
dmesg | grep eth
返回:
[ 2.073397] usbcore: registered new interface driver cdc_ether
[ 2.215551] r8152 2-1:1.0 eth0: v1.08.1 (2015/07/28)
[ 3.237153] r8152 2-1:1.0 enx9cebe8261253: renamed from eth0
[ 69.963790] r8152 2-1:1.0 eth0: v1.08.1 (2015/07/28)
[ 71.017553] r8152 2-1:1.0 enx9cebe8261253: renamed from eth0
[ 195.797143] r8152 2-1:1.0 eth0: v1.08.1 (2015/07/28)
[ 196.861909] r8152 2-1:1.0 enx9cebe8261253: renamed from eth0
[ 229.932958] r8152 2-1:1.0 eth0: v1.08.1 (2015/07/28)
[ 230.981139] r8152 2-1:1.0 enx9cebe8261253: renamed from eth0
无线连接仍然正常工作。我使用的是笔记本电脑(华硕 UX305FA),所以我的有线连接是通过 USB 转以太网适配器进行的。有线连接开箱即用,使用全新安装的适配器即可工作。如果能就如何解决此问题提供帮助,我将不胜感激。
编辑:
ip link
返回:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
link/ether 5c:e0:c5:1b:e0:bd brd ff:ff:ff:ff:ff:ff
4: enx9cebe8261253: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 9c:eb:e8:26:12:53 brd ff:ff:ff:ff:ff:ff
请注意,数字 3 丢失了,我认为数字 3 曾经是我原来的有线连接,但是当我插入以太网电缆时它不再被识别。
/etc/udev/rules.d/10-network.rules
没有这个文件,我是否要创建一个包含行的新文件?
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="10:c3:7b:4e:1d:6a″,KERNEL=="enp3s0″, NAME="eth0″
编辑2:
ifconfig enx9cebe8261253
返回:
enx9cebe8261253 Link encap:Ethernet HWaddr 9c:eb:e8:26:12:53
inet addr:10.250.29.214 Bcast:10.250.29.255 Mask:255.255.255.0
inet6 addr: fe80::9eeb:e8ff:fe26:1253/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:52 errors:0 dropped:0 overruns:0 frame:0
TX packets:183 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3866 (3.8 KB) TX bytes:18573 (18.5 KB)
和无线网络
ifconfig wlp2s0
返回:
wlp2s0 Link encap:Ethernet HWaddr 5c:e0:c5:1b:e0:bd
inet addr:192.168.43.247 Bcast:192.168.43.255 Mask:255.255.255.0
inet6 addr: fe80::5ee0:c5ff:fe1b:e0bd/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:306366 errors:0 dropped:0 overruns:0 frame:0
TX packets:80425 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:427480060 (427.4 MB) TX bytes:10062427 (10.0 MB)
看起来几乎一模一样,但无线可用,有线不可用
答案1
尝试:
ip link
我的输出:
alex@IT-CROWD:/etc/udev/rules.d$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 10:c3:7b:4e:1d:6a brd ff:ff:ff:ff:ff:ff
3: vmnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 1000
link/ether 00:50:56:c0:00:01 brd ff:ff:ff:ff:ff:ff
4: vmnet8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 1000
link/ether 00:50:56:c0:00:08 brd ff:ff:ff:ff:ff:ff
并且您可以通过使用 udev 规则手动定义名称来更改设备名称(如果文件不存在则创建):
/etc/udev/rules.d/10-network.rules
添加以下行,并且不要忘记将 MAC 和 KERNEL 更改为您的 MAC 和 KERNEL:
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="10:c3:7b:4e:1d:6a″,KERNEL=="enp3s0″, NAME="eth0″
这些规则将在启动时自动应用。