Follows are command lines that I often use (not necessarily the best
approach) while interacting with
ip, which is used to show / manipulate
routing, devices, policy routing and tunnels.
Show current routes.
ip route show
- Add route:
sudo ip route add `a.b.c.d/e` via `gateway_IP` dev `device_name`
a.b.c.d/ecan be the subnet of IPs or just an IP address of the desired destination, and the
gateway_IPis the IP address of the gateway where you want to route your traffic through (e.g.,
device_nameis the name of the interface via which you want to route your traffic (e.g.).
ip route del `a.b.c.d/e`
- Remove an interface/device:
ip link set dev `interface_name` down
ip link delete `interface_name`