|
之前刚用xubuntu18.04时想要设置静态ip,使用之前的方法一直没用,后来找了下发现是设置方法不对。今天抽了个时间整理了下ubuntu不同版本设置静态ip的方法。ubuntu和xubuntu的设置方法都是一样的。
12.x版本
$ 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版本
$ 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版本:
具体可参考我的这篇学习笔记:https://blog.csdn.net/qq_34889607/article/details/82497405
CSDN原文:https://blog.csdn.net/qq_34889607/article/details/86497767
|
|
|