How does the router know the destination Mac address?

How to find IP address of device connected via ethernet

To answer this question you need to know how routers do the forwarding decisions.

I will do my best to make it simple but accurate as possible.

,Router have what is called u201cRouting Tableu201d which basically a list contains all the networks the router knows how to reach.

Routing tables are filled either manually or automatically.

Their routing table looks like this:,Whatu2019s this table represents are all the known networks and what is the next hop u201chop usually is another routeru201d to reach these networks.

For example, to reach network X you need to send the traffic to interface u201cportu201d 5.

Another example is, to reach any network send the traffic to the IP Z u201cZ represents another router that is connected directly to this routeru201d,I think you already noticed that the routing tables use IP addresses not MAC addresses to do routing decisions.

Does that mean that routers donu2019t need a MAC address?!.

No exactly, routers need to have the MAC address for only the devices that are directly connected to the router.

,Example:nRouter1 u2190u2192 Router2 u2190u2192 Router3nRouter1 will only know the MAC address of the port of the Router2 which itu2019s connected to it.

nRouter2 will know both Router1 and Router3 ports MAC addresses.

nRouter3 will only know the MAC address of the port which itu2019s connected to in Router2.

,Note that each interface u201cportu201d in the router has its own MAC address.

u201cthere are exceptions to this in case of built-in switch featuresu201d.

,How do routers know the MAC address of each device connected to it?nWhenever any device is connected to this router try to send any u201cpacketsu201d the router de-encapsulate this u201cpacketu201d and check the u201cSource MAC Addressu201d which is the MAC address of the device which sent this packet.

Then the router adds this MAC address in a table with the port it came from.

,Now combine these two together and you get the idea of how routers basically send and receive packets.

,Note that routers donu2019t know and donu2019t need to know the MAC address of any device but the devices connected directly to the router.

By directly I mean devices that are not separated from the router by another router.

For the devices separated by another router, it just needs the IP address to be able to communicate with these devices.

Example:,Router1 u201cport1u201d u2190u2192 u201cport1u201d Router2 u201cport2u201du2190u2192 Computer2Router1 u201cport1u201d : IP 192.

168.

1.

1 - MAC Address: 00:00:00:00:00:00,Router2 u201cport1u201d : IP 192.

168.

1.

2 - MAC Address: 11:11:11:11:11:11,Router2 u201cport2u201d : IP 10.

0.

0.

1 - MAC Address: 22:22:22:22:22:22,Computer2: IP 10.

0.

0.

2 - MAC Address: 33:33:33:33:33:33,When Router1 try to send packets to computer2, it uses this logic:,Source IP: 192.

168.

1.

1,Destination IP: 10.

0.

0.

2,Source MAC: 00:00:00:00:00:00,Destination MAC: 11:11:11:11:11:11,Did you noticed that Router1 used Computer2 IP address but Router2 MAC address!?This means the Router1 will send the packet through u201cport1u2033 to Router2 u201cport1u201d.

What happens next is Router2 inspect u201cde-encapsulateu201d the packet and by examining the u201cDestination IPu201d it will figure out that itu2019s sent Computer2.

Router2 will modify u201cde-encapsulate then encapsulateu201d the packet to be like:,Source IP: 192.

168.

1.

1,Destination IP: 10.

0.

0.

2,Source MAC: 22:22:22:22:22:22,Destination MAC: 33:33:33:33:33:33,Did you notice that the source and destination IP address are still the same but the source and destination MAC address were changed?If you want to learn more, read the u201cRelated Questionu201d I will add at the bottom of the answer.

,,If you are interested in computer networking.

if you are interested in working as a network engineer/technician or a role that is related to computer networking, I highly recommend studying the CompTIA Network+ cert.

It will teach you the networks fundamentals and basic troubleshooting skills.

CompTIA Network+ is your stepping stone to network field.

CompTIA Network+ is a vendor neutral networking certification that is trusted around the world.

It validates the essential knowledge and skills needed to confidently design, configure, manage and troubleshoot any wired and wireless networks.

CompTIA Network+ certified individuals are in-demand worldwide.

,Source: (IT) Information Technology CertificationsFor online training and study materials, I recommend AlphaPrep.

net.

AlphaPrep offers high quality self-study based materials at reasonable prices.

,Upvote if you find this useful.

,Comment if you have a question or something to share.

,Follow if you are interested in reading more about computers and networks.

,

How to find IP address of devices connected to router

This depends entirely on how they get their IP address.

,To be a bit of a pedant, when a computer connects to a network, itu2019s not actually connecting to your router.

All thatu2019s needed to connect to a network is bringing a link up and thatu2019s is.

It doesnu2019t even need an IP address.

,Routers, strictly speaking, are not actually devices meant for managing networks, but just connecting networks together.

,Home and small office routers combine so many things in one device, but it helps when explaining networks to actually make a distinction between a router, a DHCP server, a switch, a modem, a wireless access point, and a firewall.

These are all things infamously merged into one device in consumersu2019 minds.

,Still, in this case, I am assuming by u201cconnected to my routeru201d you mean u201cconnected to my network in some way.

u201d,The answer is that it really depends.

Most devices are probably getting an IP address from your router through its DHCP server.

In which case, the admin page of your router, provided itu2019s not provided by your ISP and thus not crippled in terms of management, will allow you to view the DHCP client tables.

Of course, youu2019ll need to know how to identify the device in the DHCP tables.

Sometimes itu2019s obvious.

Other times it isnu2019t.

Identify device by MAC address online

Media Access Control (MAC) addresses, also called Ethernet addresses, are 6-byte-long (48-bit-long) binary numbers.

For convenience, most computers list MAC addresses as 12-digit hexadecimal numbers.

,MAC addresses represent a single NIC or Ethernet port, so these addresses are often called a unicast Ethernet address.

The term unicast is simply a formal way to refer to the fact that the address represents one interface to the Ethernet LAN.

,Each device MAC Address should be unique in order to send/receive data successfully.

,Imagine MAC addresses like people addresses or phone numbers.

You canu2019t have two persons have the same MAC Address.

The thing about MAC address is that itu2019s only used in LANs.

Itu2019s an address that is only usable inside a local network.

You canu2019t send data to a device in a different network using itu2019s MAC as destination, but you can send data to devices in your local networks using MAC address as identifier.

,,For guys interested in learning computer networks but have no or very limited experience/knowledge in the field, I recommend starting with CompTIA Network+ course which will teach you networks fundamentals and basic troubleshooting skills.

If you are interested in learning and troubleshooting computers hardware and software, I recommend starting with CompTIA A+.

For high quality study materials and online training, I recommend AlphaPrep.

netUpvote if you find this useful.

,Comment if you have a question or something to share.

,Follow if you are interested in reading more about computers and networks.

,