How to identify the physical machine when you are inside the container? [message #42646] |
Mon, 09 May 2011 08:13 |
Benjamin Henrion
Messages: 51 Registered: February 2011
|
Member |
|
|
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?
Best,
--
Benjamin Henrion <bhenrion at ffii.org>
FFII Brussels - +32-484-566109 - +32-2-4148403
"In July 2005, after several failed attempts to legalise software
patents in Europe, the patent establishment changed its strategy.
Instead of explicitly seeking to sanction the patentability of
software, they are now seeking to create a central European patent
court, which would establish and enforce patentability rules in their
favor, without any possibility of correction by competing courts or
democratically elected legislators."
|
|
|
|
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 |
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.
|
|
|
|
|
|
Re: How to identify the physical machine when you are inside the container? [message #42691 is a reply to message #42646] |
Wed, 11 May 2011 20:08 |
Thorsten Schifferdeck
Messages: 38 Registered: February 2006
|
Member |
|
|
Hi,
you can use action scripts mount, see OpenVZ User Guide,
p. 89 (-> http://download.openvz.org/doc/OpenVZ-Users-Guide.pdf )
or man page vzctl (8)
on ct mount, a ct0 hostname info is writen inside the ct, like:
---8<... ...( file: /etc/vz/conf/vps.mount )...
#!/bin/bash
# global vps.mount script
# write hostname ct0 info from ct0 to ctX
# include the ct config
. $VE_CONFFILE
hostname > $VE_PRIVATE/_to/any/place/where/you/like/it_
exit 0
---8<...
Bye,
Thorsten
Am 09.05.2011 10:13, schrieb Benjamin Henrion:
> 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?
>
> Best,
>
> --
> Benjamin Henrion <bhenrion at ffii.org>
> FFII Brussels - +32-484-566109 - +32-2-4148403
> "In July 2005, after several failed attempts to legalise software
> patents in Europe, the patent establishment changed its strategy.
> Instead of explicitly seeking to sanction the patentability of
> software, they are now seeking to create a central European patent
> court, which would establish and enforce patentability rules in their
> favor, without any possibility of correction by competing courts or
> democratically elected legislators."
|
|
|