我在电脑上安装了 Ubuntu(服务器),在安装过程中,我将其连接到 wifi,它运行正常。但是,我尝试将其移动到有线连接,但它似乎无法识别该连接。
sudo netplan -debug generate 没有返回任何错误。
我知道连接应该可以工作。当连接到我的笔记本电脑时,它可以工作,并且计算机背面的以太网端口上的指示灯在计算机启动时闪烁,但在启动完成后熄灭。
lshw 返回:
*-network DISABLED
description: Ethernet interface
product: 88E8056 PCI-E Gigabit Ethernet Controller
vendor: Marvell Technology Group Ltd.
physical id: 0
bus info: pci@0000:02:00.0
logical name: ens33
version: 14
serial: 00:21:97:0f:26:21
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: bus_master cap_list rom ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=sky2 driverversion=1.30 latency=0 link=no multicast=yes port=twisted pair
resources: irq:26 memory:feafc000-feafffff ioport:e800(size=256) memory:feac0000-feadffff
ifconfig 返回:
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 1716 bytes 215593 (215.5 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1716 bytes 215593 (215.5 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp3s1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.33 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::215:e9ff:fe4c:261 prefixlen 64 scopeid 0x20<link>
ether 00:15:e9:4c:02:61 txqueuelen 1000 (Ethernet)
RX packets 13520 bytes 4311598 (4.3 MB)
RX errors 0 dropped 998 overruns 0 frame 0
TX packets 8205 bytes 5869540 (5.8 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
IP路由:
default via 192.168.1.1 dev wlp3s1 proto dhcp src 192.168.1.33 metric 600
192.168.1.0/24 dev wlp3s1 proto kernel scope link src 192.168.1.33
192.168.1.1 dev wlp3s1 proto dhcp scope link src 192.168.1.33 metric 600
猫/etc/netplan/*.yaml:
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2 <--indentation in entire script is incorrect
renderer: networkd
wifis:
wlp3s1:
dhcp4: yes
access-points:
3MightyMen:
password: 3346993030
ethernets:
en33: <--wrong, should be ens33:
dhcp3: true <--wrong, should be dhcp4:
答案1
您的 /etc/neplan .yaml 文件应该看起来像这样...这将启用您的以太网设备...
network:
version: 2
renderer: networkd
wifis:
wlp3s1:
dhcp4: yes
dhcp6: no
access-points:
"3MightyMen":
password: "3346993030"
ethernets:
ens33:
dhcp4: yes
dhcp6: no
# for a fixed IP, comment out the above line, (dhcp4: true),
# and uncomment addresses: and gateway4: lines below.
# to specify DNS nameservers, uncomment last three lines.
# addresses: [192.168.1.20/24]
# gateway4: 192.168.1.1
# nameservers:
# search: [mydomain, otherdomain]
# addresses: [192.168.1.1, 1.1.1.1]
在terminal
...
sudo netplan --debug generate
# 生成配置文件
sudo netplan apply
# 应用当前配置
reboot
# 重启并确认网络正常运行
后注:参见https://netplan.io/examples更多示例