The ip command is a useful alternative to the ifconfig command and allows the user to manage network interfaces. This is a good way to use the command line to bring network interfaces up or down. In this example I am bringing the network interface down.
[root@localhost jason]# ip link set eno16777736 down [root@localhost jason]# ip link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eno16777736: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel state DOWN mode DEFAULT qlen 1000 link/ether 00:0c:29:47:5e:b4 brd ff:ff:ff:ff:ff:ff 3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT link/ether 52:54:00:c1:70:73 brd ff:ff:ff:ff:ff:ff 4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN mode DEFAULT qlen 500 link/ether 52:54:00:c1:70:73 brd ff:ff:ff:ff:ff:ff |
Now I bring the interface back up again.
[root@localhost jason]# ip link set eno16777736 up [root@localhost jason]# ip link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT qlen 1000 link/ether 00:0c:29:47:5e:b4 brd ff:ff:ff:ff:ff:ff 3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT link/ether 52:54:00:c1:70:73 brd ff:ff:ff:ff:ff:ff 4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN mode DEFAULT qlen 500 link/ether 52:54:00:c1:70:73 brd ff:ff:ff:ff:ff:ff |
The ip link show command will print information about the network interfaces.
ubuntu ~ $ ip link show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether 06:d6:3a:a8:82:13 brd ff:ff:ff:ff:ff:ff 3: tun1194: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 100 link/none |
The command ip addr show dev eth0 will only show IP address information for the interface supplied, in this case it is eth0.
ubuntu ~ $ ip addr show dev eth0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc pfifo_fast state UP group default qlen 1000 link/ether 06:d6:3a:a8:82:13 brd ff:ff:ff:ff:ff:ff inet 172.31.20.16/20 brd 172.31.31.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::4d6:3aff:fea8:8213/64 scope link valid_lft forever preferred_lft forever |
This command will display IP multicast addresses for a particular interface.
ubuntu ~ $ ip maddr show dev eth0 2: eth0 link 01:00:5e:00:00:01 link 33:33:00:00:00:01 link 33:33:ff:a8:82:13 inet 224.0.0.1 inet6 ff02::1:ffa8:8213 inet6 ff02::1 inet6 ff01::1 |
I found this information on this useful ip command cheat-sheet from Redhat: https://access.redhat.com/sites/default/files/attachments/rh_ip_command_cheatsheet_1214_jcs_print.pdf.