Linux Network basic configuration and troubleshooting methodology
Source: Internet
Author: User
(I) basic configuration commands
In Linux, the Ethernet interface is run with the following commands: eth0 and eth1; 0 and 1 represent the nic id.
Use lspci to view the hardware information of the NIC. If it is a USB Nic, use the lsusb command.
Ifconfig is used to view interface information.
Ifconfig-a view all interfaces
Ifconfig eth0 view specific Interfaces
IFUP and ifdown are used to enable or disable an interface.
IFUP eth0
Ifdown eth0
Configure Network Information in setup Gui
Enable the NIC with IFUP after the configuration is complete, and use ifconfig to view information
(Ii) network-related configuration files
Nic configuration file
/Etc/sysconfig/network-scripts/ifcfg-eth0
DNS configuration file
/ETH/resolv. conf
Host Name configuration file
/Etc/sysconfig/Network
Modify host name in real time
-- No after restart
Hostname think. localdomain
Permanent modification of Host Name
-- Takes effect after restart
/Etc/sysconfig/Network
(Iii) Network Test commands
Test network connectivity
-- IP address, subnet mask, and network hardware
Ping 192.168.1.1 test Gateway
Ping www.csdn.net
Test DNS resolution
Simple: Host www.csdn.net
Complex: Dig www.csdn.net
Show route table
-- Each host has its own route table.
IP Route
Track the network path to the target address
-- That is, the number of routers and their addresses
Traceroute www.csdn.net
Network Quality Test
-- Combined with Traceroute and Ping
MTR www.csdn.net
(Iv) network troubleshooting
Principle: bottom-up
From inside out
① Check whether the network configuration is correct.
● IP Address
● Subnet Mask
● Gateway
● DNS
② Check whether the gateway is connected
Ping the gateway/Target IP Address
③ Check whether DNS resolution is correct
Host www.douban.com
Host www.csdn.net
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