Benjamin Henrion <[email protected]> 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.

_______________________________________________
Users mailing list
[email protected]
https://openvz.org/mailman/listinfo/users

Reply via email to