Linux Network management--linux network commands

Source: Internet
Author: User
Tags nslookup nslookup command

<title>3. Linux Network commands</title> 3. Linux Network Command 3.1 network Environment View command

①ifconfig Command
ifconfigCommand: View and configure network status commands

However, you can only view IP addresses and subnet masks using the Ifconfig command, and you cannot view DNS and gateways

② shutting down and starting the NIC

1.ifdown 网卡设备名
2.#禁用该网卡设备
3.
4.ifup 网卡设备名
5.#启用该网卡设备

③ Querying network status

1.netstat 选项
2.选项:
3. -t:列出TCP协议端口
4. -u:列出UDP协议端口
5. -n:不使用域名与服务名,而使用IP地址和端口号
6. -l:仅列出在监听状态网络服务
7. -a:列出所有的网络连接


View the listening port,

1.Proto Recv-Q Send-Q Local Address           Foreign Address         State      
2.tcp 0 0127.0.0.1:5939 0.0.0.0:* LISTEN
3.

Recv-Q Send-QRepresents the queue waiting to be received and sent, if the queue is large, indicating that the current network status is poor, :5939 indicating the native open port
If used netstat -an , all ports are displayed

1.  Active UNIX domain sockets (servers and  established) 
2. Proto refcnt Flags type State i-node path
3. Unix 2 [ACC] STREAM LISTENING 21762 /var/run/mcelog-client
4. Unix 2 [ACC] STREAM LISTENING 23563 /var/run/networkmanager/private

Not only does it show connections to the extranet, it also shows the ports used by the native software
Established status indicates that the connection already exists
If you want to count the network connections that exist established
OKnetstat -an | grep ESTABLISHED

If we want to count the number of words in a file, how many lines can be used wc install.log
So if we want to count the number of rows in a remote connection in the established state

1.netstat -an | grep ESTABLISHED | wc -l

Netstat also supports

1.netstat -rn
2.选项:
3. -r:列出路由列表,功能和route命令一致

Gateway information can be queried, in addition to

1.route -n

④route command

1.  Route-n 
2. #查看路由列表 (you can see the gateway)
3.
4. Route add default GW 192.168 .1 .1
5. #临时设定网关
6.
7. route del default GW 192.168 .1 .1
Span class= "Hljs-comment line-number" >8. #删除设定网关

In a server, even the network card is unable to set the gateway. The general gateway is telecommunications or unicom these service providers to set.

⑤ Domain Name Resolution command

1.nslookup [主机名或IP]
2.#进行域名与IP地址解析

The nslookup command is used to translate which IP the domain name corresponds to

1.  [ Kano@kelvin ~]$ nslookup www.qq.com 
2. Server: 192.168 .1 .1
3. Address: 192.168 .1 #53
4.
5. non-authoritative Answer:
6. Name:www.qq.com
7. Address: 115.25 .209 . All
1.[KANO@kelvin ~]$ nslookup
2.> server
3.192.168.1.1
4.192.168.1.1#53
3.2 Network Test commands

①ping command

1.ping [选项] ip或域名
2.#探测指定IP或域名的网络状况
3.选项:
4. -c 次数:指定ping包的次数

If a website allows us to ping, we can use the ping domain name

②telnet Command
PlainText transmission

1.telnet [域名或IP] [端口]
2.#远程管理与端口探测命令
3.
4.例;
5.192.168.0.25280

③traceroute
For example, we visit QQ, then we are through which routing path to access it

1.tracerouteIP或域名
2.#路由跟踪命令
3.
4.选项:
5. -n:使用IP,不使用域名,速度更快

ICMP is (Internet Control message Protocol) Internet Controlled message protocol. Traceroute also uses the ICMP protocol. *indicates that the ping does not pass. Most of the nodes are pass-through, or there will be some nodes that are not reachable, but can eventually reach the target domain name.

1.[Kano@kelvin ~]$ traceroute www.qq.com
2.Traceroute to Www.qq.com (115.25. 209. the), -Hops Max, -BYTE packets
3. 1Gateway (192.168. 1. 1)0.553Ms0.855Ms1.221Ms
4. 2* * *
5. 3* * *
6. 4 59.67. 0. 221(59.67. 0. 221)2.615Ms2.568Ms2.547Ms
7. 5* * *
8. 6 59.67. 182. 137(59.67. 182. 137)2.774Ms1.579Ms1.393Ms
9. 7 59.67. 181. the(59.67. 181. the)2.600Ms2.580Ms2.516Ms
. 8 59.67. 181. 9(59.67. 181. 9)5.468Ms5.451Ms4.234Ms
One by one . 9 59.67. 181. the(59.67. 181. the)2.398Ms2.500Ms2.447Ms
.Ten 101.4. 117. 229(101.4. 117. 229)3.818Ms3.335Ms3.039Ms
. One 101.4. 117. 197(101.4. 117. 197)4.458Ms4.091Ms101.4. the. 101(101.4. the. 101)4.065Ms
. A 101.4. the. 117(101.4. the. 117)34.464Ms33.541Ms32.854Ms
A . - 101.4. 117.(101.4. 117.)26.068Ms26.174Ms26.131Ms
. - 219.224. 103. the(219.224. 103. the)30.261Ms219.224. 103.(219.224. 103.)27.703Ms27.666Ms
. the*10.200. 127. 118(10.200. 127. 118)27.203MS *
. - 10.191. 119. the(10.191. 119. the)28.369Ms10.191. 119. Ten(10.191. 119. Ten)27.940Ms10.191. 119. the(10.191. 119. the)27.571Ms
. -* * *
. -* * *
. +* * *
. -* * *
. +* * *
A . A* * *
. at* * *
. -* * *
. -* * *
. -* * *
. -* * *
. -* * *
. in* * *
. -* * *

As long as I do not ping my router one day, then you can see what is wrong * with the node. This is also the General Debug command.

④wget command

1.wgethttp://soft.vpser.net/lnmp/lnmp1.1-full.tar.gz
2.#下载命令

⑤tcpdump Command
Grab Package Command

1.tcpdump -i eth0 -nnX  port 21
2.选项:
3. -i:指定网卡接口
4. -nn:将数据包中的域名与服务转为IP和端口
5. -X:以十六进制和ASCII码显示数据包内容
6. port:指定监听端口

Linux Network management--linux network commands

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.