2014-02-25 10:25:47 +08:00
|
|
|
# ip
|
|
|
|
|
2023-06-13 22:44:43 +05:30
|
|
|
> Show/manipulate routing, devices, policy routing and tunnels.
|
2024-10-04 21:14:41 +02:00
|
|
|
> Some subcommands such as `address` have their own usage documentation.
|
2024-06-18 17:08:28 +02:00
|
|
|
> More information: <https://www.manned.org/ip.8>.
|
2014-02-25 10:25:47 +08:00
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- List interfaces with detailed info:
|
2014-02-25 10:25:47 +08:00
|
|
|
|
2025-03-07 13:06:30 +02:00
|
|
|
`ip {{[a|address]}}`
|
2020-10-06 13:12:54 +02:00
|
|
|
|
|
|
|
- List interfaces with brief network layer info:
|
|
|
|
|
2025-06-20 06:06:16 +03:00
|
|
|
`ip {{[-br|-brief]}} {{[a|address]}}`
|
2020-10-06 13:12:54 +02:00
|
|
|
|
|
|
|
- List interfaces with brief link layer info:
|
|
|
|
|
2025-06-20 06:06:16 +03:00
|
|
|
`ip {{[-br|-brief]}} {{[l|link]}}`
|
2014-02-25 10:25:47 +08:00
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- Display the routing table:
|
2014-02-25 10:25:47 +08:00
|
|
|
|
2025-03-07 13:06:30 +02:00
|
|
|
`ip {{[r|route]}}`
|
2014-02-25 10:25:47 +08:00
|
|
|
|
2018-07-16 23:00:02 +08:00
|
|
|
- Show neighbors (ARP table):
|
|
|
|
|
2025-03-07 13:06:30 +02:00
|
|
|
`ip {{[n|neighbour]}}`
|
2018-07-16 23:00:02 +08:00
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- Make an interface up/down:
|
2014-02-25 10:25:47 +08:00
|
|
|
|
2025-06-24 16:05:46 +03:00
|
|
|
`sudo ip {{[l|link]}} {{[s|set]}} {{ethX}} {{up|down}}`
|
2014-02-25 10:25:47 +08:00
|
|
|
|
2021-08-15 19:59:09 +02:00
|
|
|
- Add/Delete an IP address to an interface:
|
2014-02-25 10:25:47 +08:00
|
|
|
|
2025-06-24 16:05:46 +03:00
|
|
|
`sudo ip {{[a|address]}} {{add|delete}} {{ip}}/{{mask}} dev {{ethX}}`
|
2014-02-25 10:25:47 +08:00
|
|
|
|
2017-03-29 11:20:39 -04:00
|
|
|
- Add a default route:
|
2014-02-25 10:25:47 +08:00
|
|
|
|
2025-06-24 16:05:46 +03:00
|
|
|
`sudo ip {{[r|route]}} {{[a|add]}} default via {{ip}} dev {{ethX}}`
|