To deliver data, a network needs to know where it is going. Hosts use several kinds of address at once.
MAC addresses
A MAC address identifies a network interface on its local link. An Ethernet MAC is 48 bits, written as six hexadecimal pairs such as 52:54:00:12:34:56. It is usually set by the manufacturer, but software can change it. Routers do not carry it beyond the local network.
IPv4 addresses
An IPv4 address is 32 bits, written as four decimal numbers from 0 to 255, such as 192.168.1.20.
Prefixes
An address is paired with a prefix length. In 192.168.1.20/24, the first 24 bits identify the network and the remaining 8 identify the host. The older netmask way of writing /24 is 255.255.255.0.
So 192.168.1.20 and 192.168.1.99 are on the same /24 network, while 192.168.2.5 is not. In a normal /24, .0 is the network address and .255 the broadcast address, leaving 254 for hosts. The subnetting guide goes further.
Special ranges
RFC 1918 sets aside private IPv4 ranges, which are not routed on the public internet:
10.0.0.0/8172.16.0.0/12192.168.0.0/16
127.0.0.0/8 is loopback. 169.254.0.0/16 is link-local, often seen when a host could not get an address automatically. A router performing NAT lets many private hosts share a public address.
IPv6
An IPv6 address is 128 bits, written as groups of hexadecimal digits separated by colons. Leading zeros in a group can be dropped, and one run of all-zero groups can be written as ::.
2001:0db8:0000:0000:0000:0000:0000:0001
2001:db8::1Loopback is ::1. Addresses starting fe80: are link-local.
Try it
$ ip address show dev enp1s0
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> ...
link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.20/24 brd 192.168.1.255 scope global enp1s0
inet6 fe80::5054:ff:fe12:3456/64 scope linkUse your own interface name, found with ip link. Pick out the MAC (link/ether), IPv4 (inet) and IPv6 (inet6) addresses, and check whether your IPv4 address is private.
Check your understanding
Network Addressing
All 4 sections ยท no timer
Unlimited retries
Questions from every section are combined into one assessment. Answer them all correctly to complete the article.
Your completion saves in this browser. Sign in to sync it to your account.