[one-users] Not able to ping running VM from outside network

Carlos Martín Sánchez cmartin at opennebula.org
Thu Dec 1 07:22:01 PST 2011


Hi,

The IP assignment mechanism is explained in the contextualization guide [1].

If you don't use the CONTEXT section, the init scripts installed in the
ttylinux sample VM translate the MAC address to the corresponding IP.

Using the CONTEXT cdrom, the init.sh script in executed at boot time. You
can modify the init.sh script to set your broadcast address and netmask.
You can hardcode these values, or pass them as a CONTEXT sub-attribute;
take a look at the DNS example from the contextualization guide:

dns = "$NETWORK[DNS, NETWORK_ID=3]"


Regards.

[1] http://opennebula.org/documentation:rel3.0:cong
--
Carlos Martín, MSc
Project Engineer
OpenNebula - The Open Source Toolkit for Data Center Virtualization
www.OpenNebula.org | cmartin at opennebula.org |
@OpenNebula<http://twitter.com/opennebula><cmartin at opennebula.org>


On Mon, Nov 28, 2011 at 12:15 PM, Errol Samuels <esamuels at carismatel.com>wrote:

>  I can't seem to get pass this network issue but I made some progress over
> the weekend, I commented out the context from the ttylinux.one template
> file and allow the system to automatically assign an IP Address to the VM.
>
> Once the VM is running I am able to ping it from external IPs, ssh into
> etc, so far this is fine but I need to be able to assign the IP statically,
> also it seems no matter what I do the VM is still not picking up the
> correct Broadcast Address and Netmask from my virtual network definition
> file.
>
> # ifconfig eth0
>
> eth0      Link encap:Ethernet  HWaddr 02:00:41:62:4A:93
>           inet addr:1.1.74.147  *Bcast:1.1.74.255*  *Mask:255.255.255.0*
>
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:189 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:114 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:1000
>           RX bytes:18211 (17.7 KiB)  TX bytes:14265 (13.9 KiB)
>
>           Interrupt:11 Base address:0xc100
>
> ****** Begin contents of public_nj01.net ******
>
> NAME = "Public-NJ01"
> TYPE = FIXED
>
> # We have to bind this network to 'vbr0' for Internet Access
> BRIDGE = vbr0
>
>
>  LEASES = [ IP="1.1.74.147"]
>  LEASES = [ IP="1.1.74.148"]
>  LEASES = [ IP="1.1.74.149"]
>  LEASES = [ IP="1.1.74.150"]
>
>
> GATEWAY = 1.1.74.145
> NETMASK = 255.255.255.248
> DNS = 1.1.184.34
>
> ****** end contents of public_nj01.net ******
>
>
> ****** Begin contents of ttylinux.one ******
>
>
> NAME   = ttylinux
> CPU    = 0.1
> MEMORY = 64
>
> DISK   = [ IMAGE_ID = 3 ]
>
> NIC    = [ NETWORK_ID = 25 ]
>
> GRAPHICS = [ TYPE = "VNC" ]
>
> FEATURES=[ acpi="no" ]
>
> #CONTEXT = [
> #    hostname    = "ttylinux-$VMID",
> #    ip_public   = "1.1.74.147",
> #    files              = "/srv/cloud/one/one-templates/init.sh
> /srv/cloud/one/.ssh/id_rsa.pub",
> #    target      = "hdc",
> #    root_pubkey = "id_rsa.pub",
> #    username    = "oneadmin",
> #    user_pubkey = "id_rsa.pub"
> # ]
>
> ****** end contents of ttylinux.one ******
>
> If I uncomment the context the VM is being assigned an IP from the least
> as well as the static IP from the context as shown below:
>
> oneadmin at cps:~/one-templates$ onevm show 39
> VIRTUAL MACHINE 39
> INFORMATION
> ID                  : 39
> NAME                : one-39
> USER                : oneadmin
> GROUP               : oneadmin
> STATE               : ACTIVE
> LCM_STATE           : RUNNING
> HOSTNAME            : vmh-usnjewr-eqix-n01
> START TIME          : 11/28 06:08:51
> END TIME            : -
> DEPLOY ID           : one-39
>
> VIRTUAL MACHINE
> MONITORING
> NET_TX              : 0
> NET_RX              : 1560
> USED MEMORY         : 65536
> USED CPU            : 32
>
> VIRTUAL MACHINE
> TEMPLATE
> CONTEXT=[
>   FILES="/srv/cloud/one/one-templates/init.sh
> /srv/cloud/one/.ssh/id_rsa.pub",
>   HOSTNAME=ttylinux-39,
>   *IP_PUBLIC=1.1.74.147,*
>   ROOT_PUBKEY=id_rsa.pub,
>   TARGET=hdc,
>   USERNAME=oneadmin,
>   USER_PUBKEY=id_rsa.pub ]
> CPU=0.1
> DISK=[
>   CLONE=YES,
>   DISK_ID=0,
>   IMAGE=ttylinux,
>   IMAGE_ID=3,
>   READONLY=NO,
>   SAVE=NO,
>   SOURCE=/srv/cloud/one/var/images/e07083e90f37375bc963c9bf8ffcd6c2,
>   TARGET=hda,
>   TYPE=DISK ]
> FEATURES=[
>   ACPI=no ]
> GRAPHICS=[
>   PORT=9429,
>   TYPE=VNC ]
> MEMORY=64
> NAME=one-39
> NIC=[
>   BRIDGE=vbr0,
>   *IP=1.1.74.148,*
>   MAC=02:00:41:62:4a:94,
>   NETWORK=Public-NJ01,
>   NETWORK_ID=25 ]
> TEMPLATE_ID=14
> VMID=39
>
> I am not able to access the VM via ssh or ping it when the context is
> uncommented.
>
> Any ideas?
>
> regards,
>
> Errol
>
>
>
> On 25/11/2011 16:36, Zeeshan Ali Shah wrote:
>
> and what is the route of vm ?
>
> On Fri, Nov 25, 2011 at 5:10 PM, Errol Samuels <esamuels at carismatel.com>wrote:
>
>>  Hello,
>>
>> OK here it goes:
>>
>> *Route Print from Opennebula Control Server:*
>>
>> root at cps:/srv/cloud/one/one-templates# route -n
>>
>> Kernel IP routing table
>> Destination     Gateway         Genmask         Flags Metric Ref    Use
>> Iface
>> 1.1.75.192    0.0.0.0         255.255.255.248 U     0      0        0 eth0
>> 172.22.55.0     0.0.0.0         255.255.255.0   U     0      0        0
>> eth1
>> 0.0.0.0         1.1.75.193    0.0.0.0         UG    100    0        0 eth0
>>
>> root at cps:/srv/cloud/one/one-templates# ping -c 5 1.1.74.147
>>
>> PING 1.1.74.147 (1.1.74.147) 56(84) bytes of data.
>> 64 bytes from 1.1.74.147: icmp_req=1 ttl=64 time=1.65 ms
>> 64 bytes from 1.1.74.147: icmp_req=2 ttl=64 time=0.366 ms
>> 64 bytes from 1.1.74.147: icmp_req=3 ttl=64 time=0.405 ms
>> 64 bytes from 1.1.74.147: icmp_req=4 ttl=64 time=0.400 ms
>> 64 bytes from 1.1.74.147: icmp_req=5 ttl=64 time=0.426 ms
>>
>> --- 1.1.74.147 ping statistics ---
>>
>> *Route Print from KVM hypervisor:*
>>
>> root at vmh:~# route -n
>>
>> Kernel IP routing table
>> Destination     Gateway         Genmask         Flags Metric Ref    Use
>> Iface
>> 0.0.0.0         1.1.74.145    0.0.0.0         UG    100    0        0
>> virbr0
>> 1.1.74.144    0.0.0.0         255.255.255.248 U     0      0        0
>> virbr0
>> 172.22.55.0     0.0.0.0         255.255.255.0   U     0      0        0
>> virbr1
>>
>> *From my iMAC*
>>
>> I am able to ping both the Control Server (1.1.75.194) and the KVM Host
>> (1.1.74.146) but not the VM (1.1.74.147).
>>
>>
>> *This is my "Red LAN NJ01" configuration:*
>>
>> NAME = "Red LAN NJ01 "
>> TYPE = FIXED
>>
>> # We have to bind this network to 'virbr0' for Internet Access
>> BRIDGE = virbr0
>>
>> LEASES = [ IP="1.1.74.147"]
>> LEASES = [ IP="1.1.74.148"]
>> LEASES = [ IP="1.1.74.149"]
>> LEASES = [ IP="1.1.74.150"]
>>
>> GATEWAY = 1.1.74.145
>> DNS = 208.67.222.222
>>
>> *This is my ttylinux.one configuration:*
>>
>>
>> NAME   = ttylinux
>> CPU    = 0.1
>> MEMORY = 64
>>
>> DISK   = [ IMAGE_ID = 2 ]
>>
>>  NIC    = [ NETWORK_ID = 13 ]
>>
>>
>> FEATURES=[ acpi="no" ]
>>
>> CONTEXT = [
>>     hostname    = "$NAME",
>>     ip_public   = "1.1.74.147",
>>     files      = "/srv/cloud/one/one-templates/init.sh
>> /srv/cloud/one/.ssh/id_rsa.pub",
>>     target      = "hdc",
>>     root_pubkey = "id_rsa.pub",
>>     username    = "oneadmin",
>>     user_pubkey = "id_rsa.pub"
>>  ]
>>
>>  Interestly, I did an ifconfig in the VM and I see the the Broadcast and
>> the Netmask are incorrect.
>>
>> # ifconfig
>> eth0    Link encap:Ethernet  HWaddr 02:00:41:62:4A:93
>>           inet addr:1.1.74.147  Bcast:1.255.255.255  Mask:255.0.0.0
>>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>>           RX packets:257 errors:0 dropped:0 overruns:0 frame:0
>>           TX packets:124 errors:0 dropped:0 overruns:0 carrier:0
>>           collisions:0 txqueuelen:1000
>>           RX bytes:25210 (24.6 KiB)  TX bytes:14670 (14.3 KiB)
>>           Interrupt:11 Base address:0xc100
>>
>> lo        Link encap:Local Loopback
>>           inet addr:127.0.0.1  Mask:255.0.0.0
>>           UP LOOPBACK RUNNING  MTU:16436  Metric:1
>>           RX packets:8 errors:0 dropped:0 overruns:0 frame:0
>>           TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
>>           collisions:0 txqueuelen:0
>>           RX bytes:592 (592.0 B)  TX bytes:592 (592.0 B)
>>
>> So it looks like a virtual network configuration issue somewhere but I
>> can't put my hand on it.
>>
>> Best regards,
>>
>> Errol
>>
>>
>> On 25/11/2011 15:08, Zeeshan Ali Shah wrote:
>>
>> what does route -n on both machine where you can ping and from where you
>> cannot show ...
>>
>> On Fri, Nov 25, 2011 at 3:42 PM, Errol Samuels <esamuels at carismatel.com>wrote:
>>
>>>  Hello,
>>>
>>> I am trying to get the test ttylinux VM going after a few days of
>>> putting together bits of documentation to get a better understanding of
>>> KVM. So far the VM is running and I am able to ssh into it from the Control
>>> Server and the Host but I am unable to ping it from any other external
>>> IP.
>>>
>>> I checked the relevant FAQ:
>>> "http://wiki.opennebula.org/faq#my_vm_is_running_but_i_get_no_answer_from_pings_what_s_wrong"<http://wiki.opennebula.org/faq#my_vm_is_running_but_i_get_no_answer_from_pings_what_s_wrong>
>>> and made some comments below.
>>>
>>>  There are several reasons for this, check:
>>>
>>>    -  You have created a network with a valid bridge in the nodes of
>>>    your cluster
>>>
>>>
>>>
>>> Yes, the bridge configuration is as follows:
>>>
>>> ** ( Real IP has been substituted ) **
>>>
>>> auto eth0
>>> iface eth0 inet manual
>>> auto virbr0
>>> iface virbr0 inet static
>>>    address 1.1.74.146
>>>    netmask 255.255.255.248
>>>    network 1.1.74.144
>>>    gateway 1.1.74.145
>>>    broadcast 1.1.74.151
>>>    bridge_ports eth0
>>>    bridge_fd 9
>>>    bridge_hello 2
>>>    bridge_maxage 12
>>>    bridge_stp off
>>>
>>>
>>>    -  You have defined a NIC attribute in your VM attached to that
>>>    network
>>>
>>>
>>> NAME   = ttylinux
>>> CPU    = 0.1
>>> MEMORY = 64
>>>
>>> DISK   = [ IMAGE_ID = 2 ]
>>>
>>> NIC    = [ NETWORK_ID = 10 ]
>>>
>>> FEATURES=[ acpi="no" ]
>>>
>>> CONTEXT = [
>>>     hostname    = "$NAME",
>>>     ip_public   = "1.1.74.147",
>>>     files      = "/srv/cloud/one/one-templates/init.sh
>>> /srv/cloud/one/.ssh/id_rsa.pub",
>>>     target      = "hdc",
>>>     root_pubkey = "id_rsa.pub",
>>>     username    = "oneadmin",
>>>     user_pubkey = "id_rsa.pub"
>>>  ]
>>>
>>>
>>>    -  The VM is prepared to configure the interface to use a valid IP
>>>    in that network. You can:
>>>     -  Configure the VM to dynamically configure the IP using its MAC
>>>       address (Contextualzation<http://wiki.opennebula.org/documentation:rel2.2:cong>
>>>       )
>>>        -  Configure the VM to statically set a given IP of the network
>>>        -  Put a DHCP server attached to that network
>>>
>>>
>>> Yes, the VM is statically set a given IP of the network.
>>>
>>>
>>>    -  Also be sure that you are pinging the VM from a host with a route
>>>    to the network
>>>
>>>
>>> Yes, I am able to ping and ssh the VM from the Control Server which is
>>> on the same public VLAN but I am unable to ping that IP from my network for
>>> example.
>>>
>>>
>>> oneadmin at cps:~/one-templates$ onevnet list
>>>   ID USER     GROUP    NAME              TYPE BRIDGE PUB  LEASES
>>>   10 oneadmin oneadmin Red LAN NJ01         F virbr0  No       1
>>>     5 oneadmin oneadmin Blue LAN                 R virbr1 No       0
>>>
>>>
>>> oneadmin at cps:~/one-templates$ onevm list
>>>     ID USER     GROUP    NAME         STAT CPU     MEM
>>> HOSTNAME        TIME
>>>     13 oneadmin oneadmin ttylinux     runn   4     64M vmh-usnjewr-eqi
>>> 00 01:09:54
>>>
>>> Opennebula Version = 3.0.0 compiled from source
>>> Installation Type = Self contained in /srv/cloud/one
>>> Hypervisor = KVM
>>> Control Server OS: Ubuntu 11.04 LTS
>>> KVM Host OS: Ubuntu 11.10 LTS
>>> Storage = Non Shared File System
>>>
>>> Any assistance will be much appreciated.
>>>
>>> Thanks in Advance.
>>>
>>> Errol
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opennebula.org
>>> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>>>
>>>
>>
>>
>> _______________________________________________
>> Users mailing listUsers at lists.opennebula.orghttp://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opennebula.org
>> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>>
>>
>
>
> _______________________________________________
> Users mailing listUsers at lists.opennebula.orghttp://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20111201/3db2a7a6/attachment-0002.htm>


More information about the Users mailing list