Created Wednesday 9/6/2010
The iproute2 package is the standard feature suite for routing and traffic control provided linux since kernel 2.2 and replaces the older (SunOS modelled) arp, ifconfig(8) and route tool suite.
The link option is used to display or change the characteristics of the attached network devices (including the loopback interface). Use ip link list to display the currently defined interface devices:
bash $ ip route list
Use the link option to bring an interface up or down:
bash # ip link set eth0 down bash # ip link set eth0 up
The address option displays the IP addresses assigned to the interfaces. Other information such as the maximum transmission unit (MTU) are also displayed:
bash $ ip address show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:16:e6:dc:c2:d5 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.8/24 brd 192.168.1.255 scope global eth0
inet6 fe80::216:e6ff:fedc:c2d5/64 scope link
valid_lft forever preferred_lft forever
To add a new address of '''
192.168.1.9/24
to device eth0, first remove the one (which is ''' 192.168.1.8/24
in the previous example) and add in the new prefix (i.e., the new ip address):
bash # ip addr del dev eth0 192.168.1.8/24 bash # ip addr add dev eth0 192.168.1.9/24 broadcast 192.168.1.255 bash # ip addr show eth0
Use the route list option to ip to display the configured interfaces and associated routing. In the following, the device eth0 is configured with a static ip address of 192.168.1.8 with a default route via 192.168.1.253. The network for the device is the RFC1918 class C subnet 192.168.1.0/24:
bash $ ip route list 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.8 metric 1 default via 192.168.1.253 dev eth0 proto static
See also:
Stuart Moorfoot © 9 June 2010