以前剛用xubuntu18.04時想要設置靜態ip,使用以前的方法一直沒用,後來找了下發現是設置方法不對。今天抽了個時間整理了下ubuntu不一樣版本設置靜態ip的方法。ubuntu和xubuntu的設置方法都是同樣的。ubuntu
12.x版本ide
$ cat /etc/network/interfaces auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 20.20.20.102 netmask 255.255.255.0 gateway 20.20.20.102 dns-nameservers 20.20.20.2
14.x版本oop
$ cat /etc/network/interfaces auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 20.20.20.102 netmask 255.255.255.0 gateway 20.20.20.102 dns-nameservers 20.20.20.2 $ cat /etc/NetworkManager/NetworkManager.conf [main] plugins=ifupdown,keyfile,ofono dns=dnsmasq no-auto-default=00:0C:29:D7:43:29, [ifupdown] managed=true
16.x版本學習
$ cat /etc/network/interfaces auto lo iface lo inet loopback auto ens32 iface ens32 inet static address 20.20.20.102 netmask 255.255.255.0 gateway 20.20.20.102 $ cat /etc/NetworkManager/NetworkManager.conf [main] plugins=ifupdown,keyfile,ofono dns=dnsmasq no-auto-default=00:0C:29:D7:43:29, [ifupdown] managed=true $ cat /etc/resolv.conf nameserver 127.0.1.1 nameserver 20.20.20.2
18.x版本:.net
具體可參考個人這篇學習筆記:https://blog.csdn.net/qq_34889607/article/details/82497405code
CSDN原文:https://blog.csdn.net/qq_34889607/article/details/86497767server