当前位置: 代码迷 >> 综合 >> ubuntu 18.04下如何配置静态ip
  详细解决方案

ubuntu 18.04下如何配置静态ip

热度:14   发布时间:2023-10-18 12:10:00.0

前些天在xubuntu 18.04 desktop上设置了下静态IP,发现与centos/linux中区别极大。

1、首先查看网卡名

$ ip a / ifconfig

2、 cp一份yaml文件,改个名字

$ sudo cp /etc/netplan/*.yaml /etc/netplan/网卡名.yaml

3、修改yaml文件内容,如下:

# Let NetworkManager manage all devices on this system
network:version: 2renderer: NetworkManagerethernets:网卡名:dhcp4: noaddresses: [ip/prefix]gateway4: gatewaynameservers:addresses: [dns]

4、启动

$ sudo netplan apply

5、验证

$ ip a / ifconfig

 

  相关解决方案