How to configure IP in Linux
Network-related files:
1)/etc/sysconfig/network set the host name and whether the network can be started
2)/etc/sysconfig/network-scripts/ifcfg-eth0 set the file card parameters
3)/etc/modprobe.conf the file to load the kernel module when booting up
4)/etc/resolv.conf Set the DNS IP (resolution Server) file
5)/etc/hosts record the host name or host alias for the computer IP
6)/etc/protocols define IP packet protocol related data, including ICMP, TCP aspects of Packet protocol definition, etc.
Network-related startup commands:
1)/etc/init.d/network Restart can restart the entire network parameters
2) ifup eth0 (Ifdown eth0) to start or close a network interface, can be handled by simple script, these two script will be active to the/etc/sysconfig/network-scripts/directory
ifconfig query, set network card and IP network segment and other related parameters
Ifup/ifdown starting/Shutting down the network interface
Three ways to configure IP:
1. Use command settings:
Only temporarily modify the network interface, effective immediately, but not permanently valid
#ifconfig EthX Ip/netmask
# ifconfig eth0 192.168.100.1 set eth0 IP
# ifconfig eth0 192.168.100.1 netmask 255.255.255.0 > MTU 8000 set the network interface value while setting the value of the MTU
2. Graphical interface settings:
System-config-network-gui
System-config-network-tui
Enter the Setup command, enter the graphical interface (configure the device IP and other related property information, the service in the System-config in this panel), sometimes into the graphics set up the interface of the network interface will appear garbled, then the solution is: Exit this GUI, enter when the command "export Lang=en ", and then into the graphical interface, garbled will be improved.
Go to the graphical interface and select "Network Configuration"
After modifying the network interface, "OK", "Save", "Save&quit", "Quit" exit, the network interface modification is completed. The network interface does not take effect immediately, and once it is in effect, it is permanently valid, and the workaround for the IP to take effect is:
1. #ifdown eth1 && ifup eth1 First disable, then enable
2. #service Network Restart Web service restart
3. #/etc/init.d/network Restart can also restart the network interface
3, directly edit the configuration file:
#vim/etc/sysconfig/network-scripts/ifcfg-ethx
Modify the configuration file for the network interface, the commonly used properties in the configuration file are:
DEVICE=ETHX Device Name
bootproto= (None | static (Specify address manually) | DHCP (dynamic acquisition) | BOOTP)
Onboot={yes | no} whether the network device is activated when the system is started
Hwaddr= Physical address, can not be arbitrarily changed
Ipaddr= IP Address, you must
netmask= subnet mask, you must
Type=ethernet default, generally do not change, this item can not exist
Common properties are:
gateway= Gateway
Userctl={yes | no} allow normal users to enable and disable network devices
Peerdns={yes | no} If you use DHCP to get the address, the server assigns an IP address, whether to modify the default point of Server DNS (the default is YES)
The network interface does not take effect immediately, and once it is in effect, it will be permanent, and the workaround for IP to take effect is the same as that of the second method:
1. #ifdown eth1 && ifup eth1 First disable, then enable
2. #service Network Restart Web service restart
3. #/etc/init.d/network Restart can also restart the network interface
http://niusm.blog.51cto.com/4350081/789243
How to configure IP-related files in Linux