Catalog
Ubuntu18.04配置静态ip的方法

​ 与Ubuntu 16.04不同,从Ubuntu 17.10 之后,系统便不再支持使用 /etc/network/interfaces的方式来配置静态ip了,需要在 /etc/netplan/xx.yaml 文件修改如下,其中网关设置为用route -n 命令输出的网关。

# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
ethernets:
ens33:
dhcp4: no
dhcp6: no
addresses: [192.168.136.129/24]
gateway4: 192.168.136.2
nameservers:
addresses: [114.114.114.114,8.8.8.8]

设置完成后,

sudo netplan apply
Author: superzhaoyang
Link: http://yoursite.com/2020/04/28/Ubuntu18-04配置静态ip的方法/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Donate
  • 微信
  • 支付宝

Comment