ubuntu配置静态ip不起作用,解决

  • Post author:
  • Post category:其他


ubuntu@ubuntu:~$ cat /etc/netplan/01-netcfg.yaml

# This file describes the network interfaces available on your system

# For more information, see netplan(5).

network:

version: 2

renderer: networkd

ethernets:

enp3s0:

dhcp4: yes

dhcp6: no

ubuntu@ubuntu:~$

查看dhcp为yes,手动通过网口改ip没起作用

改为如下:

ubuntu@ubuntu:~$ cat /etc/netplan/01-netcfg.yaml

# This file describes the network interfaces available on your system

# For more information, see netplan(5).

network:

version: 2

renderer: networkd

ethernets:

enp3s0:

dhcp4: no

dhcp6: no

addresses: [172.16.4.161/24]

gateway4: 172.16.4.1

nameservers:

addresses: [114.114.114.114]

ubuntu@ubuntu:~$

然后调用

netplan apply

即可



版权声明:本文为ZSMDEV原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。