Article title: RedHatEnterpriseLinux basic network configuration. Linux is a technology channel of the IT lab in China. Including desktop applications, Linux system management, kernel research, embedded systems and open source, and other basic classification I. $/sbin/ifconfig // Display ifconfig command to view network interface information
# Ifconfig eth0 // display the information of the specified interface
# Ifconfig-a // Display information of all interfaces (whether active or not)
# Ifconfig eth0 192.168.0.2 netmask 255.255.255.0
// Temporarily modify the interface IP address (no need to restart the interface)
II. $/sbin/route // display the route table information of the current Linux host
1. # route del default gw 192.168.0.1
// Temporarily delete the default gateway 192.168.0.1
2. # route add default gw 192.168.0.1
// Temporarily add the default gateway 192.168.0.1
/** The temporary operation is mentioned in this article, that is, after the host is restarted, this operation will become invalid. if you want to automatically add a static route entry after each system restart, this statement can be written to/etc/rc. d/rc. local. **/
III. # ping // test the network connection with other hosts
1. # ping-c 4 192.168.0.1 // specify the number of ICMP packets sent
IV. # traceroute // test the network connection from the current host to the destination
V. # hostname // view the host name of the current host
1. # hostname linsrv // temporarily modify the current host name
VI. # nslookup // Test DNS domain name resolution
> Server // display the current DNS server
> Server 192.168.0.1 // temporarily specify the DNS server address
VII. # dhclient // Apply for network configuration information for the current host
8. # netconfig // use the wizard to modify network configuration information on the character interface
9. #/etc/init. d/network restart // restart the network service
1. #/etc/init. d/network stop // stop the network service
2. #/etc/init. d/network start // start the network service
/** You must restart the network service to modify the network configuration information through netconfig or by modifying the configuration file **/
10. # service network start // start the network service
1. # service network stop // stop the network service
2. # service network restart // restart the network service
3. # service network status // view the network service status
/** In RHEL4, you can use service commands to manage the startup, stop, restart, and view the working status of most services **/
11. # chkconfig -- list | grep network // view the automatic startup level of a service
1. # chkconfig -- level 35 network off // Set level 35 to not automatically start a service
2. # chkconfig -- level 3 network on // Set level 3 to automatically start a service
12. ntsysv // use the wizard to modify the auto-start options of the service on the character interface
13. # vi/etc/sysconfig/network-scripts/eth0 // edit the configuration file of the specified network interface
DEVICE = eth0 // specify the interface name
ONBOOT = yes // load when the system starts
BOOTPROTO = static // static IP address configuration. if the value is "dhcp", it is dynamically obtained.
IPADDR = 192.168.0.1 // Set the IP address
NETMASK = 255.255.255.0 // sets the subnet mask.
GATEWAY = 192.168.0.254 // set the default GATEWAY
/** Note: You must restart the network service or restart the interface (# ifdown eth0; ifup eth0) to make the setting take effect. **/
14. # vi/etc/sysconfig/network // modify the host name through the configuration file
NETWORKING = yes
HOSTNAME = localhost. localdomain // modify this value as the host name, for example, rhel.lpwr.net
// After the configuration is modified, the system must be restarted to take effect.
15. # vi/etc/hosts // set the local DNS file
127.0.0.1 localhost. localdomain localhost // This row is strongly recommended
192.168.0.1 rhel.lpwr.net rhel // there must be three fields: IP, FQDN, and HOSTNAME
16. # vi/etc/resolv. conf // specify the DNS server of the current host. a maximum of three DNS servers can be specified.
Search lpwr.net // set the default search domain of the current host
Nameserver 192.168.0.100 // specify the preferred DNS server
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service