Skip to main content
added 13 characters in body; edited title
Source Link
Ron Maupin
  • 101.1k
  • 26
  • 123
  • 199

Get MAC address of first network devicedirectly connected to pcnetwork neghbor

I have a pcPC (in the successive diagrams pc1) equipped with a network interface that can be directly connected to another pcPC or to a managed switch.

I want to be able to get the MAC address of the closest device ofin the network.

Just to be more precise:

Situation #1

+-----+       +----------------+       +---------------+
| pc1 |-------| managed switch |-------| other devices |
+-----+       +----------------+       +---------------+

In this case, I want to get the macMAC address of the managed switch.

Situation #2

+-----+       +-----+
| pc1 |-------| pc2 |
+-----+       +-----+

In this case, I want to get the mac address of pc2.

What can I use to retrieve the MAC address of the first network device?

Update

As far as I know, I cannot use ARP, because in PC1's ARP table, I'll see all the MAC addresses related to the IP addresses on the ethernet segment. But, but I have no way in general to know the IP address of the device at the other end of the cable (this is painful in the case of the switch). This is why I am looking for something like ping at datalinkthe data link layer with a TTL of 1.

Get MAC address of first network device connected to pc

I have a pc (in the successive diagrams pc1) equipped with a network interface that can be directly connected to another pc or to a managed switch.

I want to be able to get the MAC address of the closest device of the network.

Just to be more precise

Situation #1

+-----+       +----------------+       +---------------+
| pc1 |-------| managed switch |-------| other devices |
+-----+       +----------------+       +---------------+

In this case I want to get the mac address of the managed switch

Situation #2

+-----+       +-----+
| pc1 |-------| pc2 |
+-----+       +-----+

In this case I want to get the mac address of pc2

What can I use to retrieve the MAC address of the first network device?

Update

As far as I know, I cannot use ARP, because in PC1's ARP table I'll see all the MAC addresses related to the IP addresses on the ethernet segment. But I have no way in general to know the IP address of the device at the other end of the cable (this is painful in the case of the switch). This is why I am looking for something like ping at datalink layer with a TTL of 1.

Get MAC address of directly connected network neghbor

I have a PC (in the successive diagrams pc1) equipped with a network interface that can be directly connected to another PC or to a managed switch.

I want to be able to get the MAC address of the closest device in the network.

Just to be more precise:

Situation #1

+-----+       +----------------+       +---------------+
| pc1 |-------| managed switch |-------| other devices |
+-----+       +----------------+       +---------------+

In this case, I want to get the MAC address of the managed switch.

Situation #2

+-----+       +-----+
| pc1 |-------| pc2 |
+-----+       +-----+

In this case, I want to get the mac address of pc2.

What can I use to retrieve the MAC address of the first network device?

Update

As far as I know, I cannot use ARP, because in PC1's ARP table, I'll see all the MAC addresses related to the IP addresses on the ethernet segment, but I have no way in general to know the IP address of the device at the other end of the cable (this is painful in the case of the switch). This is why I am looking for something like ping at the data link layer with a TTL of 1.

added 387 characters in body
Source Link

I have a pc (in the successive diagrams pc1) equipped with a network interface that can be directly connected to another pc or to a managed switch.

I want to be able to get the MAC address of the closest device of the network.

Just to be more precise

Situation #1

+-----+       +----------------+       +---------------+
| pc1 |-------| managed switch |-------| other devices |
+-----+       +----------------+       +---------------+

In this case I want to get the mac address of the managed switch

Situation #2

+-----+       +-----+
| pc1 |-------| pc2 |
+-----+       +-----+

In this case I want to get the mac address of pc2

What can I use to retrieve the MAC address of the first network device?

Update

As far as I know, I cannot use ARP, because in PC1's ARP table I'll see all the MAC addresses related to the IP addresses on the ethernet segment. But I have no way in general to know the IP address of the device at the other end of the cable (this is painful in the case of the switch). This is why I am looking for something like ping at datalink layer with a TTL of 1.

I have a pc (in the successive diagrams pc1) equipped with a network interface that can be directly connected to another pc or to a managed switch.

I want to be able to get the MAC address of the closest device of the network.

Just to be more precise

Situation #1

+-----+       +----------------+       +---------------+
| pc1 |-------| managed switch |-------| other devices |
+-----+       +----------------+       +---------------+

In this case I want to get the mac address of the managed switch

Situation #2

+-----+       +-----+
| pc1 |-------| pc2 |
+-----+       +-----+

In this case I want to get the mac address of pc2

What can I use to retrieve the MAC address of the first network device?

I have a pc (in the successive diagrams pc1) equipped with a network interface that can be directly connected to another pc or to a managed switch.

I want to be able to get the MAC address of the closest device of the network.

Just to be more precise

Situation #1

+-----+       +----------------+       +---------------+
| pc1 |-------| managed switch |-------| other devices |
+-----+       +----------------+       +---------------+

In this case I want to get the mac address of the managed switch

Situation #2

+-----+       +-----+
| pc1 |-------| pc2 |
+-----+       +-----+

In this case I want to get the mac address of pc2

What can I use to retrieve the MAC address of the first network device?

Update

As far as I know, I cannot use ARP, because in PC1's ARP table I'll see all the MAC addresses related to the IP addresses on the ethernet segment. But I have no way in general to know the IP address of the device at the other end of the cable (this is painful in the case of the switch). This is why I am looking for something like ping at datalink layer with a TTL of 1.

Source Link

Get MAC address of first network device connected to pc

I have a pc (in the successive diagrams pc1) equipped with a network interface that can be directly connected to another pc or to a managed switch.

I want to be able to get the MAC address of the closest device of the network.

Just to be more precise

Situation #1

+-----+       +----------------+       +---------------+
| pc1 |-------| managed switch |-------| other devices |
+-----+       +----------------+       +---------------+

In this case I want to get the mac address of the managed switch

Situation #2

+-----+       +-----+
| pc1 |-------| pc2 |
+-----+       +-----+

In this case I want to get the mac address of pc2

What can I use to retrieve the MAC address of the first network device?