OpenVZ Forum


Home » Mailing lists » Users » How to identify the physical machine when you are inside the container?
Re: Re: How to identify the physical machine when you are inside the container? [message #42668 is a reply to message #42663] Tue, 10 May 2011 14:43 Go to previous messageGo to previous message
mercy is currently offline  mercy
Messages: 12
Registered: October 2010
Location: msk.ru.earth
Junior Member

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@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.
>


no fear. never give up. never surrender.
 
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 21:42:50 GMT 2025

Total time taken to generate the page: 0.12844 seconds