Ubuntu18.04修改IP地址
阿新 • • 發佈:2021-10-04
一、檢視並修改IP地址
Ubuntu 18.04使用netplan配置網路,其配置檔案是yaml格式的。安裝好Ubuntu 18.04之後,在/etc/netplan/目錄下預設的配置檔名是00-installer-config.yaml,我們通過VIM修改它:
# ifconfig ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.56.11 netmask 255.255.255.0 broadcast 192.168.56.255 inet6 fe80::20c:29ff:feee:97bf prefixlen64 scopeid 0x20<link> ether 00:0c:29:ee:97:bf txqueuelen 1000 (Ethernet) RX packets 5431 bytes 465128 (465.1 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 3321 bytes 411063 (411.0 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 # cat /etc/netplan/00-installer-config.yaml # This is the network config written by 'subiquity' network: ethernets: ens33: dhcp4: no addresses: [192.168.56.11/24] gateway4: 192.168.56.2 nameservers: addresses: [114.114.114.114] # dns地址 version: 2 # netplan apply # 使配置檔案生效