Linux ip Command Cheat Sheet

Mar 15, 2019

Adding a default route

ip route add default via <gateway ip>

Optionally with an interface

ip route add default via <gateway ip> dev <interface>

Adding a subnet route to an interface

ip route add <ip>/<mask> dev <interface>

Deleting a route

ip route del default
ip route del <ip addr>/<mask>

Checking a route

ip route get 8.8.8.8

Adding a static IP to an interface

ip addr add <ip addr>/<mask> broadcast <broadcast addr> dev <interface>

Removing a static IP from an interface

ip addr del <ip addr>/<mask> dev <interface>

Setting interfaces up/down

ip link set dev <interface> up
ip link set dev <interface> down
Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.