The network parameters in Linux roughly include the following:
IP Address
Subnet mask
Gateway
DNS Server
Host name (default localhost)
Historically, the methods of modifying these parameters in Linux systems are: command, file two. Where the command settings can be effective immediately but will expire after a reboot, the file modification is implemented permanently, but does not take effect immediately.
First, let's look at the way the command works:
Ifconfig: View and set IP address, subnet mask
Hostname: View and set host name
Route: View and set routing information (default gateway, etc.)
To modify by file:
/etc/sysconfig/network-scripts/ifcfg-device name (typically Ifcfg-eth0) IP, default gateway, subnet mask
/etc/sysconfig/network
/etc/resolv.conf files: Setting up a DNS server
Network troubleshooting
Check that the native network protocol is correct: # ping-c 3 127.0.0.1
Check that the native NIC link is correct: # ping-c 3 192.168.0.1 (native IP address)
Check that the gateway is correct: # PING-C 3 192.168.0.254 (Gateway IP address)
Check external connectivity: # PING-C 3 www.google.com.hk
Check the hardware
1. The network card can be set directly through the Ifconfig eth0 IP, but these things are temporarily operated, as long as the Networking System (NIC) restarts, and the previous settings are restored.
If you update the IP of eth0, the default netmask and default gateway, as well as the network segment, will change, so you need to redefine the appropriate configuration for the new IP.
2. You can do this by directly modifying the eth0 profile of the NIC and then restarting the Network service.
(1) in the CentOS environment,/etc/sysconfig/ifcfg-eth0, this file does not exist.
Copy the file structure to create a new file through the CP Ifcfg-lo Ifcfg-eth0.
(2) Modify the file:
If you update the specified ipaddr:192.168.134.223
Then, the corresponding subnet mask netmask:255.255.255.0
The corresponding network designator network:192.168.134.0 represents the network representation in this network segment, that is, the IP of the network segment is the first IP of 0.
Broadcast address broadcast:192.168.134.255 represents the last IP of the secondary network segment, which is the broadcast address.
Add a default gateway, otherwise you cannot surf the Internet. NAT Architecture's network is generally made up of the NAT service IP (192.168.134.2) as the default gateway.
Add a DNS server that is generally selected (192.168.134.2) as the DNS service address.
(3) Restart the network
/etc/init.d/network restart
Success.
Manual setup in the CentOS environment-network parameter configuration-network error order-