So I'm revising for a Networking exam and struggling to understand IP routing. If I explain how I understand it, could you tell me where I'm right and where I'm wrong? I'd really appreciate it. Here's how I see it:
- Hosts ARPs for gateway (if needed).
- Host sends request to gateway. Ethernet frame has the gateway MAC address for it's destination, but the internal IP packet has the destination address of the server that is ultimately trying to be reached.
- Gateway compares the IP packet destination address to the IP address prefixes in it's route table. If one matches, it sends it down that port. Every subsequent server does the same and in a well-established route every one of them will have an address prefix matching the destination to some degree and will send it on down this familiar path.
- If the gateway doesn't have an address prefix that matches the destination address, then it begins routing. It uses an Internal Gatewway Protocol (IGP) such as RIP or OSPF to ask it's neighbours within it's Autonomous System (AS)(most likely a Transit AS belonging to your ISP), "do you know where this is?".
- This message is passed around within the AS until one of the gateways recognises a part of the network prefix, such as perhaps the region of the address, and has a vague notion of where to send it on.
- That gateway will then use an External Gateway Protocol (EGP) such as BGP to communicate with the AS(es?) that it's linked to and ask them for routing information.
- One of these may recognise the second block and be able to route it further in the correct direction
- Eventually a gateway will use EGP on the AS that owns the destination address and that target gateway will reply yes, I can get there in n hops.
- This message follows back through the path, each hop adding one to the length until it gets back to our original gateway that now knows of a path of y hops to get to the destination.
- It will add this to it's routing table, wrap the IP packet in a new ethernet frame with a destination address of the first hop on this path and send it on it's way.