ip command cheat sheet
Submitted by specialj on Thu, 2008-04-10 04:22.
I really do think that ip is a big improvement from ifconfig, route, ifup, ifdown, and the other commands it replaces. Still I seem to have trouble remembering which commands you need to use the word “dev” and which ones you don’t and similar minor semantic issues (like parameter ordering). So I decided to try and compile a list of commands I commonly use to be used as a reference for studying.
I’m going to use eth0 as the device for these examples so just replace that with the interface to manipulate.
link
ip link- show link info for all interfacesip link show up- show link info for interfaces that are “up”ip link show eth0show link info for eth0ip link set eth0 up- use instead of ifup (though not entirely equivalent)ip link set eth0 down- use instead of ifdown (though not entirely equivalent)ip link set eth0 promisc on- turn on promiscuous modeip link set eth0 promisc off- turn off promiscuous modeip link set eth0 txqlen 1000- set txqueuelen (can also use “txqueuelen”)ip link set eth0 mtu 1500- set mtu
addr
ip addr- show addr info for all interfacesip addr show up- show addr info for interfaces that are “up”ip addr show eth0show addr info for eth0ip addr add 10.10.10.10/32 dev eth0- add ip address and subnet to eth0- also works:
ip addr add dev eth0 10.10.10.10/32
- also works:
ip addr del 10.10.10.10/32 dev eth0- remove ip address and subnet from eth0- also works:
ip addr del dev eth0 10.10.10.10/32
- also works:
ip addr flush dev eth0- remove all addresses from eth0
route
ip route- list all routesip route flush- clear routing table- The rest of the route commands are outside the scope of this page. But here are the basic commands for managing routes without the required parameters.
ip route add- add a new routeip route change- change an existing routeip route replace- change route if it exists, add if it does notip route del- delete route (without parameters this will delete the default route)
Trackback URL for this post:
http://hightechsorcery.com/trackback/99
New Reise Blog




Recent comments
1 day 9 min ago
10 weeks 1 day ago
10 weeks 6 days ago
16 weeks 1 day ago
16 weeks 1 day ago
16 weeks 1 day ago
16 weeks 6 days ago
16 weeks 6 days ago
17 weeks 5 days ago
17 weeks 5 days ago