我有这个配置
network:
ethernets:
eno1:
dhcp4: no
addresses: [192.168.0.103/24]
gateway4: 192.168.0.1
nameservers:
addresses: [8.8.8.8,8.8.4.4]
version: 2
renderer: networkd
然后我执行:sudo netplan try
并按 ENTER 最后我sudo reboot
或shutdown
并手动启动
当机器重新启动时,IP 始终是192.168.0.102
这会是什么问题呢?
系统信息
Distributor ID: Ubuntu Server
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
- 我
systemd-networkd
正在运行:
systemd-networkd.service - Network Service
Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2021-08-09 06:29:26 UTC; 21min ago
TriggeredBy: ● systemd-networkd.socket
Docs: man:systemd-networkd.service(8)
Main PID: 1307 (systemd-network)
Status: "Processing requests..."
Tasks: 1 (limit: 38110)
Memory: 1.7M
CGroup: /system.slice/systemd-networkd.service
└─1307 /lib/systemd/systemd-networkd
答案1
我找到了解决方案。我正在使用这篇博文中的自动桥接设置:https://octetz.com/docs/2020/2020-11-13-vm-networks/
所以我的网络配置来自 networkd /etc/systemd/network/2-br0-dhcp.network:
[Match]
Name=br0
[Network]
DHCP=ipv4
因此我将其改为:
[Match]
Name=br0
[Network]
DHCP=no
Address=192.168.0.103/24
Gateway=192.168.0.1
DNS=1.1.1.1