<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16981" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN
class=297582806-05032010>Hi,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=297582806-05032010>I want to assign a
static IP 172.16.1.20 to one of the containers created using
libvirt.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=297582806-05032010>For that, I defined
a network 'mynetwork' using <EM>net-define. </EM>The XML format for that network
is shown below:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=297582806-05032010></SPAN></FONT><FONT
face=Arial size=2><SPAN class=297582806-05032010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=297582806-05032010><network><BR>
<name>mynetwork</name><BR>
<uuid>f76c44dd-bcef-6b45-4a50-00d575a369ad</uuid><BR>
<bridge name='virbr1' stp='on' delay='0' /><BR> <ip
address='172.16.1.20' netmask='255.255.255.0'><BR>
</ip><BR></network><BR></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=297582806-05032010>I started the
network 'mynetwork' using <EM>net-start.</EM></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=297582806-05032010><EM></EM></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=297582806-05032010></SPAN></FONT><FONT
face=Arial size=2><SPAN class=297582806-05032010>virsh # net-list
--all<BR>Name
State
Autostart<BR>-----------------------------------------<BR>default active
yes<BR>mynetwork active
no<BR></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=297582806-05032010>I created a domain
'vm1_fedora' with libvirt XML:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=297582806-05032010><domain
type='lxc' id='1'><BR>
<name>vm1_fedora</name><BR>
<memory>500000</memory><BR>
<os><BR>
<type>exe</type><BR>
<init>/bin/bash</init><BR>
</os><BR>
<vcpu>1</vcpu><BR> <clock
offset='utc'/><BR>
<on_poweroff>destroy</on_poweroff><BR>
<on_reboot>restart</on_reboot><BR>
<on_crash>destroy</on_crash><BR>
<devices><BR>
<emulator>/usr/libexec/libvirt_lxc</emulator><BR>
<filesystem
type='mount'><BR>
<source
dir='/root/lxc/fedora12'/><BR>
<target dir='/'/><BR>
</filesystem><BR> <filesystem
type='mount'><BR>
<source
dir='/root/lxc/fedora12/dev'/><BR>
<target dir='/dev'/><BR>
</filesystem><BR> <interface
type='network'><BR>
<source
network='mynetwork'/><BR>
</interface><BR> <console
type='pty' /><BR>
</devices><BR></domain><BR></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=297582806-05032010>But, when I start
that domain and see for 'ifconfig', I am not able to see the IP address
172.16.1.20 there.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=297582806-05032010>[root@localhost /]#
ifconfig<BR>eth0 Link encap:Ethernet HWaddr
52:54:00:53:4D:BF<BR>
inet6 addr: fe80::5054:ff:fe53:4dbf/64
Scope:Link<BR> UP
BROADCAST RUNNING MULTICAST MTU:1500
Metric:1<BR> RX packets:18
errors:0 dropped:0 overruns:0
frame:0<BR> TX packets:6
errors:0 dropped:0 overruns:0
carrier:0<BR> collisions:0
txqueuelen:1000<BR> RX
bytes:840 (840.0 b) TX bytes:384 (384.0 b)</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=297582806-05032010>lo Link
encap:Local Loopback<BR>
inet addr:127.0.0.1
Mask:255.0.0.0<BR> inet6
addr: ::1/128
Scope:Host<BR> UP LOOPBACK
RUNNING MTU:16436
Metric:1<BR> RX packets:0
errors:0 dropped:0 overruns:0
frame:0<BR> TX packets:0
errors:0 dropped:0 overruns:0
carrier:0<BR> collisions:0
txqueuelen:0<BR> RX
bytes:0 (0.0 b) TX bytes:0 (0.0 b)</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=297582806-05032010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=297582806-05032010>can you please let
me know, how can I assign a static IP to the Linux
Container?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=297582806-05032010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=297582806-05032010>Regards,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=297582806-05032010>Srikanth.</DIV></SPAN></FONT></BODY></HTML>