tarun_2709
tarun_2709

Reputation: 21

How to generate an unique ID for a given linux machine?

My python application running as a daemon in a variety of linux distributions are trying to register to my server using the machine's IP Address and FQDN Hostname(given by "hostname -f" command) as a primary key.

Now I am facing a problem when two machines are having same hostname and IP Address. Eg in case of two VM's running on two seperate machines, the hostname is "localhost.localdomain" and Ip Address is "192.168.0.2" for both of them.

Is there any unique way to differentitate any two machines. (Maybe some other third parameter which will guarantee uniqueness across any linux machine )

Upvotes: 0

Views: 1234

Answers (1)

assaf
assaf

Reputation: 210

the MAC address should be unique per network interface. maybe you can try a combination of IP, MAC and host name?

another option is to create a UUID and save it on the machine.

Upvotes: 2

Related Questions