2025-04-03 20:36:56 -06:00
|
|
|
# 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}}`
|
|
|
|
|
|
2025-07-24 22:27:13 -06:00
|
|
|
- Add a default route using `ethX`:
|
2025-04-03 20:36:56 -06:00
|
|
|
|
2025-07-24 22:27:13 -06:00
|
|
|
`sudo ip {{[r|route]}} {{[a|add]}} default dev {{ethX}}`
|
2025-04-03 20:36:56 -06:00
|
|
|
|
|
|
|
|
- Add a static route:
|
|
|
|
|
|
2025-07-24 22:27:13 -06:00
|
|
|
`sudo ip {{[r|route]}} {{[a|add]}} {{destination_ip}} via {{gateway_ip}} dev {{ethX}}`
|
2025-04-03 20:36:56 -06:00
|
|
|
|
|
|
|
|
- Add a route to a specific routing table:
|
|
|
|
|
|
2025-07-24 22:27:13 -06:00
|
|
|
`sudo ip {{[r|route]}} {{[a|add]}} {{destination_ip}} dev {{ethX}} {{[t|table]}} {{ip}}`
|