Master IP Address Lookup: From ifconfig to CIDR and Beyond
This guide explains how to view IP addresses on Windows and Linux, compares commands like ipconfig, ifconfig, and ip addr, and delves into networking fundamentals such as CIDR, public vs private IP ranges, MAC addresses, and interface flags.
Viewing IP Addresses
On Windows use ipconfig. On Linux the traditional command is ifconfig (provided by the net-tools package). A more modern alternative is ip addr from the iproute2 suite, which is installed by default on most recent distributions.
Difference between ifconfig and ip addr
ifconfigbelongs to net-tools; ip addr belongs to iproute2. Both can be installed via the system package manager if missing.
root@test:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether fa:16:3e:c7:79:75 brd ff:ff:ff:ff:ff:ff
inet 10.100.122.2/24 brd 10.100.122.255 scope global eth0
inet6 fe80::f816:3eff:fec7:7975/64 scope linkThe output lists each network interface and its attributes:
Interface name (e.g., lo, eth0).
Flags such as BROADCAST, MULTICAST, UP, LOWER_UP indicate the interface state.
MTU (Maximum Transmission Unit) – 1500 bytes is the default Ethernet payload size.
qdisc – the queueing discipline; pfifo_fast is a three‑band FIFO scheduler.
MAC address shown after link/ether (e.g., fa:16:3e:c7:79:75).
IPv4 address after inet with CIDR suffix (e.g., 10.100.122.2/24).
IPv6 address after inet6.
Scope – global means the interface is reachable from other networks; host is limited to the local host.
CIDR Notation
Classless Inter‑Domain Routing replaces the old class A/B/C system. In an address like 10.100.122.2/24, the /24 indicates that the first 24 bits form the network prefix and the remaining 8 bits identify the host. The network address is obtained by zero‑ing the host bits ( 10.100.122.0), the broadcast address by setting them to 1 ( 10.100.122.255), and the subnet mask is 255.255.255.0.
Example: Calculating network parameters for 16.158.165.91/22
The /22 prefix means the first 22 bits are network bits. Converting the third octet (165) to binary gives 10100101. The first 6 bits belong to the network, the last 2 bits are host bits.
Network address: 16.158.164.0 (binary 10100100 for the third octet, host bits zero).
Subnet mask: 255.255.252.0 (binary 11111100 for the third octet).
Broadcast address: 16.158.167.255 (binary 10100111 for the third octet, host bits set to 1).
Public vs Private IPv4 Ranges
Private address blocks are reserved for use inside organizations and may be reused across different networks. Common private ranges:
10.0.0.0/8 172.16.0.0/12 192.168.0.0/16Public IP addresses are globally unique and must be allocated by an Internet registry for services that need to be reachable from the Internet.
MAC Addresses
The MAC address ( fa:16:3e:c7:79:75) is a 48‑bit hardware identifier expressed in hexadecimal. It is unique to the network interface and is used only within the same Layer‑2 broadcast domain. MAC addresses do not provide routing information; they are analogous to a hardware “ID card”.
Interface Flags and Queueing Discipline
Flags such as UP (interface enabled), BROADCAST (supports broadcast), MULTICAST (supports multicast), and LOWER_UP (physical link present) describe the operational state. The qdisc pfifo_fast scheduler maintains three priority bands; packets are dequeued FIFO within each band, with band 0 having the highest priority.
Key Points
IP addresses provide network‑level location; MAC addresses identify a physical interface within a local segment.
CIDR notation ( /n) defines the network prefix length and enables flexible subnetting.
Private IPv4 ranges can be reused internally; public addresses require global allocation.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
