Just knock a few orders today.
1. Network interface Parameters--ifconfig
This command can set the NIC interface IP address, subnet mask, etc.,
Ifconfig xx (NIC name) down-off NIC interface
ifconfig XX (network card name) up open NIC interface
2. View host parameters--Hostnamectl
Display or set host name
Hostnamectl Status Displays host name and host information
Hostnamectl set-hostname XX (host name to modify) set hostname
3. Configure Routing route
Route-n using digital customization instead of host name
4. File modification network parameters (modified by the command line is temporary, when the server restarts, all changes are restored, we want to persist changes, we can find their configuration file and then modify)
In CentOS, the NIC configuration file is/etc/sysconfig/network-scripts/ifcfg-eth0 this way,
Let's take a look at the configuration information in this
Device Name
Onboot indicates whether the network adapter is started (yes|no)
Bootproto Start Protocol (nono|dhcp:static)
IPADDR IP Address
netmask Subnet Mask
You can modify the NIC configuration information with Vim/etc/sysconfig/network-scripts/ifcfg-eth0
Then restart the Network service to make your changes effective
Systemctl Restart Network
5. Modifying host parameters
Host configuration file for/etc/hostname in this file, we can do the host file name configuration
6. Modify the routing parameters through the configuration file
We have modified the NIC interface above, can specify the gateway, but cannot set the static route information through the specific network segment, at this time we need to create the specified network card
Routing profile (default this file does not exist when you need to create), the profile name follows this rule: Route-<iface-name (NIC name) >
Restart Network Service SYSTEMCTL restart networks after modification
Here are a few more tools to troubleshoot network failures
7.ping
Ping a few steps
Ping 127.0.0.1 Ping Local loopback, test the local network protocol is not normal
Ping 192.168.0.31 ping local IP, test network interface is normal
Ping 192.168.0.254 Ping gateway to test whether the gateway is working properly
8.traceroute
After a packet is sent from the local, it is generally routed through multiple routes, and if a packet goes to the Internet, the data is sent to fail because of a problem in the middle of a route forwarding
At this point, we can trace the route through the Tracerote, to detect the problem, Linux, the default use of UDP package tracking packets, if you want to use ICMP, you can add-I
9.nestat Network Monitoring
If you suspect someone is trespassing on your system and you have no idea where this person is, you can use Netstat's network monitoring capabilities to find everyone.
Or when your service is turned on, the remote client cannot access your service, and you can use the netstat command to see if the service port is turned on.
Netstat-an View Network Connection Status
NETSTAT-NUTLP to see the current system open port information
This series of articles continues root system, welcome to subscribe to work number! Thank you!