ubunt 18.04 之后版本配置网络 netplan
2023-02-16 17:57 方斌 阅读(67) 评论(0) 编辑 收藏 举报查询网卡名称
ip a
dhcp
# This is the network config written by 'subiquity'
network:
ethernets:
enp0s7: <-----网卡名称
dhcp4: yes <-----启用dhcp
optional: true
addresses: []
version: 2
renderer: networkd
static
# This is the network config written by 'subiquity'
network:
ethernets:
enp0s7: <-----网卡名称
dhcp4: no <---- 禁用dhcp
optional: true
addresses: [192.168.64.6/24] <-----24代表掩码
gateway4: 192.168.64.1
nameservers:
addresses: [192.168.64.1] <-----dns和网关设置一样,省配置
version: 2
renderer: networkd
生效命令
netplan apply