The ip command is able to do a lot more than what is listed below, but I will only focus on the ifconfig equivalent features. The ip command splits the functionality of link information and address information into two sets of commands, so some commands will require running ip twice, once for link status and once for address information. The ifconfig command shows only those interfaces currently UP by default, the ip command shows all interfaces by default unless you specify UP.
Showing default ifconfig information:
- ifconfig # shows all UP interfaces, addresses, and link status
- ip -s link up # shows link status for all UP interfaces
- ip addr up # shows address information for all UP interfaces
- ifconfig -a
- ip -s link
- ip addr
- iconfig eth0
- ip -s link eth0
- ip addr show eth0
- ifconfig eth0 down
- ip link set eth0 down
- ifconfig eth0 192.168.0.20 netmask 255.255.255.0 broadcast 192.168.0.255
- ip addr add dev eth0 192.168.11.2/24 broadcast 192.168.0.255
Network aliases:
The ip command does not have to use aliases, but can manage aliases created by ifconfig by labelling an address. Assuming no 10 addresses have been added to eth0, the following three commands would add two primary addresses and one secondary address.
- ip addr add dev eth0 10.0.0.1/24 broadcast 10.0.0.255
- ip addr add dev eth0 10.10.10.20/24 broadcast 10.10.10.10.255
- ip addr add dev eth0 10.10.10.21/24 broadcast 10.10.10.10.255
To manage aliases with ip addr, use the "label" keyword as below.
- ifconfig eth0:0 10.10.10.20 netmask 255.255.255.0 broadcast 10.10.10.255
- ip addr add dev eth0 10.10.10.20/24 broadcast 10.10.10.10.255 label eth0:0
No comments:
Post a Comment