Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

4 Answers 4

up vote 3 down vote accepted

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

share|improve this answer
    
ping -b 255.255.255.255 ; arp –  Sirex Sep 20 '11 at 11:39
    
better yet arp-scan --interface=eth0 -l . Because serverfault.com/questions/312930/… –  user Sep 20 '11 at 11:45

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.

share|improve this answer

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.

share|improve this answer

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).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.