[Users] Re: How to identify the physical machine when you are inside the container?

Ekaterina.epifanova nixma at yandex.ru
Tue May 10 10:43:41 EDT 2011


Hi.

For this purpose we use special naming sheme:
hostname of VE contain name of NH as service hostname.
i.e. 1111.ovz1.domain.ru, 2222.ovz2.domain.ru, 3333.ovz3.domain.ru and 
VEID is uniq for ALL HN's

Or we can use traceroute utility from outside
i.e. traceroute ve-domain.com
traceroute to ve-domain.com (xxx.xxx.xxx.xxx), 30 hops max, 60 byte packets
               1  ....
               2  ....
               3  ....
  HW name -->> 4  hwnodename.domain.com (yyy.yyy.yyy.yyy.)  2.775 ms  
2.762 ms  2.741 ms
               5  ve-domain.com (xxx.xxx.xxx.xxx)  2.727 ms  2.702 ms  
2.687 ms

If VE and HN has real IP and HN's , you can use traceroute inside VE
i.e. traceroute ya.ru
traceroute to ya.ru (87.250.251.3), 30 hops max, 40 byte packets
HW name -->> 1  hwhonename (yyy.yyy.yyy.yyy)  0.090 ms  0.015 ms  0.015 ms
              2  ...
              3  ...
              4  ...
              5  ...
              6  www.yandex.ru (87.250.251.3)  1.510 ms  1.907 ms  2.116 ms


On 05/10/2011 01:09 PM, Aleksandar Ivanisevic wrote:
> Benjamin Henrion<bh at 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.
>
> _______________________________________________
> Users mailing list
> Users at openvz.org
> https://openvz.org/mailman/listinfo/users



More information about the Users mailing list