开发者

about IP packet through router

I just finished a phone interview. The interviewer asked me a question:

Tell me about what happen about IP packet go through router.

It's been long time since I study networking. And I just say something about router transmission list and there are several router protocols such as OSPF etc. . that's it. Could anybody give a good answer to 开发者_StackOverflow社区this? or lead me check some resources? Thank you!!


I don't think a talk about a router would not be sufficient without talking about different physical (?) network separation. And I don't think much is required beyond that, honestly. Consider in terms of MAC addresses and IP addresses and how the IP packet changes between the "sides".

Routing topology building is, well, routing topology and changes how the packet may be forwarded, but it happens "along side" normal IP packet transmission.

Routers are also quite commonly used for NAT these days...

Happy ... networking?


A router is a network layer device. So, when it receives an IP packet, the IP packet current destination is set to that router. So, router does this:

  1. Checks the packet's final destination.
  2. From its routing table, it finds the the next hop router to reach that destination
  3. Adds that next hop router's address to that packet, sends it over to its link layer (which adds the frame header and trailer)
  4. Then, that packet is off to that next hop router.

This way, that packet sails off to its final destination

PS: I had taken a Computer Networking course last quarter


Every Router does two functions: Forwarding and Routing. Forwarding unit decides what should be done when a packet arrive. Routing is the act of creating routing table and announcing routes (Which routes have to be announced is based on routing protocol which is running on your router).

The interviewer want you to describe forwarding function of router:

Short Answer:

Router looks up in the routing table and find next hop (router). Then forward the packet to appropriate next hop.

Long Answer:

  1. Router Looks up destination IP address of the packet in Routing Table and finds longest prefix match entry.
  2. Extract next hop router from entry from previous step and finds MAC Address of the next hop. Then replace current destination MAC address of thee packet with MAC Address of next hop router.
  3. Reduces TTL one unit and replace it.
  4. Recalculates IP Header Checksum and replace it.
  5. Puts packet in Outgoing Queue of the interface connected to next hop router.

CAUTION 1: These are actions a simple router does when a packet arrive. Most of routers do other functions such as NAT,Forward Packet Through Tunnel, etc. Also an advanced router like Cisco routers does many functions when a packet pass through the router.

CAUTION 2: I have described only TCP/IP networks which use Ethernet as Linked Layer Protocol and IP as Network Layer Protocol. Other networks such as ATM, Frame Relay, etc has different forwarding steps.

P.S: You can find this context in CCAN books in short form and more details on CCNP Route books.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜