c - What should the destination mac address be set to when sending packet outside of your local network? -


If I use arp and ankle on machines in my local network, then they get MAC addresses. I can build and send an ARP request and collect responses to these machines. It is used since then since I make raw packet fully wavy (to allow spoofing of all possible areas, with MAC address, if necessary). But, when I try arcping or ARP on external IP and such a host like google.com does not get any response. What should the destination MAC address be set to send packets to the target outside of its local network? I think that since he passes it, since then it seems to be a router ... am I right? Is there a quick way in ANSI C to collect the MAC address of the router in use by the computer? Or at least IP then I can send an ARP request for this.

Thanax Advance

Mac operations are limited to machines directly connected to your subnet You should use the router's MAC address for packets to host outside of your subnet.

There are several ways to get the router's IP address.

  1. If you parse the configuration files on your local host, the interface is statically configured.

  2. You can see that your compute platform has an API that lets you access the interface configuration information directly. This static and DHCP will work in both cases.

  3. You can write a socket code to send an ICMP message to an external address, then you can parse the incoming responses. They will be from the router. Stack, in this case, will search the router for you.


Comments