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/e can be the subnet of IPs or just an IP address of the desired destination, and the gateway_IP is the IP address of the gateway where you want to route your traffic through (e.g., 192.168.1.1), and device_name is the name of the interface via which you want to route your traffic (e.g.).

  • Delete route:

    ip route del `a.b.c.d/e`
    
    • Remove an interface/device:
    ip link set dev `interface_name` down
    

    or,

    ip link delete `interface_name`