<title>Basic Network Tools under Linux</title> Basic Network Tools under Linux table of Contents
- Ifconfig
- Route
- Ip
- Dns
- Other configuration files
Ifconfig
Ifconfig eth0 upifconfig eth0 downifconfig eth0 192.168.10.111
Permanent IP
/etc/sysconfig/network-scripts/ifcfg-eth0
Ipaddr=xxxxnetmask=xxxgateway=xxxxxpeerdns={yes|no}: Indicates whether the DNS server specified by the DHCP server is accepted
/etc/sysconfig/network-scripts/ifcfg-eth0:1
Device=eth0:1ipaddr=xxxnetmask=xxxgateway=xxx
Output of the Ifconfig command
RX Packets: Packets Received TX packets: Packets sent Rx bytes: Number of bytes received tx bytes: Bytes Sent Mtutxqueuelen 1000
Route
Route add 0.0.0.0/0 GW 222.17.106.126route add 192.168.0.8 GW 222.17.106.126route del 192.168.0.8
Traceroute 192.168.0.8
Permanent Route
/etc/sysconfig/network-scripts/route-eth0
Format 1
192.168.1.10 via 10.0.0.10192.168.1.11 via 10.0.0.10
Format 2
address0=192.168.1.10netmask0=255.255.255.0gateway0=10.0.0.10
address1=192.168.1.11netmask1=255.255.255.0gateway1=10.0.0.10
Ip
- Link: Configure NIC properties
Man IP link
Show
IP link showip-s link show
Set
IP link set eth1 txqueuelen 150
- Addr: Protocol Address
Man IP Address
Add
IP addr Add 172.16.208.118 dev eth0 (presence, but no label, ifconfig invisible, IP addr visible) IP addr add 172.16.208.119 dev eth0 Lab El eth0:1 (Ifconfig See)
Del
IP addr del 172.16.208.119/32 dev eth0ip addr del 172.16.208.118/32 dev eth0
Show
IP addr Showip Addr show eth0
- Route: Configure Routing
Man IP route
IP route
IP Route List
IP route add 10.0.0.0/8 Dev eth1 via 172.16.208.1ip route del 10.0.0.0/8 Dev eth1ip route add 192.168.1.0/24 Dev eth1 via 172.16.208.1ip Route del 192.168.1.0/24
Dns
Vi/etc/resolv.conf
Host
Host Baidu.comhost-t MX Baidu.comhost 111.13.101.208
Nslookup
Nslookup baidu.comnslookup-q=mx baidu.com
Dig
Dig-t NS. # Find the root server NAME serverdig-t A www.xxx.com # Find the IP address of the www.xxx.com DNS in/etc/resolve.confdig-x ipaddr # Find I P corresponding host name dig-t AXFR www.xxx.com # Full zone transfer dig-t ixfr= serial number www.xxx.com # incremental zone transfer dig +trace baidu.com # See how to find Baid U.comdig +nocmd xxx # does not show dig version number dig +short xxx # output condensed information dig +nostat XXX # does not display statistics, default output response time dig +nocomment xx X # Save details Annotation Information
Other configuration files
/etc/services the file defined by the port number
/etc/protocols defines the relevant data for the IP packet protocol, including the definition of the ICMP/TCP/UDP packet protocol
Host Name
Vi/etc/sysconfig/network
Networking=yes # Whether to turn on network Networking_ipv6=no # Whether to turn on IPv6 network hostname=xxxxx
Basic Network Tools under Linux