查看 管理 IP 地址
root:~# ip neigh 192.168.1.1 dev enp1s0 lladdr 0c:4b:34:16:c0:19 REACHABLE 192.168.1.53 dev enp1s0 lladdr 00:f1:f4:a6:73:2c STALE 192.168.1.2 dev enp1s0 lladdr 38:1a:52:5f:d7:ba STALE 192.168.1.253 dev enp1s0 lladdr 28:80:23:76:2b:70 STALE 192.168.1.124 dev enp1s0 lladdr 40:8d:5c:b1:42:a8 REACHABLE root:~# ip route show default via 192.168.1.1 dev enp1s0 proto dhcp metric 100 169.244.0.0/16 dev enp1s0 scope link metric 1000 192.168.1.0/24 dev enp1s0 proto kernel scope link src 192.168.1.150 metric 100 root:~#
基本语法
ip [ OPTIONS ] OBJECT { COMMAND | help }
ip [ -force ] -batch filename
OBJECT := { link | address | addrlabel | route | rule | neigh | ntable |
tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm |
netns | l2tp | fou | macsec | tcp_metrics | token | netconf | ila |
vrf | sr | nexthop }
OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |
-h[uman-readable] | -iec | -j[son] | -p[retty] |
-f[amily] { inet | inet6 | mpls | bridge | link } |
-4 | -6 | -I | -D | -M | -B | -0 |
-l[oops] { maximum-addr-flush-attempts } | -br[ief] |
-o[neline] | -t[imestamp] | -ts[hort] | -b[atch] [filename] |
-rc[vbuf] [size] | -n[etns] name | -N[umeric] | -a[ll] |
-c[olor]}
选项参数
| 参数 | EN 解释 | 中文翻译 | Remark |
|---|---|---|---|
| Function | 命令 | 文字解释 | 示例 | 示例解释 |
|---|---|---|---|---|
| 查看 | ip a | 展示本机 IP 地址 | ||
| ip addr show | ||||
| ip route show | 查看路由地址信息 | |||
| ip route get 10.42.0.47 | 查看地址 10.42.0.47 路由包来源 | |||
| ip addr show wlan0 | 查看本机 wlan0 网卡的 IP 地址 | |||
| 设置 | ip addr add 192.168.1.193/24 dev wlan0 | 设置本机 wlan0 网卡的 IP 地址 | ||
| ip route add default via 192.168.1.196 | 将本机默认路由改为 192.168.1.196 | |||
| 删除 | ip addr del 192.168.1.193/24 dev wlan0 | 删除本机 wlan0 网卡的 IP 地址 | ||
| 监视 | ip monitor all | 实时监视到本机的网络连接的 IP 地址及其 MAC | ||
| 邻居 | ip neigh | 查看局域网内的可用 IP 地址及其 MAC | ||
| ip neighbour | ||||
| 对象 | ip route help | 展示 route 对象帮助信息 | ||
| ip link help | 展示 link 对象帮助信息 | |||
| 活动 | ip link set enp1s0 down | 禁用 enp1s0 网络接口 | ||
| ip link set enp1s0 up | 启用 enp1s0 网络接口 | |||
| 统计 | ip -s link | 展示网络接口统计信息 | ||
| ip -s -s link ls enp1s0 | 仅展示 enp1s0 网络接口统计信息 | |||
| Version | ip -V | 展示版本信息 | ||
| ip -Version | ||||
| 帮助 | ip -h | 展示帮助信息 | ||
| ip --help |
Copyright Notice: This article is an exclusive original manuscript, copyright belongs to Happy Digits Software , shall not be reproduced without permission.