This is an old revision of the document!
IP - the ifconfig replacement
Anyone who has used Linux will likely be familiar with the ifconfig command. Apparently ifconfig was deprecated some time ago, but has still been included in CentOS and Red Hat. Well version 7 has finally left out ifconfig and so now we move on to it's replacement called ip
Basic IP Commands
ip a
This command will list all interfaces with their associated information.
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether b8:27:eb:25:73:7d brd ff:ff:ff:ff:ff:ff inet 192.168.1.7/24 brd 192.168.1.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::9c01:198b:dfcf:da93/64 scope link valid_lft forever preferred_lft forever 3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000 link/ether b8:27:eb:70:26:28 brd ff:ff:ff:ff:ff:ff
Let’s say you only want to see IPv4 information (for clarity). To do this, issue the command:
ip -4 a
Or, if you only want to see IPv6 information:
ip -6 a
What if you only want to see information regarding a specific interface? You can list information for a wireless connection with the command:
ip a show wlan0
You can even get more specific with this command. If you only want to view IPv4 on the wlan0 interface, issue the command:
ip -4 a show wlan0
You can even list only the running interface using:
ip link ls up
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether b8:27:eb:25:73:7d brd ff:ff:ff:ff:ff:ff 3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000 link/ether b8:27:eb:70:26:28 brd ff:ff:ff:ff:ff:ff \\ \\