Network Fundamentals: MAC, IP, Routing, and Protocols
1.1. Addressing Physical Layer
To connect a computer to a network, you need a network interface card (NIC) with a unique Media Access Control (MAC) address.
- A MAC address is a 48-bit (12 hexadecimal digits) number.
- Each NIC must have a different MAC address.
- There are approximately 248 (281 trillion) possible MAC addresses.
1.2. Routing Logic and IP Addresses
Your machine uses an Internet Protocol (IP) address for routing. An IP address is composed of 32 bits, grouped into four 8-bit bytes (octets).
Example:
- Decimal notation: 192.168.34.6
- Binary notation: 11000000.10101000.00100010.00000110
Each machine connected to the internet is assigned an IP address or a hostname. When connecting to a machine, you can use either. For example, the IP address 213.123.121.21 might correspond to the hostname formacio.informatica.escola.es. The IP address components could represent:
- 213: Country
- 123: Organization
- 121: Department
- 21: Specific machine
Internet Operation
When you access a website (e.g., http://www.google.com), your computer converts the hostname to an IP address (e.g., 216.239.59.104). This IP address is then converted to binary (e.g., 11011000.11101111.00111011.01101000) for machine processing.
1.3. MAC Routing
MAC routing (or encaminament fĂsic) determines the target device to send information using MAC addresses. This requires a protocol like IPX. For two machines to communicate, they must use the same protocol.
Internetwork Packet Exchange (IPX)
IPX is a protocol that uses 48-bit MAC addresses instead of 32-bit IP addresses. It enables two machines to understand each other and transfer data correctly.
Overall Routing
Multiple routes are possible when two machines on different networks communicate. Choosing the right route is crucial because:
- Routes can be congested.
- Some routes may not offer sufficient bandwidth.
- Some routes may have high error rates (packet loss).
Connection-oriented protocols establish a path before transmitting data (like a phone call). Connectionless protocols send each packet independently, allowing it to take the best available path.
The most widely used internet transmission protocol is the connectionless Internet Protocol (IP). IP packets rely on routing tables for reliable delivery. A routing table contains information about connected networks, required for sending packets to their destination.
(Example network diagram with five computers and two routers. Networks: 192.168.11.0/24, 192.168.12.0/24, 192.168.21.0/24, 192.168.22.0/24)
The routing table includes information about connected networks and interfaces.
Internet Control Message Protocol (ICMP)
The ICMP protocol collects network information and transmits it to routers. This allows routers to know the network status and where to forward packets.
Address Resolution Protocol (ARP)
ARP is a network-level protocol responsible for mapping IP addresses to MAC addresses.
How ARP Works:
- A device sends an ARP request (a broadcast packet with MAC address FF:FF:FF:FF:FF:FF) containing the target IP address.
- The device with the matching IP address responds with an ARP reply containing its MAC address.
- Each machine maintains an ARP cache to reduce delays and network load.
ARP Usage Scenarios:
The data link layer works with MAC addresses. ARP translates IP addresses to MAC addresses using ARP tables. ARP is used in four scenarios:
- Two hosts on the same network communicating.
- Two hosts on different networks communicating through a gateway/router.
- A router sending a packet to a host through another router.
- A router sending a packet to a host on its network.
ICMP and Error Handling
The IP protocol is unreliable and connectionless. Reliable communication requires control mechanisms to handle issues like:
- Packet delivery failures.
- Errors during datagram transmission.
- Route discovery.
- Router buffer limitations.
The ICMP protocol was developed to address these issues, initially for reporting router errors.
ICMP packets are generated by the station that transmitted the original packet causing the error. Each packet has a limited lifetime to prevent network congestion. If a packet doesn’t reach its destination within this time, it’s destroyed, and an ICMP message is sent to the source.
Buffers
Buffers are memory devices in computers that temporarily store information for processing.