Uploaded by bassma dahmali

CCNP-ENCORE

advertisement
I.
LAYER 3 Forwarding:
1. Bitwise XOR / AND Operation:
How PC determine if a packet should be forwarded to the default gateway, or if it can directly forwarded it to the
destination host?


Source & destination in the same subnet = Forward directly.
Source & destination aren’t int the same subnet = Forward to the default gateway.
Two determine this, two operation are work XOR & AND.
XOR: is used to compare the bits of the source IP and destination IP.
-
If two bits are the same the result is 0, if two bits are different the result is 1.
Example (source IP = 192.168.1.50/24, destination IP = 192.168.1.12)
192.168.1.50 = 11000000.10101000.00000001.00110010
192.168.1.12 = 11000000.10101000.00000001.00001100
XOR RESULT = 00000000.00000000.00000000.00111110
After XOR operation, the AND operation is performed.
AND: compares bits of two numbers and will give 1 if both bits are 1, if either or both of bits are 0 it will give 0.
The sending host uses the AND operation to compare the XOR result and its own subnet mask.
Let’s continue with the example (source IP = 192.168.1.50/24, destination IP = 192.168.1.12).
XOR RESULT = 00000000.00000000.00000000.00111110
Subnet Mask = 11111111.11111111.11111111.00000000
AND RESULT = 00000000.00000000.00000000.00000000
If AND Result = 0 that’s means the destination IP is in the same subnet, if AND Result = 1, that’s mean the
destination IP is in different subnet.
2. Forwarding IP packet within a LAN.



When a host is sending a packet to an IP in the same subnet, there is no need to send it to default
gateway, it send it directly to the destination HOST.
The packet will be encapsulated in an ETHERNET frame, and destination MAC address will be the
destination host’s MAC address.
The sending host will check the ARP cache to defines the mac address that belong to the destination IP, if
there is no entry, it will send an ARP request.
3. Routing IP packets between networks.
When the XOR/AND indicate that the packet is in another network, the source host will send the packet to its
default gateway.
When the router receives the frame/packet it will change the destination mac address to that of next-hop router,
and the source mac address will be the router interface.

It will also decrement the IP TTL. To prevent LOOP.


It will also recalculate the IP header checksum.
It will also recalculate the ETHERNET FCS.
4. Layer 2 VS Layer 3 Forwarding decisions:
1.
Layer 2 forwarding decision involve looking for an exact match mac address in the mac address table.
2.
Layer 3 forwarding decisions involve looking for the most specific match in the routing table. (Partial
match are OK). Most specific match = the highest prefix.
Configuring IPV4 Addresses.
Address Resolution Protocol (ARP)
Download