0

These days I'm in a "self learning" about a packet switching networking includes TCP, UDP, & other protocols. I have confirmed that the sender's MAC address couldn't be sent directly to receiver since the packets tend to travel via several routers (where a WAN).

But in a LAN, I assumed similar scenario, let's assume there is one router for two terminals, those are contacting a simple 'TCP chat' - designed in Java. (I'm not going to give it's code). I have designed a simple "packet sniffer" in java (by using jpcap) which extracts the MAC addresses from each "packet header" and put them in a text file as follows...

Destination MAC: ##:##:##:##:##:##           /*My Terminal's MAC*/
Source MAC: ##:##:##:##:##:##        /*Sender's Terminal's MAC*/

O.K..? Now... My doubt is... in the above data, I found that the router's MAC are not included...! When my terminal is the receiver, which has that packet sniffer, therefore I can directly see the sender's MAC address above..!

But my argument is... there is a router (in a LAN) in between the sender & receiver no..? Then why the above code doesn't show that router's MAC instead of showing the sender's MAC..?

But, when I executed my 'packet sniffer' when I connected to Google via a Browser, I observed the above data is viewed a as follows...

Destination MAC:  ##:##:##:##:##:##  /* My LAN-Router's MAC */
Source MAC: ##:##:##:##:##:##  /* My Terminal's MAC */

Here I can see my LAN-Router's MAC...!

Anybody could explain why I can't see the LAN-Router's MAC when I contact via a TCP Chat with a peer in a LAN...?

Thanks in advance..!

1 Answers1

0

The way in which web browsing and chat connect are (generally) different. When you connected to Google, you didn't connect directly to the IP address of Google (though you could also do that), but probably www.google.com -- which requires DNS to determine the IP address that the HTTP request should be sent to. When you use TCP chat, you're headed straight to the TCP chat on someone else's machine.

jedison
  • 908
  • 6
  • 15
  • Of course Sir.But whatever the way,a computer which is in a LAN,initially has to contact it's adjacent device (usually a router,hub,switch etc),then via that device the packets are being sent,isn't? Therefore whatever the packet came to that computer(let's say 'from a WAN') has to bear that device's MAC address as the "sender's MAC address",No? But when it is a LAN, I observed above adjacent device's MAC, hadn't been included in the packet which was sent from a peer (who was in the LAN) via that adjacent device,but the peer's MAC had been included. How it was happened ? – Gajen Dissanayake Apr 27 '14 at 12:13
  • No, not necessarily. When I send TCP/IP packets to IP address xxx.xxx.xxx.xxx, then those go to that IP address -- the MAC address may be included. When I send TCP/IP packages to www.google.com, then I have no idea what the MAC address is for Google -- I must put in the MAC address of the DNS server. – jedison Apr 27 '14 at 17:23
  • Yeah Sir,Even we don't have idea about our ISP's MAC address too. Through the "packet sniffing",we can trace up to the "adjacent router's MAC address" only. (Further we can use 'tracert' DOS command for IPs but not for MAC) Then could I decide, "a router tend to put its MAC address instead of a LAN-client's MAC (on each packet) when it connects to a WAN... but in case of LAN, the router doesn't and just passes the packets between sender and receiver". Isn't Sir..? – Gajen Dissanayake Apr 28 '14 at 10:20
  • Yes, that would be the case. – jedison Apr 28 '14 at 10:32
  • Sir... I learnt further from here... http://networkengineering.stackexchange.com/a/5339/5468 – Gajen Dissanayake Apr 29 '14 at 15:59