dhcp server on vz vps

natxo

Member
May 17, 2008
30
0
6
Hi,

I'm following the instructions in the openvz wiki http://wiki.openvz.org/Virtual_Ethernet_device to get a nic with a mac addres in order to use a dhcp server in the network.

I have tried these two options at the CT0:

# vzctl set 102 --netif_add eth0,00:12:34:56:78:9B,veth102,00:12:34:56:78:9A --save
Warning: --veth_add option is outdated use --netif_add instead
Configure veth devices: veth101.0
According to /etc/vz/conf/102.conf VE102 has no veth interface configured.
/usr/sbin/vznetcfg exited with error
Saved parameters for CT 102

and this:

# vzctl set 102 --netif_add eth0,00:12:34:56:78:9B,veth102,00:12:34:56:78:9A --save
Configure veth devices: veth102
According to /etc/vz/conf/102.conf VE102 has no veth interface configured.
/usr/sbin/vznetcfg exited with error
Saved parameters for CT 102

It doesn't work. Any ideas? TIA!
 
no, not on the web interface.

But you can create a new VM as example, and the compare the config files. The you can manually modify the config file in /etc/vz/conf/

- Dietmar
 
can't I change this after the vm has been created?

yes, it is possible on the web interface. shutdown the machine.

delete the assigned IP address (Virtual Network Addresses (venet)) and click save. now you can select bridge.

but take care: you need to reconfigure the network inside your virtual machine. e.g. on Debian you had venet0:0 and after you select the brigde you need to configure eth0.
 
I did that: powered down the vm, deleted the ip addres, chose bridged network. Powered the vm up.

I try to reconfigure eth0 inside my virtual machine. All seems fine except for the gateway. I I choose the 'normal' gateway (my router) then it doesn't work.

What gatway must I use?
 
I did that: powered down the vm, deleted the ip addres, chose bridged network. Powered the vm up.

I try to reconfigure eth0 inside my virtual machine. All seems fine except for the gateway. I I choose the 'normal' gateway (my router) then it doesn't work.

What gatway must I use?

yes, the "normal" gateway. I just tried this here without problems. Try recheck the network config inside your vm - which distri do you run? maybe you did not changed everything. I assume the problem is inside you vm.
 
this is debian etch.

my /etc/network/interfaces on the vm:

auto eth0
iface inet eth0 static
address 192.168.0.110
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.2
dhcptest:/# ifup eth0
/etc/network/interfaces:5: unknown address type
ifup: couldn't read interfaces file "/etc/network/interfaces"
dhcptest:/# vim /etc/network/interfaces
dhcptest:/# /etc/init.d/networking restart
Reconfiguring network interfaces.../etc/network/interfaces:5: unknown address type
ifdown: couldn't read interfaces file "/etc/network/interfaces"
/etc/network/interfaces:5: unknown address type
ifup: couldn't read interfaces file "/etc/network/interfaces"
failed.
 
Do not use /etc/network/interfaces - it's overwritten at startup.

Instead put your eth0 config in /etc/network/interfaces.template

Code:
auto eth0
iface inet eth0 static
        address 192.168.0.110
        netmask 255.255.255.0
        gateway 192.168.0.2

Does that work?
 
als, no.

the file /etc/network/interfaces.template did not exist in the container, I created it and it looks like:

auto lo
iface inet lo loopback

auto eth0
iface inet eth0 static
address 192.168.0.110
netmask 255.255.255.0
gateway 192.168.0.2

in the log of the host I see this:
May 31 08:00:03 localhost kernel: CT: 104: started
May 31 08:00:10 localhost kernel: CT: 104: stopped
May 31 08:00:10 localhost pvedaemon[20849]: VM 104 created
May 31 08:00:24 localhost pvedaemon[21319]: starting VM 104 on node 0 (localhost
)
May 31 08:00:24 localhost kernel: CT: 104: started
May 31 08:00:25 localhost kernel: device veth104.0 entered promiscuous mode
May 31 08:00:25 localhost kernel: audit(1212213625.007:57): dev=veth104.0 prom=2
56 old_prom=0 auid=4294967295
May 31 08:00:25 localhost kernel: vmbr0: port 3(veth104.0) entering learning sta
te
May 31 08:00:25 localhost pvedaemon[21319]: VM 104 started
May 31 08:00:35 localhost kernel: veth104.0: no IPv6 routers present
May 31 08:00:40 localhost kernel: vmbr0: topology change detected, propagating
May 31 08:00:40 localhost kernel: vmbr0: port 3(veth104.0) entering forwarding s
tate
May 31 08:02:56 localhost kernel: vmbr0: port 3(veth104.0) entering disabled sta
te
May 31 08:02:56 localhost kernel: device veth104.0 left promiscuous mode
May 31 08:02:56 localhost kernel: audit(1212213776.347:58): dev=veth104.0 prom=0
old_prom=256 auid=4294967295
May 31 08:02:56 localhost kernel: vmbr0: port 3(veth104.0) entering disabled sta
te
May 31 08:02:56 localhost kernel: CT: 104: stopped
May 31 08:03:46 localhost kernel: CT: 104: started
May 31 08:03:46 localhost kernel: device veth104.0 entered promiscuous mode
May 31 08:03:46 localhost kernel: audit(1212213826.227:59): dev=veth104.0 prom=2
56 old_prom=0 auid=4294967295
May 31 08:03:46 localhost kernel: vmbr0: port 3(veth104.0) entering learning sta
te
May 31 08:03:56 localhost kernel: veth104.0: no IPv6 routers present
May 31 08:04:01 localhost kernel: vmbr0: topology change detected, propagating
May 31 08:04:01 localhost kernel: vmbr0: port 3(veth104.0) entering forwarding s
tate
May 31 08:04:58 localhost pvedaemon[15236]: apply settings to VM 104 on node 0 (
localhost)

so it looks like the correct vet104.0 is activated (but I know too little yet of vz to understand this).

o well, I got a kvm working for the dhcp server, Dietmar. I mean, it would be nice to have this working but there are other options.
 
Seems that interfaces.template only works for venet, so you need to overwrite /etc/network/interfaces - it should look like:

Code:
auto lo
iface lo inet loopback
 
auto eth0
iface eth0 inet static
        address 192.168.0.110
        netmask 255.255.255.0
        gateway 192.168.0.2

Does that work for you?

- Dietmar
 
hi,

sorry for the delay, it's been busy.

no, this does not help. Anyway, I moved on to kvm for the dhcp service. Thanks!
 

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!