mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-01-26 11:33:59 +00:00
26 lines
650 B
Plaintext
26 lines
650 B
Plaintext
---
|
|
syntax: markdown
|
|
tags: [tldr, linux]
|
|
source: https://github.com/tldr-pages/tldr.git
|
|
---
|
|
# ip route add
|
|
|
|
> Add a new networking route.
|
|
> More information: <https://manned.org/ip-route>.
|
|
|
|
- Add a default route using gateway forwarding:
|
|
|
|
`sudo ip {{[r|route]}} {{[a|add]}} default via {{gateway_ip}}`
|
|
|
|
- Add a default route using `ethX`:
|
|
|
|
`sudo ip {{[r|route]}} {{[a|add]}} default dev {{ethX}}`
|
|
|
|
- Add a static route:
|
|
|
|
`sudo ip {{[r|route]}} {{[a|add]}} {{destination_ip}} via {{gateway_ip}} dev {{ethX}}`
|
|
|
|
- Add a route to a specific routing table:
|
|
|
|
`sudo ip {{[r|route]}} {{[a|add]}} {{destination_ip}} dev {{ethX}} {{[t|table]}} {{ip_address}}`
|