Linux系统网络配置
Ubuntu
修改IP
$ sudo nano /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
ethernets:
eno1:
addresses:
- 172.16.33.1/24
gateway4: 172.16.33.254
nameservers: {}
version: 2
应用配置
$ sudo netplan apply
# 推荐使用 debug 参数
$ sudo netplan --debug apply
或者
sudo netplan generate
验证
ip a | grep eno1
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
inet 172.16.33.1/24 brd 172.16.33.255 scope global eno1
参考资料 How to setup a static IP on Ubuntu Server 18.04 How to configure Network Settings in Ubuntu 18.