Hi,<br><br>The IP assignment mechanism is explained in the contextualization guide [1].<br><br>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.<br>

<br>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:<br>

<br>dns = "$NETWORK[DNS, NETWORK_ID=3]"<br><br><br>Regards.<br><br>[1] <a href="http://opennebula.org/documentation:rel3.0:cong">http://opennebula.org/documentation:rel3.0:cong</a><br clear="all"><span style="border-collapse:collapse;color:rgb(136, 136, 136);font-family:arial,sans-serif;font-size:13px">--<br>

Carlos Martín, MSc<br>Project Engineer<br>OpenNebula - The Open Source Toolkit for Data Center Virtualization<br><a href="http://www.OpenNebula.org" target="_blank">www.OpenNebula.org</a> | <a href="mailto:cmartin@opennebula.org" target="_blank">cmartin@opennebula.org</a> | <a href="http://twitter.com/opennebula" target="_blank">@OpenNebula</a></span><span style="border-collapse:collapse;color:rgb(136, 136, 136);font-family:arial, sans-serif;font-size:13px"><a href="mailto:cmartin@opennebula.org" style="color:rgb(42, 93, 176)" target="_blank"></a></span><br>


<br><br><div class="gmail_quote">On Mon, Nov 28, 2011 at 12:15 PM, Errol Samuels <span dir="ltr"><<a href="mailto:esamuels@carismatel.com">esamuels@carismatel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">


  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    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.  <br>
    <br>
    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.  <br>
    <br>
    # ifconfig eth0<div class="im"><br>
    eth0      Link encap:Ethernet  HWaddr 02:00:41:62:4A:93  <br></div>
              inet addr:1.1.74.147  <b>Bcast:1.1.74.255</b>  <b>Mask:255.255.255.0</b><div class="im"><br>
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1<br></div>
              RX packets:189 errors:0 dropped:0 overruns:0 frame:0<br>
              TX packets:114 errors:0 dropped:0 overruns:0 carrier:0<br>
              collisions:0 txqueuelen:1000 <br>
              RX bytes:18211 (17.7 KiB)  TX bytes:14265 (13.9 KiB)<div class="im"><br>
              Interrupt:11 Base address:0xc100 <br>
    <br></div>
    ****** Begin contents of <a href="http://public_nj01.net" target="_blank">public_nj01.net</a> ******<br>
    <br>
    NAME = "Public-NJ01"<br>
    TYPE = FIXED<br>
    <br>
    # We have to bind this network to 'vbr0' for Internet Access<br>
    BRIDGE = vbr0<div class="im"><br>
    <br>
     LEASES = [ IP="1.1.74.147"]<br>
     LEASES = [ IP="1.1.74.148"]<br>
     LEASES = [ IP="1.1.74.149"]<br>
     LEASES = [ IP="1.1.74.150"]<br>
    <br>
    <br>
    GATEWAY = 1.1.74.145<br></div>
    NETMASK = 255.255.255.248<br>
    DNS = 1.1.184.34<br>
    <br>
    ****** end contents of <a href="http://public_nj01.net" target="_blank">public_nj01.net</a> ******<br>
    <br>
    <br>
    ****** Begin contents of ttylinux.one ******<div class="im"><br>
    <br>
    NAME   = ttylinux<br>
    CPU    = 0.1<br>
    MEMORY = 64<br>
    <br></div>
    DISK   = [ IMAGE_ID = 3 ]<br>
    <br>
    NIC    = [ NETWORK_ID = 25 ]<br>
    <br>
    GRAPHICS = [ TYPE = "VNC" ]<br>
    <br>
    FEATURES=[ acpi="no" ]<br>
    <br>
    #CONTEXT = [<br>
    #    hostname    = "ttylinux-$VMID",<br>
    #    ip_public   = "1.1.74.147",<br>
    #    files              = "/srv/cloud/one/one-templates/init.sh
    /srv/cloud/one/.ssh/id_rsa.pub",<br>
    #    target      = "hdc",<br>
    #    root_pubkey = "id_rsa.pub",<br>
    #    username    = "oneadmin",<br>
    #    user_pubkey = "id_rsa.pub"<br>
    # ]<br>
    <br>
    ****** end contents of ttylinux.one ******<br>
    <br>
    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:<br>
    <br>
    oneadmin@cps:~/one-templates$ onevm show 39<br>
    VIRTUAL MACHINE 39
    INFORMATION                                                  <br>
    ID                  : 39                  <br>
    NAME                : one-39              <br>
    USER                : oneadmin            <br>
    GROUP               : oneadmin            <br>
    STATE               : ACTIVE              <br>
    LCM_STATE           : RUNNING             <br>
    HOSTNAME            : vmh-usnjewr-eqix-n01<br>
    START TIME          : 11/28 06:08:51      <br>
    END TIME            : -                   <br>
    DEPLOY ID           : one-39              <br>
    <br>
    VIRTUAL MACHINE
    MONITORING                                                      <br>
    NET_TX              : 0                   <br>
    NET_RX              : 1560                <br>
    USED MEMORY         : 65536               <br>
    USED CPU            : 32                  <br>
    <br>
    VIRTUAL MACHINE
    TEMPLATE                                                        <br>
    CONTEXT=[<br>
      FILES="/srv/cloud/one/one-templates/init.sh
    /srv/cloud/one/.ssh/id_rsa.pub",<br>
      HOSTNAME=ttylinux-39,<br>
      <b>IP_PUBLIC=1.1.74.147,</b><br>
      ROOT_PUBKEY=id_rsa.pub,<br>
      TARGET=hdc,<br>
      USERNAME=oneadmin,<br>
      USER_PUBKEY=id_rsa.pub ]<br>
    CPU=0.1<br>
    DISK=[<br>
      CLONE=YES,<br>
      DISK_ID=0,<br>
      IMAGE=ttylinux,<br>
      IMAGE_ID=3,<br>
      READONLY=NO,<br>
      SAVE=NO,<br>
      SOURCE=/srv/cloud/one/var/images/e07083e90f37375bc963c9bf8ffcd6c2,<br>
      TARGET=hda,<br>
      TYPE=DISK ]<br>
    FEATURES=[<br>
      ACPI=no ]<br>
    GRAPHICS=[<br>
      PORT=9429,<br>
      TYPE=VNC ]<br>
    MEMORY=64<br>
    NAME=one-39<br>
    NIC=[<br>
      BRIDGE=vbr0,<br>
      <b>IP=1.1.74.148,</b><br>
      MAC=02:00:41:62:4a:94,<br>
      NETWORK=Public-NJ01,<br>
      NETWORK_ID=25 ]<br>
    TEMPLATE_ID=14<br>
    VMID=39<br>
    <br>
    I am not able to access the VM via ssh or ping it when the context
    is uncommented.<br>
    <br>
    Any ideas?<br>
    <br>
    regards,<br>
    <br>
    Errol<div class="im"><br>
    <br>
    <br>
    On 25/11/2011 16:36, Zeeshan Ali Shah wrote:
    </div><div><div class="h5"><blockquote type="cite">and what is the route of vm ?  <br>
      <br>
      <div class="gmail_quote">On Fri, Nov 25, 2011 at 5:10 PM, Errol
        Samuels <span dir="ltr"><<a href="mailto:esamuels@carismatel.com" target="_blank">esamuels@carismatel.com</a>></span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div bgcolor="#FFFFFF" text="#000000"> Hello,<br>
            <br>
            OK here it goes:<br>
            <br>
            <b>Route Print from Opennebula Control Server:</b><br>
            <br>
            root@cps:/srv/cloud/one/one-templates# route -n<br>
            <br>
            Kernel IP routing table<br>
            Destination     Gateway         Genmask         Flags Metric
            Ref    Use Iface<br>
            1.1.75.192    0.0.0.0         255.255.255.248 U     0     
            0        0 eth0<br>
            172.22.55.0     0.0.0.0         255.255.255.0   U     0     
            0        0 eth1<br>
            0.0.0.0         1.1.75.193    0.0.0.0         UG    100   
            0        0 eth0<br>
            <br>
            root@cps:/srv/cloud/one/one-templates# ping -c 5 1.1.74.147<br>
            <br>
            PING 1.1.74.147 (1.1.74.147) 56(84) bytes of data.<br>
            64 bytes from <a href="http://1.1.74.147" target="_blank">1.1.74.147</a>:
            icmp_req=1 ttl=64 time=1.65 ms<br>
            64 bytes from <a href="http://1.1.74.147" target="_blank">1.1.74.147</a>:
            icmp_req=2 ttl=64 time=0.366 ms<br>
            64 bytes from <a href="http://1.1.74.147" target="_blank">1.1.74.147</a>:
            icmp_req=3 ttl=64 time=0.405 ms<br>
            64 bytes from <a href="http://1.1.74.147" target="_blank">1.1.74.147</a>:
            icmp_req=4 ttl=64 time=0.400 ms<br>
            64 bytes from <a href="http://1.1.74.147" target="_blank">1.1.74.147</a>:
            icmp_req=5 ttl=64 time=0.426 ms<br>
            <br>
            --- 1.1.74.147 ping statistics ---<br>
            <br>
            <b>Route Print from KVM hypervisor:</b><br>
            <br>
            root@vmh:~# route -n<br>
            <br>
            Kernel IP routing table<br>
            Destination     Gateway         Genmask         Flags Metric
            Ref    Use Iface<br>
            0.0.0.0         1.1.74.145    0.0.0.0         UG    100   
            0        0 virbr0<br>
            1.1.74.144    0.0.0.0         255.255.255.248 U     0     
            0        0 virbr0<br>
            172.22.55.0     0.0.0.0         255.255.255.0   U     0     
            0        0 virbr1<br>
            <br>
            <b>From my iMAC</b><br>
            <br>
            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).<br>
            <br>
            <br>
            <b>This is my "Red LAN NJ01" configuration:</b><br>
            <br>
            NAME = "Red LAN NJ01 "<br>
            TYPE = FIXED<br>
            <br>
            # We have to bind this network to 'virbr0' for Internet
            Access<br>
            BRIDGE = virbr0<br>
            <br>
            LEASES = [ IP="1.1.74.147"]<br>
            LEASES = [ IP="1.1.74.148"]<br>
            LEASES = [ IP="1.1.74.149"]<br>
            LEASES = [ IP="1.1.74.150"]<br>
            <br>
            GATEWAY = 1.1.74.145<br>
            DNS = 208.67.222.222<br>
            <br>
            <b>This is my ttylinux.one configuration:</b>
            <div><br>
              <br>
              NAME   = ttylinux<br>
              CPU    = 0.1<br>
              MEMORY = 64<br>
              <br>
              DISK   = [ IMAGE_ID = 2 ]<br>
              <br>
            </div>
            NIC    = [ NETWORK_ID = 13 ]
            <div><br>
              <br>
              FEATURES=[ acpi="no" ]<br>
              <br>
              CONTEXT = [<br>
                  hostname    = "$NAME",<br>
                  ip_public   = "1.1.74.147",<br>
                  files      = "/srv/cloud/one/one-templates/init.sh
              /srv/cloud/one/.ssh/id_rsa.pub",<br>
                  target      = "hdc",<br>
                  root_pubkey = "id_rsa.pub",<br>
                  username    = "oneadmin",<br>
                  user_pubkey = "id_rsa.pub"<br>
               ]<br>
              <br>
            </div>
            Interestly, I did an ifconfig in the VM and I see the the
            Broadcast and the Netmask are incorrect.<br>
            <br>
            # ifconfig<br>
            eth0    Link encap:Ethernet  HWaddr 02:00:41:62:4A:93 <br>
                      inet addr:1.1.74.147  Bcast:1.255.255.255 
            Mask:255.0.0.0<br>
                      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1<br>
                      RX packets:257 errors:0 dropped:0 overruns:0
            frame:0<br>
                      TX packets:124 errors:0 dropped:0 overruns:0
            carrier:0<br>
                      collisions:0 txqueuelen:1000<br>
                      RX bytes:25210 (24.6 KiB)  TX bytes:14670 (14.3
            KiB)<br>
                      Interrupt:11 Base address:0xc100<br>
            <br>
            lo        Link encap:Local Loopback <br>
                      inet addr:127.0.0.1  Mask:255.0.0.0<br>
                      UP LOOPBACK RUNNING  MTU:16436  Metric:1<br>
                      RX packets:8 errors:0 dropped:0 overruns:0 frame:0<br>
                      TX packets:8 errors:0 dropped:0 overruns:0
            carrier:0<br>
                      collisions:0 txqueuelen:0<br>
                      RX bytes:592 (592.0 B)  TX bytes:592 (592.0 B)<br>
            <br>
            So it looks like a virtual network configuration issue
            somewhere but I can't put my hand on it.<br>
            <br>
            Best regards,<br>
            <font color="#888888"> <br>
              Errol</font>
            <div>
              <div><br>
                <br>
                On 25/11/2011 15:08, Zeeshan Ali Shah wrote:
                <blockquote type="cite">what does route -n on both
                  machine where you can ping and from where you cannot
                  show ... <br>
                  <br>
                  <div class="gmail_quote">On Fri, Nov 25, 2011 at 3:42
                    PM, Errol Samuels <span dir="ltr"><<a href="mailto:esamuels@carismatel.com" target="_blank">esamuels@carismatel.com</a>></span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                      <div bgcolor="#FFFFFF" text="#000000"> Hello,<br>
                        <br>
                        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.    <br>
                        <br>
                        I checked the relevant FAQ:  <a href="http://wiki.opennebula.org/faq#my_vm_is_running_but_i_get_no_answer_from_pings_what_s_wrong" target="_blank">"http://wiki.opennebula.org/faq#my_vm_is_running_but_i_get_no_answer_from_pings_what_s_wrong"</a> 
                        and made some comments below.<br>
                        <br>
                        <blockquote type="cite">
                          <p> There are several reasons for this, check:
                          </p>
                          <ul>
                            <li>
                              <div> You have created a network with a
                                valid bridge in the nodes of your
                                cluster<br>
                                <br>
                              </div>
                            </li>
                          </ul>
                        </blockquote>
                        <br>
                        Yes, the bridge configuration is as follows:<br>
                        <br>
                        ** ( Real IP has been substituted ) **<br>
                        <br>
                        auto eth0<br>
                        iface eth0 inet manual<br>
                        auto virbr0<br>
                        iface virbr0 inet static<br>
                           address 1.1.74.146<br>
                           netmask 255.255.255.248<br>
                           network 1.1.74.144<br>
                           gateway 1.1.74.145<br>
                           broadcast 1.1.74.151<br>
                           bridge_ports eth0<br>
                           bridge_fd 9<br>
                           bridge_hello 2<br>
                           bridge_maxage 12<br>
                           bridge_stp off<br>
                        <br>
                        <blockquote type="cite">
                          <ul>
                            <li>
                              <div> You have defined a NIC attribute in
                                your VM attached to that network</div>
                            </li>
                          </ul>
                        </blockquote>
                        <br>
                        NAME   = ttylinux<br>
                        CPU    = 0.1<br>
                        MEMORY = 64<br>
                        <br>
                        DISK   = [ IMAGE_ID = 2 ]<br>
                        <br>
                        NIC    = [ NETWORK_ID = 10 ]<br>
                        <br>
                        FEATURES=[ acpi="no" ]<br>
                        <br>
                        CONTEXT = [<br>
                            hostname    = "$NAME",<br>
                            ip_public   = "1.1.74.147",<br>
                            files      =
                        "/srv/cloud/one/one-templates/init.sh
                        /srv/cloud/one/.ssh/id_rsa.pub",<br>
                            target      = "hdc",<br>
                            root_pubkey = "id_rsa.pub",<br>
                            username    = "oneadmin",<br>
                            user_pubkey = "id_rsa.pub"<br>
                         ]<br>
                        <br>
                        <blockquote type="cite">
                          <ul>
                            <li>
                              <div> The VM is prepared to configure the
                                interface to use a valid IP in that
                                network. You can:</div>
                              <ul>
                                <li>
                                  <div> Configure the VM to dynamically
                                    configure the IP using its MAC
                                    address (<a href="http://wiki.opennebula.org/documentation:rel2.2:cong" title="documentation:rel2.2:cong" rel="nofollow" target="_blank">Contextualzation</a>)</div>
                                </li>
                                <li>
                                  <div> Configure the VM to statically
                                    set a given IP of the network</div>
                                </li>
                                <li>
                                  <div> Put a <acronym title="Dynamic
                                      Host Configuration Protocol">DHCP</acronym>
                                    server attached to that network</div>
                                </li>
                              </ul>
                            </li>
                          </ul>
                        </blockquote>
                        <br>
                        Yes, the VM is statically set a given IP of the
                        network.  <br>
                        <br>
                        <blockquote type="cite">
                          <ul>
                            <li>
                              <div> Also be sure that you are pinging
                                the VM from a host with a route to the
                                network</div>
                            </li>
                          </ul>
                        </blockquote>
                        <br>
                        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.<br>
                        <br>
                        <br>
                        oneadmin@cps:~/one-templates$ onevnet list<br>
                          ID USER     GROUP    NAME              TYPE
                        BRIDGE PUB  LEASES<br>
                          10 oneadmin oneadmin Red LAN NJ01         F
                        virbr0  No       1<br>
                            5 oneadmin oneadmin Blue LAN                
                        R virbr1 No       0<br>
                        <br>
                        <br>
                        oneadmin@cps:~/one-templates$ onevm list<br>
                            ID USER     GROUP    NAME         STAT
                        CPU     MEM        HOSTNAME        TIME<br>
                            13 oneadmin oneadmin ttylinux     runn  
                        4     64M vmh-usnjewr-eqi 00 01:09:54<br>
                        <br>
                        Opennebula Version = 3.0.0 compiled from source<br>
                        Installation Type = Self contained in
                        /srv/cloud/one<br>
                        Hypervisor = KVM<br>
                        Control Server OS: Ubuntu 11.04 LTS<br>
                        KVM Host OS: Ubuntu 11.10 LTS<br>
                        Storage = Non Shared File System<br>
                        <br>
                        Any assistance will be much appreciated.<br>
                        <br>
                        Thanks in Advance.<br>
                        <font color="#888888"> <br>
                          Errol<br>
                          <br>
                          <br>
                          <br>
                          <br>
                          <br>
                        </font></div>
                      <br>
                      _______________________________________________<br>
                      Users mailing list<br>
                      <a href="mailto:Users@lists.opennebula.org" target="_blank">Users@lists.opennebula.org</a><br>
                      <a href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org" target="_blank">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a><br>
                      <br>
                    </blockquote>
                  </div>
                  <br>
                  <br>
                  <fieldset></fieldset>
                  <br>
                  <pre>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opennebula.org" target="_blank">Users@lists.opennebula.org</a>
<a href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org" target="_blank">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a>
</pre>
                </blockquote>
                <br>
              </div>
            </div>
          </div>
          <br>
          _______________________________________________<br>
          Users mailing list<br>
          <a href="mailto:Users@lists.opennebula.org" target="_blank">Users@lists.opennebula.org</a><br>
          <a href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org" target="_blank">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a><br>
          <br>
        </blockquote>
      </div>
      <br>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opennebula.org" target="_blank">Users@lists.opennebula.org</a>
<a href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org" target="_blank">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a>
</pre>
    </blockquote>
    <br>
  </div></div></div>

<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opennebula.org">Users@lists.opennebula.org</a><br>
<a href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org" target="_blank">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a><br>
<br></blockquote></div><br>