Article Source Address: http://my.oschina.net/junn/blog/142983
The network parameters of Ubuntu server are saved in the file/etc/network/interfaces, and the default setting uses DHCP, as follows:
# The Primary network interface
Auto Eth0
Iface eth0 inet DHCP
Here's how to set up a static IP:
1) Edit Vi/etc/network/interfaces
1.1) block the DHCP line
# The Primary network interface
Auto Eth0
#iface eth0 inet DHCP
1.2) Add parameters related to static IP
# The Primary network interface
Iface eth0 inet Static
Address 192.168.0.10
Netmask 255.255.255.0
Gateway 192.168.0.1
2) Edit vi/etc/resolv.conf, set DNS
NameServer 202.96.134.133
NameServer 202.106.0.20
3) Execute the following two commands to enable the new settings
$sudo Ifdown eth0
$sudo ifup eth0
Restart the Network Service
sudo/etc/init.d/networking restart
Ubuntu Server Configuration network and view IP address