尝试使用 20.04 netplan 为 libvirt 设置桥接。在尝试定义桥接之前,网络一切正常,但没有出现我的桥接定义。我遗漏了什么?
我是否需要特殊内核?请参阅我在底部提出这个问题的原因。
在尝试定义桥接之前,网络可以正常运行:
# cat /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
ethernets:
eno1:
addresses:
- 10.3.8.12/21
gateway4: 10.3.8.3
nameservers:
addresses:
- 10.3.8.3
version: 2
尝试设置桥梁我将内容更改为:
network:
ethernets:
eno1:
dhcp4: false
dhcp6: false
bridges:
br96:
interfaces: [ eno1 ]
addresses: [10.3.8.12/21]
gateway4: 10.3.8.3
nameservers:
addresses: [10.3.8.3]
version: 2
下面我展示了应用 netplan、networkctl status 等之前和之后的“ip a”。有人能告诉我 amis 是什么吗?
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 40:a8:f0:67:12:46 brd ff:ff:ff:ff:ff:ff
inet 10.3.8.12/21 brd 10.3.15.255 scope global eno1
valid_lft forever preferred_lft forever
inet6 fe80::42a8:f0ff:fe67:1246/64 scope link
valid_lft forever preferred_lft forever
# netplan --debug generate
DEBUG:command generate: running ['/lib/netplan/generate']
** (generate:1386): DEBUG: 09:50:10.524: Processing input file /etc/netplan/00-installer-config.yaml..
** (generate:1386): DEBUG: 09:50:10.524: starting new processing pass
** (generate:1386): DEBUG: 09:50:10.524: We have some netdefs, pass them through a final round of validation
** (generate:1386): DEBUG: 09:50:10.524: eno1: setting default backend to 1
** (generate:1386): DEBUG: 09:50:10.524: Configuration is valid
** (generate:1386): DEBUG: 09:50:10.524: br96: setting default backend to 1
** (generate:1386): DEBUG: 09:50:10.524: Configuration is valid
** (generate:1386): DEBUG: 09:50:10.524: Generating output files..
** (generate:1386): DEBUG: 09:50:10.524: openvswitch: definition eno1 is not for us (backend 1)
** (generate:1386): DEBUG: 09:50:10.524: NetworkManager: definition eno1 is not for us (backend 1)
** (generate:1386): DEBUG: 09:50:10.524: openvswitch: definition br96 is not for us (backend 1)
** (generate:1386): DEBUG: 09:50:10.524: NetworkManager: definition br96 is not for us (backend 1)
(generate:1386): GLib-DEBUG: 09:50:10.524: posix_spawn avoided (fd close requested)
(generate:1386): GLib-DEBUG: 09:50:10.525: posix_spawn avoided (fd close requested)
0# netplan apply
[ssh connection drops]
# reboot
[comes up with no network]
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 40:a8:f0:67:12:46 brd ff:ff:ff:ff:ff:ff
# head -99 /r*/s*/n*k/*
==> /run/systemd/network/10-netplan-br96.netdev <==
[NetDev]
Name=br96
Kind=bridge
==> /run/systemd/network/10-netplan-br96.network <==
[Match]
Name=br96
[Network]
LinkLocalAddressing=ipv6
Address=10.3.8.12/21
Gateway=10.3.8.3
DNS=10.3.8.3
ConfigureWithoutCarrier=yes
==> /run/systemd/network/10-netplan-eno1.network <==
[Match]
Name=eno1
[Network]
LinkLocalAddressing=no
Bridge=br96
# networkctl
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier unmanaged
2 eno1 ether no-carrier pending
2 links listed.
0# networkctl status -a
Failed to query link bit rates: Unit dbus-org.freedesktop.network1.service not found.
Failed to query link bit rates: Unit dbus-org.freedesktop.network1.service not found.
● 1: lo
Link File: /usr/lib/systemd/network/99-default.link
Network File: n/a
Type: loopback
State: carrier (unmanaged)
MTU: 65536
Queue Length (Tx/Rx): 1/1
Address: 127.0.0.1
::1
● 2: eno1
Link File: /usr/lib/systemd/network/99-default.link
Network File: n/a
Type: ether
State: no-carrier (pending)
Path: pci-0000:00:19.0
Driver: e1000e
Vendor: Intel Corporation
Model: Ethernet Connection I217-LM
HW Address: 40:a8:f0:67:12:46 (Hewlett Packard)
MTU: 1500 (min: 68, max: 9000)
Queue Length (Tx/Rx): 1/1
Auto negotiation: yes
Speed: 1Gbps
Duplex: full
Port: tp
Jan 15 11:07:30 filbert systemd-networkd[752]: eno1: Could not join netdev: No such device
Jan 15 11:07:30 filbert systemd-networkd[752]: eno1: Failed
Jan 15 11:07:30 filbert systemd-networkd[756]: eno1: Could not join netdev: No such device
Jan 15 11:07:30 filbert systemd-networkd[756]: eno1: Failed
Jan 15 11:07:30 filbert systemd-networkd[758]: eno1: Could not join netdev: No such device
Jan 15 11:07:30 filbert systemd-networkd[758]: eno1: Failed
Jan 15 11:07:30 filbert systemd-networkd[760]: eno1: Could not join netdev: No such device
Jan 15 11:07:30 filbert systemd-networkd[760]: eno1: Failed
Jan 15 11:07:30 filbert systemd-networkd[763]: eno1: Could not join netdev: No such device
Jan 15 11:07:30 filbert systemd-networkd[763]: eno1: Failed
0# journalctl -xe|grep networkd
[redacted, askubuntu says it "looks like spam"]
0# dpkg -l *netplan*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=================-======================-============-===========================================================
ii libnetplan0:amd64 0.100-0ubuntu4~20.04.3 amd64 YAML network configuration abstraction runtime library
un netplan <none> <none> (no description available)
ii netplan.io 0.100-0ubuntu4~20.04.3 amd64 YAML network configuration abstraction for various backends
lines 1-8/8 (END)
0# apt-get install netplan
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package netplan is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'netplan' has no installation candidate
100# cat /etc/apt/sources.list
[edited to redact "links"]
deb ... focal main restricted
deb ... focal-updates main restricted
deb ... focal universe
deb ... focal-updates universe
deb ... focal multiverse
deb ... focal-updates multiverse
deb ... focal-backports main restricted universe multiverse
deb ... focal-security main restricted
deb ... focal-security universe
deb ... focal-security multiverse
0# ls -ld /etc/apt/sources.list*/*
ls: cannot access '/etc/apt/sources.list*/*': No such file or directory
2#
因此我尝试使用“apt-get install ifupdown”并在 /etc/network/interfaces 中尝试了以下操作:
auto lo
iface lo inet loopback
auto eno1
iface eno1 inet static
address 10.3.8.12
netmask 255.255.248.0
gateway 10.3.8.3
dns-nameserver 10.3.8.3
这可行,所以接下来我尝试使用桥梁:
auto lo
iface lo inet loopback
auto br0
iface br0 inet static
bridge_ports eno1
address 10.3.8.12
netmask 255.255.248.0
gateway 10.3.8.3
但那不管用。所以我尝试了:
# ifup br0
add bridge failed: Package not installed
run-parts: /etc/network/if-pre-up.d/bridge exited with return code 1
ifup: failed to bring up br0
这意味着“您的内核不支持桥接...请将其编译进去。它应该在‘网络’→‘网络选项’中。”根据http://helpful.knobs-dials.com/index.php/Networking_notes_-_the_lower_three_levels#Add_bridge_failed:_Package_not_installed
那么我需要一个特殊的内核吗?
答案1
现在 linux-image-5.4.0-62-generic:amd64 已经发布,一切正常。之前的内核有些问题,我
/boot/vmlinuz-5.4.0-58-generic
/boot/vmlinuz-5.4.0-60-generic
/boot/vmlinuz-5.4.0-62-generic
但只有
/lib/modules/5.4.0-62-generic
我并没有放弃更新,也没有用完空间,我还有很多空间。不知道。但现在可以了。