尝试使用 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 状态等之前和之后的“ip a”。谁能告诉我什么是错误?
$ 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
那么我需要一个特殊的内核吗?
现在 linux-image-5.4.0-62-generic:amd64 已经到来,一切正常。这里以前的内核有问题,我有
但只有
这不像我曾经中止更新或空间不足,我有很多。不知道。但它现在有效。