Network not working

MIKI785

New Member
Dec 2, 2015
10
0
1
Hello,
I have 6 IPs available but I have no idea how to give a container an IP, ive tried many different cofigurations, searching all over the place and didn't find a working solution. How do you assign an IP to a container?
 
Hi,
pleas be more precisely because PVE 3 and 4 are complete different.
and where is the box hosted?
 
Im using version 4, ive tried many different ip configurations and both openvz and KVM but the network is always unrecheable.
What do you mean by box? The server? Thats hosted at a1dedicatedservers.com.
 
yes box = server ;-)
By the side PVE4 has no OpenVZ, we have now LXC.
I don't know the hoster but may by he has a mac filter?
Is your gateway in the same subnet?
If not you may add the route manually, dependence on what Distribution you are.
 
I dont know about the mac filter, ive got 6 ips, one main ip and 5 additional ones that i want to use for the containers, but those additional ones are completely different to the main one but theyve told me to use the same gateway as for the main IP which is the same as the main IP but ending 254.
I dont know much about networking so could you maybe post an example of interfaces file that i should use?
 
Send a config of your Host and Vm/LXC
and also the output from both. "route -n"
 
Host interfaces:
Code:
auto loiface lo inet loopback
iface eth0 inet manual


auto vmbr0
iface vmbr0 inet static
	address 94.23.250.xxx
	netmask 255.255.255.0
        gateway 94.23.250.254
        bridge_ports eth0
        bridge_stp off
        bridge_fd 0
		
auto eth0:0
iface eth0:0 inet static
	address 5.196.158.xxx
	netmask 255.255.255.0
	broadcast 5.196.158.xxx
	gateway 94.23.250.254

Host route -n:
Code:
Kernel IP routing tableDestination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         94.23.250.254   0.0.0.0         UG    0      0        0 vmbr0
5.196.158.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
94.23.250.0     0.0.0.0         255.255.255.0   U     0      0        0 vmbr0

Container interfaces:
Code:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet manual

Container route -n returns empty table.

I did a lot of editing so the configs might be completely wrong.
 
I think 5.196.158.xxx is you public Host ip

then config should lock like this.

auto loiface lo inet loopback

iface eth0 inet manual


auto vmbr0
iface vmbr0 inet static
address 5.196.158.xxx
netmask 255.255.255.0
gateway 94.23.250.254
bridge_ports eth0
bridge_stp off
bridge_fd 0
and the container the nic is not set!

can you please send the config of /etc/pve/lxc/<ContainerNR>.conf located on the host.


 
No, the 94.23.250.xxx is the host IP, that is the main one and that is the one I use to connect to the host. The 5.196.158.xxx is extra one that I bought, that should be used for the containers.

and the container the nic is not set!

What do you mean?

/etc/pve/lxc/<ContainerNR>.conf:
Code:
[/COLOR]arch: amd64cpulimit: 4
cpuunits: 1024
hostname: gamma
memory: 8192
net0: bridge=vmbr0,gw=94.23.250.xxx,hwaddr=E6:5B:AB:46:B2:97,ip=5.196.158.196/24,name=eth0,type=veth
ostype: debian
rootfs: local:100/vm-100-disk-1.raw,size=128849018880

swap: 512[COLOR=#333333]
 
Then erase the eth0.0 path from the host ifconfig.
and restart the host, because Debian some times do not apply the network settings correct after changing them.

The container network config is ok.
 
Ill try that, so the bridge should be vmbr0 and the IP set to 5.196.158.xxx for the container in proxmox UI?
Up until now i never restarted the host ive only did service networking restart, is that not enough?
 
Correct.

All network setting for the container can be done by GUI.

Debian has same strange behavior on Network service since version 8 related to systemd.
To be sure please reboot.
 
It doesn't work.. the hosting support told me to use mac addresses (that they've now gave me for each IP) instead of IP, I have no idea what they mean by that. Do you know?
Edit: I guess it means to specify the mac address for the eth0 for the container, I did that but it still doesn't work and the web UI doesn't let me specify gateway.
 
Last edited:
Yes this is correct.
What do you mean whit
"the web UI doesn't let me specify gateway"
exactly?

You can connect to the host and the host can connect to the internet?
 
The UI doesn't let me put in the gateway because when I do and click 'save' it just disappears (the gateway). I tried putting it directly into the .conf file of the container, it then showed it in the UI. Then I rebooted the container and tried route -n but the gateway was still 0.0.0.0.

The container can't connect to the host, when I try to connect anywhere it just says that network is unreachable. The host is connected to the internet and works fine.
 
You need interface set properly. Here is what i use for my OVH VPS

Code:
auto eth0
iface eth0 inet static
    address 198.50.234.20
    netmask 255.255.255.255
    broadcast 198.50.234.20
    post-up route add 192.99.18.254 dev eth0
    post-up route add default gw 192.99.18.254
    pre-down route del 192.99.18.254 dev eth0
    pre-down route del default gw 192.99.18.254

I think you have to do it via console. That is how i done for my OVH Proxmox VPS
 
Thank you so much, that snippet was all i needed, I had exactly the same thing but I had 'via' after the 'gw's, that's what the guides said, removed them and now it works.
 

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!