Linux network parameter settings _ CentOS6.2 with the passage of time RedHat company launched RHEL6.2, then CentOS also followed by CentOS exited CentOS6.2. In the new system, the vendor has added a large number of virtualization and cloud computing elements and made many changes to the details. here we only set the network parameters of the new system... linux _ CentOS6.2
With the passage of time, Red Hat launched RHEL6.2, followed by CentOS and exited CentOS6.2. Vendors in the new system have added a large number of virtualization and cloud computing elements, and there have been many changes to the details. here we only provide a detailed description of the network parameters in the new system.
Network Parameters in Linux generally include the following:
IP address
Subnet mask
Gateway
DNS server
Host Name
In Linux, the methods for modifying these parameters are usually commands and files. The command setting can take effect immediately, but will expire after restart. it will take effect permanently through file modification, but will not take effect immediately.
First, let's look at the command method:
Ifconfig: View and set IP addresses and subnet masks
Hostname: View and set the host name
Route: View and set route information (default gateway, etc)
Modify by File:
/Etc/sysconfig/network-scripts/ifcfg-device name (typically ifcfg-eth0)
/Etc/sysconfig/network
/Etc/resolv. conf file: sets the DNS server
These methods can be implemented in systems 5.0 and 6.0 at the same time. However, ifconfig and route are old commands and replaced by ip commands, which are described in the official documentation after system 6.0.
The IP address command is no longer recommended on the official website. let's take a look at its usage:
Ip [option] Operation object {link | addr | route ...}
# Ip link show displays network interface information
# Enable Nic for ip link set eth0 up
# Ip link set eth0 down disable Nic
# Ip link set eth0 promisc on enable mixed Nic mode
# Ip link set eth0 promisc off disable mixed Nic mode
# Ip link set eth0 txqueuelen 1200 set the length of the NIC queue
# Ip link set eth0 mtu 1400 sets the maximum transmission unit of the NIC
# Ip addr show nic ip address information
# Ip addr add 192.168.0.1/24 dev eth0 set eth0 NIC ip address 192.168.0.1
# Ip addr del 192.168.0.1/24 dev eth0 delete eth0 NIC ip address
# View route information in ip route list
# Ip route add 192.168.4.0/24 via 192.168.0.254 dev eth0 set the gateway of the 192.168.4.0 network segment to 192.168.0.254, and the data goes through the eth0 interface
# Ip route add default via 192.168.0.254 dev eth0 set the default gateway to 192.168.0.254
# Ip route del 192.168.4.0/24 delete the gateway of the 192.168.4.0 network segment
Note: In the 5.0 era DNS server is written in the/etc/resolv. conf file, but in the 6.0 era DNS is written in the/etc/sysconfig/network-scripts/ifcfg-eth0 file.
Network Exclusion ideas:
Check the configuration file for errors (writing and syntax errors)
Check whether the local network protocol is correct: # ping-c 2 127.0.0.1
Check whether the local Nic link is correct: # ping-c 2 192.168.0.1 (local IP address)
Check whether the gateway is correct: # ping-c 2 192.168.0.254 (gateway IP address)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.