How can I use dhcp in openvz

noPa$$word

Renowned Member
Feb 12, 2010
357
42
93
Here's a part of my configuration from a openvz - container:

# CPU fair scheduler parameter
CPUUNITS="1000"
CPUS="1"
HOSTNAME="debian.local.domain"
SEARCHDOMAIN="local.domain"
NAMESERVER="10.10.10.20 10.10.10.22"
NETIF="ifname=eth0,bridge=vmbr1,mac=52:23:C1:CA:3C:29,host_ifname=veth4000.0,host_mac=xx:xx:xx:xx:xx:xx"
VE_ROOT="/var/lib/vz/root/$VEID"
VE_PRIVATE="/var/lib/vz/private/4000"
OSTEMPLATE="debian-6.0-standard_6.0-4_i386.tar.gz"

How can the veth device from a openvz-container use a ip address assigned by dhcp?

regards
K.W.
 
Sorry........
... an how can I find (or the OS from the openvz-container) this device?

Is it to configure in /etc/network/inferfaces or find the OS from the container the network-interface?


regards
K.W.
 
if you use veth, you will see a eth0 inside your container.

depending on the container OS, you need to configure this inside.

for example, for Debian just do the following for dhcp:

Code:
nano /etc/network/interfaces

Code:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
 
I have

NETIF="ifname=eth0,bridge=vmbr0,mac=46:EE:A1:4B:93:5C,host_ifname=veth118.1,host_mac=42:28:FF:DE:30:75"

And



auto eth0iface eth0 inet dhcp
But still the ubuntu server in the container cannot acquire the IP address. How would I debug it?
 
I have the same issue with a container based on Centos 6. I set the configuration inside for dhcp, and restart the network. On the router I see that the dhcp server gave an IP to the mac address of the container, but the container never uses such an IP. It means the packets reach the dhcp server, but never come back.

Is there some configuration on the bridge (I created a new bridge vmbr1) that I need to change? It looks like it needs to support promiscuous mode.
 
Has anyone got this going?.. I have the same problem no go with DHCP and the containers... I see in the DHCP server that the containers are given IP address to match their MAC address.. however.. the machine never gets the IP?????? Please share if you have any info on how to fix this.. otherwise proxmox is a gonner for me! :(
 
Has anyone got this going?.. I have the same problem no go with DHCP and the containers... I see in the DHCP server that the containers are given IP address to match their MAC address.. however.. the machine never gets the IP?????? Please share if you have any info on how to fix this.. otherwise proxmox is a gonner for me! :(

I use dhcp and containers all the time. Give container a vmbr nic, and within the container configure the eth x to use dhcp. Its pretty standard Linux admin stuff.

Sent from my Nexus 5
 
look not that simple at all... I know some linux network.. however I have the container set to DHCP.. in interfaces like

# The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp


however when I request ip.. I get..


root@clone1:/etc/network# invoke-rc.d neworking restart
invoke-rc.d: unknown initscript, /etc/init.d/neworking not found.
root@clone1:/etc/network# invoke-rc.d networking restart
* Reconfiguring network interfaces... Internet Systems Consortium DHCP Client V3.1.3
Copyright 2004-2009 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/f6:0f:71:fe:c6:13
Sending on LPF/eth0/f6:0f:71:fe:c6:13
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8
DHCPOFFER of 10.8.3.13 from 10.8.3.254
DHCPREQUEST of 10.8.3.13 on eth0 to 255.255.255.255 port 67
DHCPREQUEST of 10.8.3.13 on eth0 to 255.255.255.255 port 67
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 9
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 15
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 17
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6
No DHCPOFFERS received.
No working leases in persistent database - sleeping.
ssh stop/waiting
ssh start/running, process 608
 
You have something wrong with either your networking topology or your DHCP server. It works fine for me, as I have about 30 containers running from DHCP, most of which run on VLANs
 
Well... step closer.

I now get DHCP for my Ubuntu machines ok.. when using "VirtIO (paravirtualized)" network model, however not getting network on my Centos6 machine.. no matter what.. I update this post with the fix if I get that going!..
 
Well... step closer.

I now get DHCP for my Ubuntu machines ok.. when using "VirtIO (paravirtualized)" network model, however not getting network on my Centos6 machine.. no matter what.. I update this post with the fix if I get that going!..

How are you using virtio in a container?

Sent from my Nexus 5
 
I am also unable to get dhcp working on centos7. Works on ubuntu.

Update: I got dhcp to finally work on centos7. I was using a template i downloaded manually that didn't work
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!