Routing Example

This is a simple transmission between two end stations, through a single router. You can expand on this by adding multiple routers in the path, but the concept will be the same.
When any station wishes to transmit to another:
, it looks at the destination IP address to see whether it's on the same subnet - if so, it just uses ARP to find the MAC address of the destination. Otherwise, it sends it to the router, which is the default gateway in the TCP/IP stack (the settings).
For this example, Tom needs to remotely access Jack's machine via Telnet, so he sends a Telnet request to host Jack :
TOM's SENDS A PACKET TO THE ROUTER
1) Tom enters "telnet jack@acme2.com", and the PC's Process/Application layer assembles a "data" packet for the request
2) Tom's PC assembles a "message" packet by adding a TCP header (sequence, ack numbers, and application) to the connection request
3) Tom's PC assembles a "packet" packet by adding an IP header (IP source and dest. addresses). The IP address of Jack is found in Tom's host table, where the host name "jack@acme2.com" is mapped to the address 20.0.0.1 (if the address was not listed in the table, Tom's PC would send out an ARP broadcast for it).
4) Tom's PC sees that in the IP header, the source and dest. network addresses differ, and the packet must be sent through a router - so the correct router hardware address is found in Tom's routing table as 12.0.0.99 (if the address was not listed in the table, Tom's PC would send out an ARP broadcast for it).
5) Tom's PC assembles a "frame" by adding a MAC header (hardware source and dest. addresses, and CRC), and sends the following Ethernet frame to the router :
NOTE: Packets are Layer 3 (IP), Frames are Layer2 (Data-Link)

THE ROUTER SENDS FORWARDS THE PACKET TO JACK
6) The router examines the IP header of the frame from Tom, sees the destination is Jack.
7) The router looks in its own routing table for Jack's NIC protocol, and sends out an ARP to get Jack's hardware address.
8) The router replaces the MAC header and sends the following frame to Jack :

NOTE : Jack repeats steps 1-7 to send an ACK back to Tom, granting him Telnet access.