Network Management Command of linux
This article mainly introduces the basic commands of network viewing and configuration under linux: ifconfig, ip, route, and then introduces the configuration of DNS, hostname and other information.
1. Network interface type:
Lo: local loopback interface
Eth [0-9]: Ethernet interface
Pppx: point-to-point connection
two。 The ifconfig / / of the network IP address configuration command can view the specific active Nic information
When I drop the lo down, enable or disable the network card as follows / / ifconfig lo down/up
[root@lys ~] # ifconfig eno16777736 192.168.2.110 / / temporarily modify the network card ip. Restart is invalid.
3. Management commands of network services
Usage format:
/ etc/init.d/network {start | stop | restart | status} or service network {start | stop | restart | status}
4. How to keep ip permanently. At this point we are going to edit the file. Cd / etc/sysconfig/network-scripts/
The above are network configuration files, what we need to edit is ifcfg-eno16777736
Route of the configuration command:
Route: you can view the routing information on our system directly
Route-n: displays routing information in digital form
Add rout
Route add-host: add host rout
Route add-net: add network rout
Route add-net 0.0.0.0: add default rout
Format: route add-net | host DEST gw NEXTHOP
Delete a rout
Route del-host: delete host rout
Route del-net: delete network routes / / or route delete 192.168.2.112 gw 192.168.2.1
Ip of the configuration command:
1.ip addr show: look at the network information, and the information you see is similar to that of ip link show, which is relatively brief.
Ip addr add IP dev ethX: configure IP address (the Nic information configured by this command cannot be viewed by ifconfig and needs to be viewed by ip addr show)
[root@lys ~] # ip addr add 192.168.2.112 dev eno16777736 / / ip addr show command view
Ip addr add IP dev ethx label ethX:X: configure the child Ip and give it an alias.
The configuration file of DNS is / etc/resolve.conf by default. The resolution process of a domain name is / etc/hosts first, then / etc/resolve.conf.
Check the network connection: / /-number of ping packets
A simple introduction to network tools:
Nmap-sTU localhost simultaneously scans the local TCP/UDP port
Nmap-sP 192.168.1.0 Universe 24 (check how many hosts are in the area network through the ICMP package)