Mailing List Archive

how to set static IP for guest/domU from the xen config?
assuming I'm not using DHCP for the guests ---- I want to give them static
IPs so that when I use the guests to setup a cluster , my cluster config
always expects the same IP list.

I see that in a guest VM config, you can specify

vif=['bridge=br,ip=10.0.0.2']

but given this, I log inside guest, the default network interface (eth0)
has not acquired an IP. (bridge "br" was created outside of the bridge
shared with host eth0, so that I can run NAT on the "br" bridge. see steps
at:
http://blog.manula.org/2012/04/manually-configuring-nat-networking-in.html )
so I had to manually ifup the eth0 to 10.0.0.2 inside guest.


since I already specified the IP on config, is there a way to let the guest
automatically pick up the wanted IP , instead of me having to manually run
the "ifup" for each guest? this way I can generate 10 guest configs and
give them different vif=[] params and start all 10 guests without manually
logging into them.
Re: how to set static IP for guest/domU from the xen config? [ In reply to ]
Hello,

On Thu, Jul 08, 2021 at 08:20:29PM -0700, Yang wrote:
> I see that in a guest VM config, you can specify
>
> vif=['bridge=br,ip=10.0.0.2']

That is configuring your dom0's networking. Guest network config is
done inside guest (which is what is happening with DHCP too, so
that's no different).

> since I already specified the IP on config, is there a way to let the guest
> automatically pick up the wanted IP , instead of me having to manually run
> the "ifup" for each guest?

You have to arrange for the guest to configure it. In some Linux
distributions that is possible on kernel command line, e.g. in Red
Hat-like:

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-configuring_ip_networking_from_the_kernel_command_line
https://linuxlink.timesys.com/docs/static_ip

…so at least the two instances of network details would be in the
same place. At least some of that works on Debian/Ubuntu as well.

Still, I'd rather do DHCP.

Cheers,
Andy