The other day, I was helping out some guy to set his IP address. He missed ifconfig; which is deprecated by the way, and I lent a hand; helping him get around the “ip” command.
Here’s a micro cheatsheet:
# get some info on your link # This will show your links or interfaces; so you know their names and use them after "dev" ip link show # enable your link (pretend my interface is p5p1) ip link set dev p5p1 up # disable your interface ip link set dev p5p1 down # get your current IP addresses ip addr show # set an IP address (p5p1 is my interface; you might still use eth0 or some other thing) ip addr add 192.168.1.100/24 dev p5p1 # add another IP address to your interface (2 IP addresses) ip addr add 192.168.1.101/24 dev p5p1 # set a default route (pretend that the default gateway is 192.168.1.254) ip route add default via 192.168.1.254
So, that’s it for now. Try checking out the command’s help:
ip link help
ip addr help
ip route help
Also, you can use shoft forms. The default command is show/list:
ip a ...
ip l ...
ip r ...