[one-users] Configure - Script Network - Init
Miguel J. - Templeir
mjcampos at citic.es
Wed Mar 18 04:55:09 PDT 2009
Yes, Script generate correctly files, but it has not been generate
before that network interface has been initialized.
This is my Question, How can I init script before network interfaz had
been initialized?
I've initialize script after network interfaz with "rc-update.d "
<In Debian>, but I don't know how to launch it before the initialitation.
Javier Fontan escribió:
>
> Hello,
>
> Have you tried connecting to the running VM (using xm console) and
> checking if the script executed correctly and the network
> configuration files are generated?
>
> The idea is to have this script executed before the network init
> script so the configuration files for the network interfaces are
> configured before the network is started up. As I told you in the
> previous mail it will be good that you try the configuration generated
> manually (again, inside the console of the VM).
>
> Tell me if you have more specific questions.
>
> Bye
>
> On Mar 18, 2009, at 9:46 AM, Miguel J. - Templeir wrote:
>
>> VM work correctly and create and destroy without problems.
>>
>> My Question is in the boot of VM. When any VM is booting, Open Nebula
>> with the vnet configuration assign a MAC to this VM. This MAC with
>> this script, change IP address and configuration network. Then I
>> restart interfaces network to update IP and configuration but I want
>> to setup files of interfaz before init the script network of RC.
>>
>> For example in ubuntu: /etc/init.d/network
>>
>> Javier Fontan escribió:
>>>
>>> Hello Miguel,
>>>
>>> Have you checked that your VM is up and running? Issue a onevm list
>>> command to see the state and if it is "runn" you can also see what
>>> physical node is executing it. In case you are using xen hypervisor
>>> you can go to that node a use xm console one-<vmid> to open a
>>> console to that VM and see what is happening and check if the
>>> network was correctly configured.
>>>
>>> I am not so familiarized with Centos networking scripts but if that
>>> scripts are correctly configured after the init script that brings
>>> up the net it should work. Check the generated scripts and try to
>>> bring up the network manually.
>>>
>>> Bye
>>>
>>> On Mar 17, 2009, at 12:23 PM, Miguel J. - Templeir wrote:
>>>
>>>> Hello
>>>>
>>>> I've finished the configuration of Open Nebula, with the Front End
>>>> (master-nebula) and the Clusters (nebula 1, 2, ...).
>>>>
>>>> But when I created a vm from master-nebula:
>>>>
>>>> onevm create centos-public.one
>>>>
>>>> When I created the vm, I'm execute:
>>>>
>>>> onevnet show 0 (the id of VLAN)
>>>>
>>>> This command show the ip of VM. So, I can connect via ssh, but I
>>>> couldn't connect.
>>>>
>>>> -------
>>>>
>>>> I use script:
>>>> http://www.opennebula.org/doku.php?id=documentation:howto_vnet
>>>>
>>>> And modify some lines for the differents distributions of Unix. The
>>>> script for centos 5.2:
>>>>
>>>> ------------
>>>> #!/bin/bash
>>>> #
>>>> # chkconfig: 2345 10 90 -- Priority RC, Init
>>>> after interfaz network. But i want before.
>>>> # description: network reconfigure
>>>> # #
>>>> --------------------------------------------------------------------------
>>>> #
>>>> # Copyright 2002-2009, Distributed Systems Architecture Group,
>>>> Universidad #
>>>> # Complutense de Madrid
>>>> (dsa-research.org) #
>>>> #
>>>> #
>>>> # Licensed under the Apache License, Version 2.0 (the "License");
>>>> you may #
>>>> # not use this file except in compliance with the License. You may
>>>> obtain #
>>>> # a copy of the License
>>>> at #
>>>> #
>>>> #
>>>> #
>>>> http://www.apache.org/licenses/LICENSE-2.0
>>>> #
>>>> #
>>>> #
>>>> # Unless required by applicable law or agreed to in writing,
>>>> software #
>>>> # distributed under the License is distributed on an "AS IS"
>>>> BASIS, #
>>>> # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>>>> implied. #
>>>> # See the License for the specific language governing permissions
>>>> and #
>>>> # limitations under the
>>>> License. #
>>>> #---------------------------------------------------------------------------
>>>> #
>>>>
>>>> # Gets IP address from a given MAC
>>>> mac2ip() {
>>>> mac=$1
>>>> let ip_a=0x`echo $mac | cut -d: -f 3`
>>>> let ip_b=0x`echo $mac | cut -d: -f 4`
>>>> let ip_c=0x`echo $mac | cut -d: -f 5`
>>>> let ip_d=0x`echo $mac | cut -d: -f 6`
>>>> ip="$ip_a.$ip_b.$ip_c.$ip_d"
>>>> echo $ip
>>>> }
>>>> # Gets the network part of an IP
>>>> get_network() {
>>>> IP=$1
>>>> echo $IP | cut -d'.' -f1,2,3
>>>> }
>>>> get_interfaces() {
>>>> IFCMD="/sbin/ifconfig -a"
>>>> $IFCMD | grep ^eth | sed 's/ *Link encap:Ethernet.*HWaddr /-/g'
>>>> }
>>>> get_dev() {
>>>> echo $1 | cut -d'-' -f 1
>>>> }
>>>> get_mac() {
>>>> echo $1 | cut -d'-' -f 2
>>>> }
>>>> gen_hosts() {
>>>> NETWORK=$1
>>>> echo "127.0.0.1 localhost"
>>>> for n in `seq -w 01 99`; do
>>>> n2=`echo $n | sed 's/^0*//'`
>>>> echo ${NETWORK}.$n2 cluster${n}
>>>> done
>>>> }
>>>> gen_exports() {
>>>> NETWORK=$1
>>>> echo "/images ${NETWORK}.0/255.255.255.0(rw,async,no_subtree_check)"
>>>> }
>>>> gen_hostname() {
>>>> MAC=$1
>>>> NUM=`mac2ip $MAC | cut -d'.' -f4`
>>>> NUM2=`echo 000000$NUM | sed 's/.*\(..\)/\1/'`
>>>> echo cluster$NUM2
>>>> }
>>>> gen_interface() {
>>>> DEV_MAC=$1
>>>> DEV=`get_dev $DEV_MAC`
>>>> MAC=`get_mac $DEV_MAC`
>>>> IP=`mac2ip $MAC`
>>>> cat <<EOT
>>>> DEVICE=$DEV
>>>> BOOTPROTO=none
>>>> HWADDR=$MAC
>>>> ONBOOT=yes
>>>> TYPE=Ethernet
>>>> NETMASK=255.255.255.0
>>>> IPADDR=$IP
>>>> EOT
>>>> if [ $DEV == "eth0" ]; then
>>>> echo " GATEWAY=$NETWORK.1"
>>>> fi
>>>> echo ""
>>>> }
>>>> IFACES=`get_interfaces`
>>>> for i in $IFACES; do
>>>> MASTER_DEV_MAC=$i
>>>> DEV=`get_dev $i`
>>>> MAC=`get_mac $i`
>>>> IP=`mac2ip $MAC`
>>>> NETWORK=`get_network $IP`
>>>> done
>>>> # gen_hosts $NETWORK > /etc/hosts
>>>> # gen_exports $NETWORK > /etc/exports
>>>> # gen_hostname $MAC > /etc/hostname
>>>> (
>>>> cat <<EOT
>>>>
>>>> EOT
>>>>
>>>> for i in $IFACES; do
>>>> gen_interface $i
>>>> done
>>>> ) > /etc/sysconfig/network-scripts/ifcfg-${DEV}
>>>>
>>>> # *Two lines, bellow:
>>>> This lines restarting network to re-configure IP with the new
>>>> configuration. Because when the Os start, Mac Address Change to
>>>> change IP.
>>>>
>>>> This script run correctly but I've been trying to configure RC to
>>>> avoid reset interfaz network. I think that I don't know configure
>>>> correctly RC in Centos 5.2, ubuntu 8.04.1. And the question is...
>>>> How I can configure RC to init the script correctly without reset
>>>> interfaces network?
>>>>
>>>> **ifdown
>>>> $DEV
>>>> ifup $DEV*
>>>>
>>>> exit $RETVAL
>>>> # /bin/hostname `cat /etc/hostname`
>>>> ------------------
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at lists.opennebula.org
>>>> http://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
>
More information about the Users
mailing list