IP and MAC replacement

Unanswered Question
Nov 18th, 2008

Can anyone tell me, how a router deals with IP and MAC adresses when routing?

Lets imagine, there is a router with 2 interfaces: and with MAC addresses A and B respectively. There are two computers C and D with ip addresses and, connected to the router's appropriate interfaces. What happens, when computer C ping computer D?

How I understand it, computer C takes routers mac address B as a destitanation MAC and computer's D IP for destination IP. Router, in its turn, replaces source IP address ( with its interface address ( and sends the packet to computer D with source MAC address of computer C.

When computer D returns ping, the packet is sent to the router's interface, as the packet was received with this IP address in the source field. How does router know, how to send this packet to computer C? By inspecting destination MAC address field?

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Mohamed Sobair Tue, 11/18/2008 - 02:36


computer c issue a ping with its own IP address as the source address.

Computer C , ARPs for the Destination address ( which is computer D.

Router A, tells computer C to send the data to its Own Mac-address (Mac address of Router A).

Router A receives the Packet, does routing lookup by consulting its routing table, finds a route to ( through router B.

Router A sends the Packet to RouterB Phisical media address (Mac address of router B) with the Source and Destination addresses unchanged.

Router B receives the Packet , consults its routing table, finds the host ( whis is directly connected host and sends the packet to the host.

Likewise, The same process happens for the returned path.

Keep in mind that during this process the (Source and Destination IP Address remains unchanged, Only Phisical media address is changed).



fgasimzade Tue, 11/18/2008 - 03:02

Thank you.

Now tell me why do I have to configure NAT, if one interface on the router is LAN, another is assigned a global IP for internet connection?

Mohamed Sobair Tue, 11/18/2008 - 03:14

Simply because private addresses are not routable through the Global Internet.

As defined in (RFC 1918), the bellow addresses are private addresses that should be translated to a public addresses in order to be routed to the internet:







This Discussion