Detecting that a machine is running on Linode
Is there any way to detect that a VM is running on Linode?
Puppet provides a fact vitual which is supposed to show what virtualization method a system is using. We use Redhat 7 and 8 for guest operating systems. We have a lot of physical systems, and also use RedHat Virtualization, KVM, and Linode. The documentation for virt-what says it can detect rhev, but that seems to only detect the old version, not newer versions which are just reported as kvm. Similarly, Linodes are also reported as kvm.
One of the biggest issues is that each machine should have different VM guest tools/services installed based on the hypervisor in use (for example, it seems that Linodes should not have guest tools at all). Is there a better automated way to figure out what the actual hypervisor is?
2 Replies
Hi,
You could try using Linode's new .ip.linodeusercontent.com endpoint. See if it resolves to the IP address of your Linode.
For example, for the public IPV4 address of the Linode, retrieve this through whatever means you wish, replace the dots (.) with dashes (-). Then, try and resolve something like this.
72-14-179-1.ip.linodeusercontent.com
If this resolves to 72.14.179.1, for example, you are using a Linode IP, and thus, are running on a Linode. If the public IP address of your VM doesn't resolve with this endpoint, you are not running on a Linode.
I wouldn't recommend pinging or tracerouts, or anything but DNS resolution for this test. Also, this might not be the best solution, but it does seem to be a fairly reliable one, unless someone has managed to use this service to resolve an IP address that doesn't belong to Linode, which shouldn't occur.
Blake
Hey there,
In addition to the solution provided above you could also use whois
and curl
to gather additional information on a particular IP. This is still a manual process however you could always write a script with either command and automate some of the process. For your reference I have included an example of each command below.
whois + grep
whois 45.56.105.178 | grep 'Org'
Organization: Linode (LINOD)
OrgName: Linode
OrgId: LINOD
OrgTechHandle: LNO21-ARIN
OrgTechName: Linode Network Operations
OrgTechPhone: +1-609-380-7304
OrgTechEmail: support@linode.com
OrgTechRef: https://rdap.arin.net/registry/entity/LNO21-ARIN
OrgNOCHandle: LNO21-ARIN
OrgNOCName: Linode Network Operations
OrgNOCPhone: +1-609-380-7304
OrgNOCEmail: support@linode.com
OrgNOCRef: https://rdap.arin.net/registry/entity/LNO21-ARIN
OrgAbuseHandle: LAS12-ARIN
OrgAbuseName: Linode Abuse Support
OrgAbusePhone: +1-609-380-7100
OrgAbuseEmail: abuse@linode.com
OrgAbuseRef: https://rdap.arin.net/registry/entity/LAS12-ARIN
curl
curl ipinfo.io/45.56.105.178
{
"ip": "45.56.105.178",
"hostname": "li907-178.members.linode.com",
"city": "Morris Plains",
"region": "New Jersey",
"country": "US",
"loc": "40.8223,-74.4569",
"org": "AS63949 Linode, LLC",
"postal": "07927",
"timezone": "America/New_York",
"readme": "https://ipinfo.io/missingauth"
}