我在 Mac Mini 上安装了 Lubuntu,并具有双启动功能。
$ uname -a
Linux platolinux 4.15.0-47-generic #50-Ubuntu SMP Wed Mar 13 10:44:52 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Wifi 可以正常连接,但以太网连接不工作
当我启动时,以太网接口似乎已关闭。当我启动计算机并使用 lshw 检查硬件时,我发现以太网接口处于已禁用状态
$ sudo lshw -c network -sanitize
[sudo] password for plato:
*-network
description: Wireless interface
product: BCM4360 802.11ac Wireless Network Adapter
vendor: Broadcom Inc. and subsidiaries
physical id: 0
bus info: pci@0000:02:00.0
logical name: wlp2s0
version: 03
serial: [REMOVED]
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=wl0 driverversion=6.30.223.271 (r587334) ip=[REMOVED] latency=0 multicast=yes wireless=IEEE 802.11
resources: irq:18 memory:a0600000-a0607fff memory:a0400000-a05fffff
*-network DISABLED
description: Ethernet interface
product: NetXtreme BCM57766 Gigabit Ethernet PCIe
vendor: Broadcom Inc. and subsidiaries
physical id: 0
bus info: pci@0000:03:00.0
logical name: enp3s0f0
version: 01
serial: [REMOVED]
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm vpd msi msix pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=tg3 driverversion=3.137 firmware=57766a-v1.15 latency=0 link=no multicast=yes port=twisted pair
resources: irq:19 memory:a0700000-a070ffff memory:a0710000-a071ffff
我提出
sudo ip link set dev enp3s0f0 up
然后我得到这个
$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp3s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 78:7b:8a:b8:c8:35 brd ff:ff:ff:ff:ff:ff
3: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DORMANT group default qlen 1000
link/ether 8c:85:90:f0:5d:fe brd ff:ff:ff:ff:ff:ff
检查网络接口时发现以太网接口 () 没有获得 ipv4
$ ifconfig
enp3s0f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::7a7b:8aff:feb8:c835 prefixlen 64 scopeid 0x20<link>
ether 78:7b:8a:b8:c8:35 txqueuelen 1000 (Ethernet)
RX packets 305 bytes 38637 (38.6 KB)
RX errors 0 dropped 2 overruns 0 frame 0
TX packets 27 bytes 4160 (4.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 19
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 1920 bytes 195426 (195.4 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1920 bytes 195426 (195.4 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.44 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::1567:dcbd:6c9a:ea0c prefixlen 64 scopeid 0x20<link>
ether 8c:85:90:f0:5d:fe txqueuelen 1000 (Ethernet)
RX packets 13406 bytes 8630835 (8.6 MB)
RX errors 0 dropped 0 overruns 0 frame 3603
TX packets 13526 bytes 2034742 (2.0 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 18
任何帮助都将不胜感激,我已经阅读和搜索了三天,但没有成功
答案1
我猜如果你重新启动 NIC 并关闭 IPv6,你就可以获得 IPv4。
sudo ifdown [interface name] && sudo ifup [interface neme]
对于你的情况,interface neme
是enp3s0f0
。
请加
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
到
/etc/sysctl.conf
然后在命令行上输入以下命令并按 Enter
sudo sysctl -p
接下来请创建一个新文件/etc/rc.local
并添加这些内容
#!/bin/bash
# /etc/rc.local
# Load kernel variables from /etc/sysctl.d
/etc/init.d/procps restart
exit 0
并赋予文件执行权限
chmod 755 /etc/rc.local