0

I'm creating an application that needs to track slave machines on the local network.

I came across this post: Set up to resolve local ips However, if the local ip assigned to the various hosts change, the application needs to update the ip it sends requests to. I'm currently thinking of creating a route table in my application's database that stores the MAC address? Then if the IP changes, the application would ask all other ip's in the same subnet what their MAC address is and change the route table? Is this the right approach?

4 Answers 4

3

You are reinventing ARP However that doesn't guarantee that you will not always have an up to date ARP table. You can always query DHCP assuming that's what you mean

if the local ip assigned to the various hosts change

Finally though what I suggest is plain old hostnames that will resolve to IP's because the DNS server will most probably be up to date

2
0

That is one way for sure.

Another way would be to have each slave register with the host with an id of some kind, such as its hostname: "This is my name, this is my IP". So if it changes it tells the host.

This is really a question for Stackoverflow though I believe.

0

If I understand this right you track the clients using the mac-address as unique identifier.

As mentioned above the arp table (output of arp -a) will tell you the last known ip-address mac-address combo's of all the PC's you communicated with in the last X minutes (X varies per OS).

Just do a ping "broadcast address" to refresh the arp table. That should give you most of the active devices on the subnet. (It ain't 100% fool-proof. You will probably miss a couple of devices because they are busy or your own network-stack gets overwhelmed by the amount of responses and droppes a few.)

Another option is to pull the list of DHCP leases from the DHCP server, if you have access to this. In a Windows environment the netsh command can be very useful for this sort of thing.

0

would ask all other ip's in the same subnet what their MAC address is

No - you can only see MAC addresses for the local subnet. You'll only see the mac address of the router (via TCP/IP) for other subnets.

and change the route table?

!!!! even if you know the MAC address of the remote machine, that's got nothing to do with the routing table

Your description of what you are trying to achieve is totally confusing.

needs to track slave machines on the local network

OK, let's start with that.

There is no 'slave' in the TCP/IP nor OSI network model. Only servers and clients. The server knows who the client is because it has a fixed address (and usually an IP name). Even where that is not the case, the client can discover servers by probing open ports.

An alternative approach is the peer-to-peer model - where there are multiple servers. There may be a hierarchy of servers, in which case each server will maintain a directory of (some of?) the other nodes and their position in the hierarchy. Where there are insufficient nodes within a particular level of the hierarchy, then the node detecting this should request an election from the nodes in the level below.

A brute force approach is for a prospective client to send out a broadcast request for a server.

If you're talking about authenticating the end points - then that's a completely separate ball game (unless all the relevant nodes are within the same VPN).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .