It has been more than a decade since the ifconfig
command has been deprecated on Linux in favor of the iproute2
project, which contains the magical tool ip
. Many online tutorial resources still refer to old command-line tools like ifconfig
, route
, and netstat
. The goal of this tutorial is to share some of the simple networking-related things you can do easily using the ip
tool instead.
Find your IP address
[dneary@host]$ ip addr show [snip] 44: wlp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 5c:e0:c5:c7:f0:f1 brd ff:ff:ff:ff:ff:ff inet 10.16.196.113/23 brd 10.16.197.255 scope global dynamic wlp4s0 valid_lft 74830sec preferred_lft 74830sec inet6 fe80::5ee0:c5ff:fec7:f0f1/64 scope link valid_lft forever preferred_lft forever
ip addr show
will show you a lot of information about all of your network link devices. In this case, my wireless Ethernet card (wlp4s0) is the IPv4 address (the inet
field) 10.16.196.113/23
. The /23
means that there are 23 bits of the 32 bits in the IP address, which will be shared by all of the IP addresses in this subnet. IP addresses in the subnet will range from 10.16.196.0 to 10.16.197.254
. The broadcast address for the subnet (the brd
field after the IP address) 10.16.197.255
is reserved for broadcast traffic to all hosts on the subnet.
Read more at OpenSource.com