Setting IP addresses in Linux is simple. Generally, you can use the ip command tool or directly modify the configuration file.
This section describes how to configure a configuration file.
Redhat series (CentOS & Redhat ):
You must modify three files and then restart the network.
The first file: IP configuration file.
Path:/etc/sysconfig/network-scripts/
Usually for ifcfg-eth0. I am here for ifcfg-seth0
Configuration content:
DEVICE = seth0
BOOTPROTO = static
ONBOOT = yes
IPADDR = 10.2.0.191
NETMASK = 255.255.255.0
GATEWAY = 10.2.0.1
The second file:
DNS configuration file, DNS name server, mainly used to convert www.cnblogs.com into DNS
Configuration content:
Nameserver: 10.2.0.1
Third file:
Configure Network Management
Configuration content
GATEWAY: 10.2.0.1
Debain series (Debian & UBUNTU ):
The first file configuration file/etc/Network/interfaces.
Iface seth0 inet static
Address 10.2.0.191 netmask 255.255.255.0
Gateway 172.18.1.1
For more information, see:
Http://hi.baidu.com/5%B4%F3%B7%F2/blog/item/9cd146587eec5b2d2934f0a1.html
Http://www.iceteks.com/forums/archive/t/3298/
Http://virus.blog.51cto.com/51437/22220/