一、系统环境
root@ubuntu:/# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu @H_301_28@14.04.@H_301_28@4 LTS
Release: @H_301_28@14.04
Codename: trusty
root@ubuntu:/# uname -a
Linux ubuntu @H_301_28@4.2.@H_301_28@0-@H_301_28@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 @H_301_28@192.168.0.224 #IP地址
network @H_301_28@192.168.0.0 #网络地址
netmask @H_301_28@255.255.255.0 #子网掩码
broadcast @H_301_28@192.168.0.255 #广播地址
gateway @H_301_28@192.168.0.1 #网关
dns-nameservers @H_301_28@114.114.114.114 #DNS服务器
2.2 方法二:图形界面下直接在network-manager中配置
最终形成的文件如下
root@ubuntu:/# cat /etc/NetworkManager/system-connections/Ethernet\ connection\ @H_301_28@1
[@H_301_28@802-@H_301_28@3-ethernet]
duplex=full
mac-address=@H_301_28@00:@H_301_28@0C:@H_301_28@29:@H_301_28@41:@H_301_28@36:XX
[connection]
id=IP_48
uuid=@H_301_28@18e73f13-@H_301_28@585b-@H_301_28@433a-@H_301_28@822e-a9a14e41xxxx
type=@H_301_28@802-@H_301_28@3-ethernet
timestamp=@H_301_28@1495197724
[ipv6]
method=auto [ipv4] method=manual dns=114.114.114.114;
dns-search=@H_301_28@202.106.@H_301_28@196.115;
address1=@H_301_28@192.168.@H_301_28@0.48/@H_301_28@24,@H_301_28@192.168.@H_301_28@0.1
root@ubuntu:/#