电源循环后,我无法看到具有ifconfig
以下 netplan 配置的以太网接口。 ethMine
显示在ip link show
,但未上升。
$ cat /etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
enp38s0f1:
addresses: [192.168.1.21/24]
match:
macaddress: 80:fa:5b:xx:xx:xx
set-name: ethMine
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
optional: true
vlans:
ethMine.200:
id: 200
link: ethMine
addresses: [192.168.1.121/24]
wifis:
wlx7ca7b0bbf9f1:
addresses: [10.10.10.15/24]
gateway4: 10.10.10.1
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
access-points:
"myssid":
password: "mypasswd"
- 在 Ubuntu 桌面上。
- 没有其他 netplan 配置。
/etc/network/interfaces
被注释掉了
$ dmesg | grep ethMine
[ 2.881002] r8169 0000:26:00.1 ethMine: renamed from enp38s0f1
重新启动时,我看到ethMine
了ip link show
,但它没有启动,在 中也不可见ifconfig
。 ethMine.200
不存在。
systemd 日志:
Jul 20 12:47:08 lappy systemd[1]: Starting Network Service...
Jul 20 12:47:08 lappy systemd-networkd[383]: Enumeration completed
Jul 20 12:47:08 lappy systemd[1]: Started Network Service.
Jul 20 12:47:08 lappy systemd-networkd[383]: enp38s0f1: Interface name change detected, enp38s0f1 has been renamed to ethMine.
Jul 20 12:47:08 lappy systemd-networkd[383]: wlan0: Interface name change detected, wlan0 has been renamed to wlx7ca7b0bbf9f1.
Jul 20 12:47:08 lappy systemd-networkd[383]: wlx7ca7b0bbf9f1: IPv6 successfully enabled
Jul 20 12:47:08 lappy systemd-networkd[383]: lo: Link is not managed by us
Jul 20 12:47:08 lappy systemd-networkd[383]: ethMine: Link is not managed by us
sudo systemctl restart systemd-networkd
原因ethMine
已解决,但仍然没有带有日志的 vlan:
l 20 12:52:02 lappy systemd[1]: Stopping Network Service...
Jul 20 12:52:02 lappy systemd[1]: Stopped Network Service.
Jul 20 12:52:02 lappy systemd[1]: Starting Network Service...
Jul 20 12:52:02 lappy systemd-networkd[5975]: wlx7ca7b0bbf9f1: Gained IPv6LL
Jul 20 12:52:02 lappy systemd-networkd[5975]: Enumeration completed
Jul 20 12:52:02 lappy systemd[1]: Started Network Service.
Jul 20 12:52:02 lappy systemd-networkd[5975]: wlx7ca7b0bbf9f1: IPv6 successfully enabled
Jul 20 12:52:02 lappy systemd-networkd[5975]: ethMine: Link is not managed by us
Jul 20 12:52:02 lappy systemd-networkd[5975]: lo: Link is not managed by us
Jul 20 12:52:02 lappy systemd-networkd[5975]: ethMine: IPv6 successfully enabled
Jul 20 12:52:02 lappy systemd-networkd[5975]: lo: Link is not managed by us
Jul 20 12:52:02 lappy systemd-networkd[5975]: ethMine: Link UP
Jul 20 12:52:03 lappy systemd-networkd[5975]: wlx7ca7b0bbf9f1: DHCPv4 address 10.53.189.98/24 via 10.53.189.1
Jul 20 12:52:03 lappy systemd-networkd[5975]: wlx7ca7b0bbf9f1: Configured
netplan.io
桌面版本Ubuntu 18.04.4 LTS
:
$ dpkg -s netplan.io | grep '^Version:'
Version: 0.99-0ubuntu3~18.04.3
这些手动步骤在启动后起作用:
sudo ip link set enp38s0f1 down
sudo ip link set enp38s0f1 name ethMine
sudo ip link set ethMine up
sudo ip addr add 192.168.1.21/25 dev ethMine
sudo ip link add link ethMine name ethMine.200 type vlan id 200
sudo ip addr add 192.168.1.121/26 dev ethMine.200
sudo ip link set dev ethMine.200 up
答案1
/etc/network/interfaces
应该看起来像这样...
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
/etc/netplan/01-netcfg.yaml
应该看起来像这样...
network:
version: 2
renderer: networkd
ethernets:
enp38s0f1:
addresses: [192.168.1.67/24]
gateway4: 192.168.1.1
match:
macaddress: 80:fa:5b:7d:94:8f
#set-name: ethMine
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
optional: true
vlans:
ethMine.200:
id: 200
link: enp38s0f1
addresses: [192.168.1.167/24]
wifis:
wlx7ca7b0bbf9f1:
addresses: [10.10.10.15/24]
gateway4: 10.10.10.1
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
access-points:
"myssid":
password: "mypasswd"
sudo netplan --debug generate
sudo netplan apply
reboot