OpenVZ Forum


Home » Mailing lists » Users » How to identify the physical machine when you are inside the container?
Re: How to identify the physical machine when you are inside the container? [message #42663 is a reply to message #42646] Tue, 10 May 2011 09:09 Go to previous messageGo to previous message
Aleksandar Ivanisevic is currently offline  Aleksandar Ivanisevic
Messages: 34
Registered: April 2011
Member
Benjamin Henrion <bh@udev.org> writes:

> Hi,
>
> Do you have any trick to identify the physical machine (with some kind
> of cat /proc/something) when you are inside the container?
>
> I want to just get the hostname of the HN when I am inside the containers.
>
> Any simple of doing it?

I use this with venet:

export ovz_host=$(dig -x $(ping -t 1 -c 1 1.2.3.4 | grep exceed | cut -d " " -f 2) +short | sed -e s/\.$// )

it sends a ping packet with the time to live of 1 hop and checks who
responds with icmp time exceeded. For a VE with p2p network (venet), a
host node is always the next hop. It will not work if you have veth as
bridges dont return icmp ;)

dont forget to set up the dns properly or change the dig above to a
hosts or other table lookup.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: /usr/sbin/vzmigrate: line 312: vzctl: command not found
Next Topic: Slackware 13 weirdness
Goto Forum:
  


Current Time: Sun Aug 10 19:25:13 GMT 2025

Total time taken to generate the page: 0.11179 seconds