安装 ifupdown resolvconf,移除 netplan

apt update && apt install ifupdown resolvconf systemctl enable
networking systemctl disable systemd-networkd systemctl disable
systemd-networkd.socket apt remove netplan.io && apt autoremove

禁用 NetworkManager

systemctl stop NetworkManager
systemctl disable NetworkManager

修改网络配置:

/etc/network/interfaces

静态IP:

auto lo
iface lo inet loopback
# The primary network interface
auto eth0
         iface eth0 inet static
        address 192.168.1.2
        netmask 255.255.255.0
        gateway 192.168.1.1
        dns-nameservers 8.8.8.8 8.8.4.4

动态IP:

# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
         allow-hotplug eth0
         iface eth0 inet dhcp

设置 networking 服务开机启动和重启使设置生效:

sudo systemctl enable networking
sudo systemctl restart networking

分类: 默认分类 标签: 暂无标签

评论

-- 评论已关闭 --