Networking Key Concepts
Networking Key Concepts
Network Basics
- Home Network:
- Devices like computers, laptops, mobile phones, and IoT devices (PlayStation, cameras). Connect to a wireless router.
- The wireless router connects to an Internet Service Provider (ISP).
- The ISP link connects the home network to the global network.
- Router: A device that connects different networks and directs data packets between them.
- Links:
- Physical links: Tangible connections.
- Ethernet cables.
- Fiber optic cables (buried underground).
- Coaxial cables (older type).
- Wireless links:
- WiFi.
- Cellular networks (towers).
Network Scale
- Small Business Network:
- Multiple offices or departments connected via a switch.
- Example: Offices, printer rooms connected by switches.
- Switch: A device that connects multiple devices (computers, printers, servers) within the same local area network (LAN).
- LAN (Local Area Network): A network connecting devices in a limited area. A home network is also a LAN.
- Medium and Large Networks:
- Example: University network with different departments or schools.
- Departments connect to routers, and then to the main gateway connecting to the Internet.
- Worldwide Network: A simplified representation of the Internet, with all networks connected by routers and links.
Network Components
- End Nodes (Hosts): Devices at the end of the communication.
- Examples: Computers sending or receiving data.
- Intermediate Nodes: Routers and switches that transfer or forward data packets through the network.
- Network Composition: Nodes (end nodes and intermediate nodes) and links.
Network Communication
- The process of exchanging data between devices (computers, phones, servers) connected through a network.
- Example: Host A sends a "hello world" message to Host D.
Message Transfer Methods
- Circuit Switching:
- A dedicated physical path is established between two devices.
- Analog phone calls are an example of circuit switching.
- Packet Switching: This is the method used on the Internet.
- Data is broken into small pieces called packets.
- Each packet is sent separately through the network and may take different paths to reach the destination.
- Once all packets arrive, they are reassembled in the correct order to recreate the original message.
Packet Switching Details
- Imagine sending an email from New Zealand to the UK.
- The email is broken into packets, like putting items into several boxes for postal delivery.
- Each packet contains a portion of the data (e.g., four characters) and the destination address.
- Packets may take different routes through the network based on traffic conditions.
- Packets may arrive at the destination out of order, at different times, or some may get lost or corrupted.
- The destination node reorders the packets to recreate the original message.
Addressing
- Computers are identified by their addresses.
- Two Addressing Schemes:
- IPv4 (Internet Protocol version 4).
- IPv6 (Internet Protocol version 6).
IPv4
- Uses a 32-bit number.
- The address is represented as four decimal values.
- 2^8 = 256
- Example Binary to Decimal Conversion:
- 100000002 = 128{10}
- 100000102 = 130{10}
- Assigned to network interface cards (NIC).
- Logical address (can be changed dynamically).
- Number of possible IPv4 addresses: 2^{32} \approx 4.3 billion.
- Original IPv4 design in 1981 did not foresee the growth of the Internet.
IPv6
- Increases address space using 128 bits.
- Number of possible IPv6 addresses: 2^{128} \approx 3.4 \times 10^{38}, or 340 undecillion addresses.
- Sufficient for every grain of sand on Earth to have an IP address.
Discovering IP Addresses
- Windows: Use
ipconfig command. - The output displays DNS suffixes, IPv6 address, IPv4 address (often a private address), and default gateway (router IP).
- Private addresses (starting with 10) are not visible outside the local network.
Domain Names
- Instead of using IP addresses directly, we use friendly names (domain names) like
www.waikato.ac.nz or www.google.com.
DNS (Domain Name System)
- Associates domain names with IP addresses.
- Examples:
- Facebook's IPv4 and IPv6 addresses.
- TradeMe's IPv4 addresses.
- Google's IPv4 and IPv6 addresses.
- The name that is tied to the IP address.
- It's impractical to use the IP address directly, so we assign them names that are friendly.
NSLOOKUP
- A utility to look up the IP address of a domain name.
- On Windows, use
nslookup domain_name. - On Linux/Mac, use
host domain_name. - The query contacts a DNS server, which maintains a mapping table of domain names to IP addresses.
- The DNS server returns the name, address, and aliases associated with the domain.
- DNS servers can query other DNS servers to find mappings if they don't have the entry in their table.
- The process of resolving friendly names to IP addresses is the core function of DNS.
- ISPs typically host DNS servers.
Port Numbers
- A way to differentiate between different services running on a single computer.
- Communication happens with software running on a computer (e.g., web server, email server).
- Port numbers identify the specific service or application.
- Port numbers are 16-bit numbers (0-65535).
- Port numbers 0-1023 are reserved for common protocols and services.
- Higher port numbers are dynamically assigned.
- Examples:
- 80: Web server (HTTP)
- 22: Secure Shell (SSH)
- 21: File Transfer Protocol (FTP)
- Netstat: A utility to view active network connections and the port numbers in use.
Protocols
- Rules and procedures that govern how computers communicate.
- They specify message formats and actions.
- Network protocols often end with "P" (e.g., IP, HTTP).
- Protocols are organized in layers, forming a stack.
- They add headers and trailers to describe the protocol of that layer.
Protocol Stack (Five Layers)
- Application Layer: HTTP, SMTP, etc.
- Transport Layer: TCP, UDP.
- Network Layer: IP.
- Data Link Layer: Ethernet, Wi-Fi.
- Physical Layer: Cables, wireless signals.
- Each layer communicates with its peer layer on the other host using a specific protocol.
- Data at each layer is encapsulated with headers and trailers relevant to that layer.
Example Data Transmission
- Host A sends an email to Host B.
- The email application divides the data into segments (TCP).
- TCP adds a header to the segment.
- The segment forms an IP packet with an IP header.
- The packet goes to Ethernet and gets an Ethernet header.
- The data is transmitted as a bit stream through the Internet.
- Routers use the IP address to determine the path.
- At the destination, headers are removed layer by layer until the application data is reached.
- Reassembling of packets (if out of order) happens at the TCP layer.
- The operating system implements these protocols.
Wireshark
- A tool to capture and examine network packets.
- Can capture packets traveling through the NIC.
- Allows you to see the headers and contents of packets (though encrypted content will be unreadable).