Computer Networks: A Practical
Introduction
LANs, addressing, routing and basic troubleshooting
Purpose
A concise primer for readers who want to understand what happens when a computer communicates
across a local network and the Internet.
Independent learning notes | General educational use
Original educational sample Page 1
1. How a Local Network Works
A local area network (LAN) connects devices within a limited physical space such as a home, classroom
or office. The key idea is that devices do not need to understand the entire Internet. They only need a
local addressing system, a method for exchanging frames, and a gateway when traffic must leave the
local network.
Core components
- Endpoint: a laptop, phone, printer, camera or server that sends and receives data.
- Switch: forwards Ethernet frames inside the LAN according to MAC addresses.
- Router: connects different IP networks and usually acts as the default gateway toward the Internet.
- Access point: bridges wireless devices into the same local network.
- DNS resolver: translates names such as [Link] into IP addresses.
A useful mental model is to separate local delivery from routed delivery. If two machines are on the
same subnet, they normally communicate directly at Layer 2. If the destination lies outside the subnet,
the sender forwards the packet to the default gateway.
Addressing example
Device IPv4 address Role
Laptop [Link] User endpoint
Printer [Link] Local service
Router [Link] Default gateway
DNS [Link] Local forwarding resolver
Private IPv4 ranges such as [Link]/8, [Link]/12 and [Link]/16 are commonly used inside
LANs. They are not routed directly across the public Internet.
Original educational sample Page 2
2. From a Web Address to a Packet
Suppose a user enters a web address. Several small mechanisms cooperate before the page appears.
First, the system checks whether it already knows the destination IP. If not, it asks DNS. Then it decides
whether that IP is local or remote. A remote destination is sent to the gateway.
Simplified sequence
- The browser requests the IP address for the host name.
- DNS returns an IPv4 and/or IPv6 address.
- The operating system checks its routing table.
- If the destination is remote, the packet is encapsulated in a frame addressed to the router.
- The router forwards the packet toward the service provider.
- Return traffic follows a route back and is delivered to the original application.
ARP and neighbor discovery
On an IPv4 Ethernet network, Address Resolution Protocol (ARP) is used to discover the MAC address
associated with a local IPv4 address. For example, a laptop may know that its gateway is [Link]
but still need the gateway MAC address before it can send an Ethernet frame. IPv6 performs a related
function through Neighbor Discovery.
Ports and conversations
IP identifies hosts and networks, while transport-layer ports help identify applications. A web client may
create a temporary source port and connect to a server destination port such as 443 for HTTPS. The
combination of protocol, source address, source port, destination address and destination port
distinguishes a flow.
Layer Question answered Example
Application What service? HTTPS, DNS
Transport Which process? TCP/443, UDP/53
Network Which host/network? IPv4 or IPv6
Link Which local interface? Ethernet MAC
Original educational sample Page 3
3. NAT, DHCP and Common Troubleshooting
Home and small-office routers often combine several functions in one device. DHCP assigns
configuration to clients, NAT translates between private and public addressing, DNS forwarding relays
name queries, and a stateful firewall decides which traffic may cross the boundary.
DHCP in four ideas
- A client joins the network without a usable IPv4 address.
- It discovers a DHCP service and requests an offered configuration.
- The server leases an address plus options such as gateway and DNS.
- The client renews the lease periodically rather than treating the address as permanent.
Troubleshooting by layers
Symptom Check first Possible cause
No network at all Link/Wi-Fi association Cable, radio, authentication
Self-assigned address DHCP DHCP unreachable or pool exhausted
Can ping gateway only Routing/NAT WAN or upstream issue
Can ping IP, not name DNS Resolver configuration
One service fails Port/application Firewall or service down
A disciplined troubleshooting method changes one variable at a time. Start locally, verify addressing,
verify the gateway, test an external IP, then test DNS and finally the application. This reduces guesswork
and prevents unrelated configuration changes.
Basic diagnostic commands
Windows: ipconfig, ping, tracert, nslookup, route print, arp -a.
Linux/macOS: ip addr, ping, traceroute, dig/nslookup, ip route, ip neigh.
Original educational sample Page 4