当前位置: 动力学知识库 > 问答 > 编程问答 >

network programming - How do i find the ip address of a server in a homegroup

问题描述:

I have a number of devices connected to a server. When it restarts the ip address might change. How would the remaining devices find the new address?

I want to automate the process since I want to distribute the software and there won't be any network administrator.

I found solutions like configuring a DHCP server or manually configuring the router, but it won't possible to manually configure the routers of the devices that would use the software.

网友答案:

What you could do is following :-

  1. Assign static IP-Address to the server; it could be done by adding a reservation for server's IP-Address based on the MAC address of the server in the router. Check your router manual for how to add IP-Address reservation for a designated MAC-Address.

  2. Once server has got a static IP-Address, your work would be so easy to achieve. You either need to ensure that the clients make an entry of the server's hostname and the corresponding static IP into the client's host name OR if you've an adhoc connection(WiFi/Bluetooth), it would do that automatically without your intervention.

That's it, you have a static IP-Address for your server and you have mapping of server's IP-Address and hostname into each client's etc/hosts file(not needed for adhoc connections as explained above).

分享给朋友:
您可能感兴趣的文章:
随机阅读: