best whay to fix dynamic ip changes!

i have a pppoe server running with all my clients connecting to it


but i have clients with 7 or 8 diffrent locations

so all connect to my server pppoe

and i wnat to put a script on client board to see the ip addresses of each location and change it if its not correct(eoip tunnel)

somthing like this

client1-(dhcp10.0.0.3)

client1 connection 2-----(dhcp10.0.0.47)

client1 connection 7------(dhcp10.0.0.100)

all connect to static server 172.17.100.1

so i want connection1 to connect and find ip address of connection2,7 and change the remote ip addresses of the eoip tunnels that are created on the diffrent clients connections
for connection 2,7
and the same for the others

can anyone help me with an idea that i can try work this out or a simple script that can do this thanks for all the help