Discover IP of server in same network

I'd like the yun to discover a local servers IP
(because a script on the yun is sending sensordata to that server and there shall be no need to configure static IPs or anything... "the yuns/sensors and the server shall automatically find eachother, when they are in the same network").

How could I achieve that?

My first idea was to store the MAC of the server in the sketch and run some script on the linino-side that could find the server in the local network...then somehow that script should pass the iP to the sketch.

Appreciate any help!

Know mac address find out IP address.

opkg update 
opkg install nmap
nmap -sP  192.168.0.0/24 |grep -i -B 2 00:19:b9:22:ae:4a

Nmap scan report for 192.168.0.240
Host is up (0.012s latency).
MAC Address: 00:19:B9:22:AE:4A (Dell)

If u know the server has mac address "00:19:b9:22:ae:4a" and local Lan is 192.168.0.0/24 class C.

parse result get server at "192.168.0.240"

Sea2605:
I'd like the yun to discover a local servers IP
(because a script on the yun is sending sensordata to that server and there shall be no need to configure static IPs or anything... "the yuns/sensors and the server shall automatically find eachother, when they are in the same network").

How could I achieve that?

::::SNIP::::

Sea2605,
if you don't already know, the Yun uses a service called Bonjour
Read about it in this thread Seeing Yun in IDE Port menu. (See #7)
You might consider running this service on your local server.

Jesse

Thanks to both of you!

jessemonroy650:
Sea2605,
if you don't already know, the Yun uses a service called Bonjour
Read about it in this thread Seeing Yun in IDE Port menu. (See #7)
You might consider running this service on your local server.

Jesse

few persons in this board include myself tried the same thing, try to install Bonjour client (nss-mdns ) at Yun. However it does not work. The reason is very odd.
The nss-mdns is either failed to compile or failed at run time due openwrt base on uClibc.

sonnyyu:
FYI:

OpenWRT is embedded linux.

Debian, Ubuntu, Redhat is desktop linux.

OpenWRT' s default C standard library is uClibc.

Debian' s default C standard library is glibc.

uClibc and glibc are only source but not binary compatible, that means you can not compile at Debian and run at OpenWRT directly.

In general uClibc and glibc is source compatible, but here is the exception.

sonnyyu:
few persons in this board include myself tried the same thing, try to install Bonjour client (nss-mdns ) at Yun. However it does not work. The reason is very odd.
The nss-mdns is either failed to compile or failed at run time due openwrt base on uClibc.

In general uClibc and glibc is source compatible, but here is the exception.

sonnyyu,
You may not be aware of this, but you do not need to install Bonjour, the service is already installed on the Yun.

On the Linux side of the Yun, you can find it running as boot Scripts, /etc/rc.d/S60dnsmasq & /etc/rc.d/S61avahi-daemon. The Bonjour service is also known as ZeroConf. Again, it is already running on the Yun.

To read about these two services you can read these links:

If you have an ethernet shield, here is an old link:

DNS, DHCP and Bonjour/Zeroconf with Arduino
http://forum.arduino.cc/index.php?topic=37911.0
Jan 06, 2010, 04:04 pm

However, even with all this, it may NOT be what the person with the question wanted.

Cheers,
Jesse

jessemonroy650:
sonnyyu,
You may not be aware of this, but you do not need to install Bonjour, the service is already installed on the Yun.
...

It is true Bonjour service is already installed on the Yun. but OP need Bonjour client for ip resolution.

Yun: Bonjour service (ip resolution) does not work on yun. #7