IPv4 & IPv6 Addressing and Routing Foundation
IPv4 Addressing
IPv4 addresses are 32 bits and presented in 4 octets separated by a dot. Addresses must be unique, else traffic destined to one host address could end up at another host.
IPv4 address is made up a subnet and host address. Before communicating which each other, hosts and devices must establish where to forward the L2 frames.
Looking at below topology, PC1 wants to sent packets to PC2. So should the packets be sent PC2 directly or the gateway R1 address 10.1.1.1 ?
The following sequence or set actions takes place, before any packet or frames are forwarded.
If PC2 is on the same subnet, PC1 will send the frames directly to PC2. In this case PC1 sends an ARP request for PC2 MAC and obtains the MAC address associated with 10.1.1.20.
However, if PC2 happens to be on a different subnet. Then, PC1 will send the frames to its default gateway, 10.1.1.1 on R1. Here, PC1 must also use ARP to resolve R1 MAC address.
Packet-Forwarding Process
Moving on to a slightly more complex topology. Here, PC1 wants to browse a page on Server 1, which happens to be 2 hops away and attached to R2 via a LAN switch. The principles remains the same. PC1 must 1st establish where to forward the frames. Directly to Server 1 or to a default gateway on R1.
Let’s follow the packet forwarding process and how frames are built at each step.
PC1 to R1
PC1 determines that packets must be sent to its default gateway on R1, and ARPs for 192.168.1.1. When MAC address of R1 is received, a frame is built using PC1 SRC IP and R1 as destination. Equally, SRC MAC will be PC1 and DST R1 gateway interface.
R1 to R2
When R1 received the frame, it strips the L2 header and examines the information on L3 header. Based on this, 2 things happen:
- TTL is decremented by 1, and if the result is zero, the packet is then dropped and a “time-exceeded” message is sent to the source.
- Routing table is referenced and in our case, outbound interface is a P2P serial link towards R2.
- L3 packet is encapsulated with PPP header and forwarded to R2.
R2 to Server 1
R2 strips the PPP header and performs the the same steps as R1. Seeing that Server is directly connected, its ARPs for Server 1 MAC address associated with 192.168.3.1. Based on this information, a frame is built and delivered to Server 1.
DHCP for IPv4
IPv4 addresses can be added manually, but in large scale deployment and for ease of administration, Dynamic Host Configuration Protocol (DHCP) is used. DHCP assigns IP addresses dynamically, when requested by hosts. In this sense, hosts also includes routers, such as your home router, where the ISP assigns a public IP address and get you online.
The operation of DHCP is a 4 steps process:
- Host comes up and sends a DISCOVERY for an IP address as a broadcast message.
- DHCP server responds with an OFFER (Broadcast message).
- Host responds to the OFFER with a REQUEST, formally 9requesting the IP address.
- DHCP Server responds with an ACK
But what happens when the DHCP server is not on the same LAN as the client. Remember, routers do not forward broadcasts and therefore an additional configuration is needed to allow the router receiving the broadcast to send it as a Unicast to the DHCP server. The command “ip helper-address” must be added to the client facing interface.
See below example:
Cisco routers and multilayers switches can also act as DHCP servers. This can be done by defining an IP DHCP pool, then defining the range to be assigned, also called DHCP scope and relevant parameters, such as default gateway & DNS servers.
For more information on packet capture details, see: https://networkslearning.com/understanding-dhcp/
IPv6 addressing
IPv6 for the purpose of this paragraph can be categorised in the following types:
- Unicast
- Multicast
- Anycast
These categories have the same functionality as in IPv4. You would notice that Broadcast is missing, there is no broadcast in IPv6. We will later see how this is replaced by a more efficient process.
Unicast scope can in turn be classified as:
- Global Unicast
- Link Local
- Loopback
IPv6 addresses are 128bits long, presented in the form of 8×16 bits block, written in HEX. An IPv6 address is made a Prefix or Subnet ID +A Host or Interface ID.
To shorten the 128 bits, leading zeros can be dropped and a sequence of zeros can be replaced by “::” but note this can be done only once. IPv6 addresses can be added to hosts and nodes/interfaces manually or dynamically.
EUI-64
Hosts and nodes in IPv6 addressing are typically a /64, so 64 bits prefix ID and 64 bits Interface or host ID. With EUI-64, a host assign itself an IPv6 address based on the IEEE EUI-64 standard.
To create the interface ID, the host uses its own MAC address (48 bits) and converts it to a 64 bits ID. This is done in these steps:
- Split MAC address in 2 halves.
- Insert FF FE in between.
- Flip the 7 bits (1 becomes 0 and 0 becomes 1).
The following drawing illustrates the process.
Below is from a lab where a PC and a router generate their own 64 bits host IDs. On hosts EUI-64 is enabled by default, however on Cisco routers, “enable IPv6” must be added under the interface configuration.
SLAAC
Stateless Address Auto Configuration enables a device to configure its own IPv6 address and default gateway. The process is as follows:
- Host or node sends a Router Solicitation message RS to discover which router is on local link. This is a multicast to all IPv6 routers FF02::2.
- Router responds with a Router advertisement RA as multicast to all IPv6 devices FF02::1 and includes the prefix ID.
- Host uses the information and EUI-64 to constructs its IPv6 address.
- Default gateway will be the routers link local address.
See below illustration for more info:
Leave A Comment