# Getting ip address/devices (you have to be root and the netlink tools
# installed)
# allowed shortcuts:
#
# address a
# route r
# show s
# add a
# delete d
# set s
# get g
#
# syntax:
#
# ip address|route|link show|add|delete|set|get [ip-addressss/mask] [dev [device]] [up|down]
#
# getting the ip addresses
> ip address show # is the same as: "ip a s" or: "ip a"
1: lo: mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
2: eth0: mtu 1500 qdisc pfifo_fast qlen 100
link/ether 00:03:47:c4:0d:75 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.1/24 brd 192.168.0.255 scope global eth0
13: ppp0: mtu 1500 qdisc pfifo_fast qlen 3
link/ppp
inet 80.121.6.248 peer 172.19.92.167/32 scope global ppp0
# getting the routing table
> ip route show # the same as: "ip r s" or: "ip r"
172.19.92.167 dev ppp0 proto kernel scope link src 80.121.6.248
192.168.0.0/24 dev eth0 scope link
127.0.0.0/8 dev lo scope link
default via 172.19.92.167 dev ppp0
# getting the devices
> ip link show # the same as: "ip l s" or: "ip l"
1: lo: mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: mtu 1500 qdisc pfifo_fast qlen 100
link/ether 00:03:47:c4:0d:75 brd ff:ff:ff:ff:ff:ff
13: ppp0: mtu 1500 qdisc pfifo_fast qlen 3
link/ppp
# deleting an ip address
# before deleting:
> ip a s dev eth0 # = ip address show dev eth0
2: eth0: mtu 1500 qdisc pfifo_fast qlen 100
link/ether 00:03:47:c4:0d:75 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.1/24 scope global eth0
# deleting the ip: "ip address delete 192.168.0.1/24 dev eth0"
> ip a d 192.168.0.1/24 dev eth0
# after deleting:
> ip a s dev eth0
2: eth0: mtu 1500 qdisc pfifo_fast qlen 100
link/ether 00:03:47:c4:0d:75 brd ff:ff:ff:ff:ff:ff
# shutting down a device ( ip link set dev eth0 down ):
>ip l s dev eth0 down
# adding an ip address ( = ip address add 192.168.0.1/24 dev eth0 ):
> ip a a 192.168.0.1/24 dev eth0
# the result:
> ip a s dev eth0
2: eth0: mtu 1500 qdisc pfifo_fast qlen 100
link/ether 00:03:47:c4:0d:75 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.1/24 scope global eth0
# starting up a device ( not always necessary )
> ip l s dev eth0 up
# getting the route to a specific address ( = ip route get 198.168.0.10 )
> ip r get 198.168.0.10
198.168.0.10 via 172.19.92.167 dev ppp0 src 80.121.6.248
cache mtu 1500 advmss 1460
# deleting a route ( = ip route delete 192.168.0.0/24 dev eth0 ):
> ip r d 192.168.0.0/24 dev eth0
# the result
>ip r
172.19.92.167 dev ppp0 proto kernel scope link src 80.121.6.248
127.0.0.0/8 dev lo scope link
default via 172.19.92.167 dev ppp0
# setting a route ( ip route add 192.168.0.0/24 dev eth0 ):
> ip r a 192.168.0.0/24 dev eth0
# the result
root@Jambalaya root # ip r
172.19.92.167 dev ppp0 proto kernel scope link src 80.121.6.248
192.168.0.0/24 dev eth0 scope link
127.0.0.0/8 dev lo scope link
default via 172.19.92.167 dev ppp0
# settin the default route
# before setting the default route
> ip r
172.19.92.167 dev ppp0 proto kernel scope link src 80.121.6.248
192.168.0.0/24 dev eth0 scope link
127.0.0.0/8 dev lo scope link
# setting the default route ( = ip route add default dev ppp0):
> ip r a default dev ppp0
# after setting the default route
> ip r
172.19.92.167 dev ppp0 proto kernel scope link src 80.121.6.248
192.168.0.0/24 dev eth0 scope link
127.0.0.0/8 dev lo scope link
default dev ppp0 scope link