The host's own view — checking IP settings on any OS
When a host can't reach the network, the first step is to read its IP, mask, gateway, and DNS — without logging into the switch. Each OS has a different command. This chapter is the reference.
What you'll learn
- Read IPv4/IPv6 address, mask, and gateway on Windows.
- Read the same on macOS and Linux.
- Spot APIPA (169.254.x.x) and what it tells you.
Windows — ipconfig
Read four lines, in this order: IPv4 Address, Subnet Mask, Default Gateway, DNS Servers. Together they answer the four questions every host must get right: who am I, which addresses are local, where do I send everything else, and who turns names into addresses.
The DHCP Server line tells you the address was leased, and from which server. The two IPv6 lines, a global address and a link-local one ending in %5, are explained later in this chapter.
C:\> ipconfig /all
Ethernet adapter Ethernet:
IPv4 Address . . . . . . . . . . . : 10.0.0.42
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 10.0.0.1
DHCP Server . . . . . . . . . . . : 10.0.0.1
DNS Servers . . . . . . . . . . . : 8.8.8.8, 1.1.1.1
IPv6 Address . . . . . . . . . . . : 2001:db8::42
Link-local IPv6 Address . . . . . : fe80::1234%5
C:\> ipconfig /release
C:\> ipconfig /renew
C:\> ipconfig /flushdns
C:\> route print
C:\> netsh interface ipv4 show configmacOS — ifconfig + networksetup
macOS prints the mask in hexadecimal. In netmask 0xffffff00 each pair of hex digits is one octet: ff is 255 and 00 is 0, so the mask is 255.255.255.0, a /24. In the same way 0xfffffe00 is 255.255.254.0, a /23, because fe is 11111110 in binary: seven mask bits in the third octet.
On the inet6 line, prefixlen 64 is the IPv6 prefix length, /64, and autoconf means the Mac built that address itself from its router's advertisement rather than receiving it from a server.
$ ifconfig en0
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
inet 10.0.0.42 netmask 0xffffff00 broadcast 10.0.0.255
inet6 2001:db8::42 prefixlen 64 autoconf
ether aa:bb:cc:dd:ee:ff
$ netstat -nr | head # routing table
$ scutil --dns # DNS servers
$ networksetup -getinfo Wi-Fi9 more sections in this chapter, plus a 4-question quiz and a hands-on lab.
Create a free account to read Chapter 1.7 — The host's own view — checking IP settings on any OS
You can see the title, summary, and learning objectives. To read the chapter and build the labs, create a free account — Module 1 is fully readable on the free plan.
- Read every chapter in Module 1 — How Networks Work
- Save labs of up to 5 devices
- Save up to 3 topologies
- See the full course syllabus + chapter titles
Free account · no card required · compare plans any time
Build it step by step
- One router, one PC, one pingBuild the smallest network that works: address a router and a PC on the same subnet and get a reply back. · 5 steps · ~10 min · 2 devices
- ARP and MAC learning, side by sideWatch a host's ARP cache and a switch's MAC table fill from the very first frame — and see why a host never ARPs for anything beyond its gateway. · 5 steps · ~14 min · 4 devices
- Two LANs, one routerPut a PC on each of two different subnets and make them talk through a router. · 7 steps · ~12 min · 3 devices
- Let the router hand out the addressesBuild a four-device office LAN, address one PC by hand, then put a DHCP pool on the router so the next machine configures itself. · 6 steps · ~15 min · 4 devices
- Fix it: Fix the broken officeNobody in a two-desk office can reach the intranet server. Find the two faults and fix them, one layer at a time. · 6 steps · ~12 min · 5 devices
- Fix it: Fix the desks DHCP forgotThe clinic's desks come up with no address. Find why the DHCP server never hears them — then why their leases still go nowhere. · 6 steps · ~16 min · 5 devices
- Fix it: Fix the branch that fails four waysA branch depot has lost head office, and two of its hosts have faults of their own. Find all four, one layer at a time. · 10 steps · ~30 min · 7 devices