目录
环境:
Ubuntu20.04hyper -v 10.0
问题描述:
Ubuntu20.04 怎么配置静态ip上网
解决方案:
Ubuntu 20.04使用netplan作为默认的网络管理器。netplan的配置文件存储在/etc/netplan目录下
1.ip a 查看网卡接口
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:0c:29:11:1c:f2 brd ff:ff:ff:ff:ff:ff inet 192.168.10.117/24 brd 192.168.10.255 scope global dynamic ens33 valid_lft 15368sec preferred_lft 15368sec2.设置静态IP地址
vim /etc/netplan/01-netcfg.yaml network: version: 2 renderer: NetworkManager ethernets: eth0: dhcp4: no addresses: [192.168.12.18/24] gateway4: 192.168.12.1 nameservers: addresses: [8.8.8.8,8.8.4.4]完成上述配置,输入指令: netplan apply