Skip to content

Commit 0a50037

Browse files
authored
Update ip.md
1 parent 4a17216 commit 0a50037

File tree

1 file changed

+101
-95
lines changed

1 file changed

+101
-95
lines changed

command/ip.md

Lines changed: 101 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,101 @@
1-
ip
2-
===
3-
4-
网络配置工具
5-
6-
## 补充说明
7-
8-
**ip命令** 用来显示或操纵Linux主机的路由、网络设备、策略路由和隧道,是Linux下较新的功能强大的网络配置工具。
9-
10-
### 语法
11-
12-
```
13-
ip(选项)(参数)
14-
```
15-
16-
### 选项
17-
18-
```
19-
-V:显示指令版本信息;
20-
-s:输出更详细的信息;
21-
-f:强制使用指定的协议族;
22-
-4:指定使用的网络层协议是IPv4协议;
23-
-6:指定使用的网络层协议是IPv6协议;
24-
-0:输出信息每条记录输出一行,即使内容较多也不换行显示;
25-
-r:显示主机时,不使用IP地址,而使用主机的域名。
26-
```
27-
28-
### 参数
29-
30-
```
31-
网络对象:指定要管理的网络对象;
32-
具体操作:对指定的网络对象完成具体操作;
33-
help:显示网络对象支持的操作命令的帮助信息。
34-
```
35-
36-
### 实例
37-
38-
**用ip命令显示网络设备的运行状态**
39-
40-
```
41-
[root@localhost ~]# ip link list
42-
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
43-
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
44-
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
45-
link/ether 00:16:3e:00:1e:51 brd ff:ff:ff:ff:ff:ff
46-
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
47-
link/ether 00:16:3e:00:1e:52 brd ff:ff:ff:ff:ff:ff
48-
```
49-
50-
**显示更加详细的设备信息**
51-
52-
```
53-
[root@localhost ~]# ip -s link list
54-
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
55-
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
56-
RX: bytes packets errors dropped overrun mcast
57-
5082831 56145 0 0 0 0
58-
TX: bytes packets errors dropped carrier collsns
59-
5082831 56145 0 0 0 0
60-
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
61-
link/ether 00:16:3e:00:1e:51 brd ff:ff:ff:ff:ff:ff
62-
RX: bytes packets errors dropped overrun mcast
63-
3641655380 62027099 0 0 0 0
64-
TX: bytes packets errors dropped carrier collsns
65-
6155236 89160 0 0 0 0
66-
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
67-
link/ether 00:16:3e:00:1e:52 brd ff:ff:ff:ff:ff:ff
68-
RX: bytes packets errors dropped overrun mcast
69-
2562136822 488237847 0 0 0 0
70-
TX: bytes packets errors dropped carrier collsns
71-
3486617396 9691081 0 0 0 0
72-
```
73-
74-
**显示核心路由表**
75-
76-
```
77-
[root@localhost ~]# ip route list
78-
112.124.12.0/22 dev eth1 proto kernel scope link src 112.124.15.130
79-
10.160.0.0/20 dev eth0 proto kernel scope link src 10.160.7.81
80-
192.168.0.0/16 via 10.160.15.247 dev eth0
81-
172.16.0.0/12 via 10.160.15.247 dev eth0
82-
10.0.0.0/8 via 10.160.15.247 dev eth0
83-
default via 112.124.15.247 dev eth1
84-
```
85-
86-
**显示邻居表**
87-
88-
```
89-
[root@localhost ~]# ip neigh list
90-
112.124.15.247 dev eth1 lladdr 00:00:0c:9f:f3:88 REACHABLE
91-
10.160.15.247 dev eth0 lladdr 00:00:0c:9f:f2:c0 STALE
92-
```
93-
94-
95-
<!-- Linux命令行搜索引擎:https://jaywcjlove.github.io/linux-command/ -->
1+
ip
2+
===
3+
4+
网络配置工具
5+
6+
## 补充说明
7+
8+
**ip命令** 用来显示或操纵Linux主机的路由、网络设备、策略路由和隧道,是Linux下较新的功能强大的网络配置工具。
9+
10+
### 语法
11+
12+
```
13+
ip(选项)(参数)
14+
```
15+
16+
### 选项
17+
18+
```
19+
-V:显示指令版本信息;
20+
-s:输出更详细的信息;
21+
-f:强制使用指定的协议族;
22+
-4:指定使用的网络层协议是IPv4协议;
23+
-6:指定使用的网络层协议是IPv6协议;
24+
-0:输出信息每条记录输出一行,即使内容较多也不换行显示;
25+
-r:显示主机时,不使用IP地址,而使用主机的域名。
26+
```
27+
28+
### 参数
29+
30+
```
31+
网络对象:指定要管理的网络对象;
32+
具体操作:对指定的网络对象完成具体操作;
33+
help:显示网络对象支持的操作命令的帮助信息。
34+
```
35+
36+
### 实例
37+
38+
**用ip命令显示网络设备的运行状态**
39+
40+
```
41+
[root@localhost ~]# ip link list
42+
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
43+
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
44+
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
45+
link/ether 00:16:3e:00:1e:51 brd ff:ff:ff:ff:ff:ff
46+
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
47+
link/ether 00:16:3e:00:1e:52 brd ff:ff:ff:ff:ff:ff
48+
```
49+
50+
**显示更加详细的设备信息**
51+
52+
```
53+
[root@localhost ~]# ip -s link list
54+
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
55+
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
56+
RX: bytes packets errors dropped overrun mcast
57+
5082831 56145 0 0 0 0
58+
TX: bytes packets errors dropped carrier collsns
59+
5082831 56145 0 0 0 0
60+
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
61+
link/ether 00:16:3e:00:1e:51 brd ff:ff:ff:ff:ff:ff
62+
RX: bytes packets errors dropped overrun mcast
63+
3641655380 62027099 0 0 0 0
64+
TX: bytes packets errors dropped carrier collsns
65+
6155236 89160 0 0 0 0
66+
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
67+
link/ether 00:16:3e:00:1e:52 brd ff:ff:ff:ff:ff:ff
68+
RX: bytes packets errors dropped overrun mcast
69+
2562136822 488237847 0 0 0 0
70+
TX: bytes packets errors dropped carrier collsns
71+
3486617396 9691081 0 0 0 0
72+
```
73+
74+
**显示核心路由表**
75+
76+
```
77+
[root@localhost ~]# ip route list
78+
112.124.12.0/22 dev eth1 proto kernel scope link src 112.124.15.130
79+
10.160.0.0/20 dev eth0 proto kernel scope link src 10.160.7.81
80+
192.168.0.0/16 via 10.160.15.247 dev eth0
81+
172.16.0.0/12 via 10.160.15.247 dev eth0
82+
10.0.0.0/8 via 10.160.15.247 dev eth0
83+
default via 112.124.15.247 dev eth1
84+
```
85+
86+
**显示邻居表**
87+
88+
```
89+
[root@localhost ~]# ip neigh list
90+
112.124.15.247 dev eth1 lladdr 00:00:0c:9f:f3:88 REACHABLE
91+
10.160.15.247 dev eth0 lladdr 00:00:0c:9f:f2:c0 STALE
92+
```
93+
94+
**获取主机所有网络接口**
95+
96+
```
97+
ip link | grep ^[0-9] | awk -F: '{print $2}'
98+
```
99+
100+
101+
<!-- Linux命令行搜索引擎:https://jaywcjlove.github.io/linux-command/ -->

0 commit comments

Comments
 (0)