[Openstack-operators] Automatically configuring guest hosts with multiple NIC's
Antonio Messina
antonio.s.messina at gmail.com
Mon Jun 2 14:13:54 UTC 2014
On Fri, May 30, 2014 at 2:44 PM, Pavel Veretennikov <admin at movenix.com> wrote:
> Hello,
>
> For example I have guest host with two (or more) network ports, connected to
> different networks. Both networks have DHCP servers running.
> Is there a way automatically bring up second (third etc) interface and
> assign IP address from DHCP upon reboot or even on-the-fly? Some cloud-init
> magic maybe?
If you have DHCP server running, you don't need any cloud-init magic,
you just have to configure the "extra" network interfaces.
In my rc.local (in debian/ubuntu) I've put a small script to check for
each ethernet interface (eth*) if it's already defined in
/etc/network/interfaces, and in case it's not, define it and bring it
up.
It looks like:
for iface in $(ip -o link | cut -d: -f2 | tr -d ' ' | grep ^eth)
do
egrep -q "^iface\s+$iface" /etc/network/interfaces
if [ $? -ne 0 ]
then
echo -e "auto $iface\niface $iface inet dhcp\n" >>
/etc/network/interfaces
ifup $iface
fi
done
.a.
--
antonio.s.messina at gmail.com
antonio.messina at uzh.ch +41 (0)44 635 42 22
GC3: Grid Computing Competence Center http://www.gc3.uzh.ch/
University of Zurich
Winterthurerstrasse 190
CH-8057 Zurich Switzerland
More information about the OpenStack-operators
mailing list