------------------
Ubuntu 14.04 x86_64
-----------------
Set static IP:
Vi/etc/network/interfaces.
And then edit
Auto Lo
Iface Lo inet Loopback
# The Primary network interface
Auto Em1 # #第一块网卡的名称, can be found by ifconfig command
Iface em1 inet Static # # is set to still IP
Address 192.xx.yy.zz #你的IP地址
netmask 255.255.255.0 # #子网掩码
Network 192.xx.yy.0 # # #
Broadcast 192.XX.YY.255 # Broadcast
Gateway 192.xx.yy.254 # # Default Gateways
# Dns-* Options is implemented by the RESOLVCONF package, if installed
Dns-nameservers 8.8.8.8 # #域名解析服务器地址
After editing in the format above, you can save the exit.
For example:
sudo/etc/init.d/networking restart
After this sentence is executed, it is best to check whether the execution succeeded: Echo $?
If the output value is not 0, the execution fails. Try using the following method:
To shut down the network:
Ifdown < nic name >
Open Network:
Ifup < nic name >
Not really. Restart the system:
sudo reboot–h now
Ubuntu Server Configuration Network