yohannist
yohannist

Reputation: 4204

Finding the IP and MAC address of DNS Server and Gateway

Hello I am trying to programmatically(C++) find the Gateway IP and DNS Server IP and their MAC address of a local network. Do you have any suggestions on how to do that? Also is there a way to do it using WinPcap? Code samples would be great.

Upvotes: 1

Views: 2041

Answers (2)

yohannist
yohannist

Reputation: 4204

Well i did what ihor and Sp. suggested to find the IP addresses and then by using winpcap, crafted an ARP Request to the DNS server to get its MAC and processed the ARP reply.

Upvotes: 0

Ihor Kaharlichenko
Ihor Kaharlichenko

Reputation: 6260

Since you mentioned winpcap I conclude that you are on Windows. Thus you need WinAPI to retrieve your info.

Take a look at Retrieving Information Using GetNetworkParams article it contains all steps you need to get what you want.

P.S.: There's nothing to do with winpcap though.

Upvotes: 4

Related Questions