一、系统环境
root@ubuntu:/# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.4 LTS
Release: 14.04
Codename: trusty
root@ubuntu:/# uname -a
Linux ubuntu 4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
root@ubuntu:/#
二、静态IP设置
2.1 方法一: 直接编辑 /etc/network/interfaces 文件
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.224 #IP地址
network 192.168.0.0 #网络地址
netmask 255.255.255.0 #子网掩码
broadcast 192.168.0.255 #广播地址
gateway 192.168.0.1 #网关
dns-nameservers 114.114.114.114 #DNS服务器
2.2 方法二:图形界面下直接在network-manager中配置
最终形成的文件如下
root@ubuntu:/# cat /etc/NetworkManager/system-connections/Ethernet\ connection\ 1
[802-3-ethernet]
duplex=full
mac-address=00:0C:29:41:36:XX
[connection]
id=IP_48
uuid=18e73f13-585b-433a-822e-a9a14e41xxxx
type=802-3-ethernet
timestamp=1495197724
[ipv6]
method=auto [ipv4] method=manual dns=114.114.114.114;
dns-search=202.106.196.115;
address1=192.168.0.48/24,192.168.0.1
root@ubuntu:/#