Change netmask inside LXC container

MihaG

Active Member
Jun 16, 2019
23
0
41
48
Hello,

I have some problem with network. To be more specific, I cannot change netmask inside LXC container CentOS 7/8. Is it possible to set/change netmask with pct command? If I change netmask in file /etc/sysconfig/network-scripts/ifcfg-eth0 and run systemctl restart NetworkManager.service nothing happend. Even If I restart LXC container netmask value stays the same as before. Any idea? Thanks.

Regards,
 
Hi,


Yes, you can set it with this command.
Code:
pct set -net<Number> name=eth0,bridge=vmbr0,firewall=1,gw=192.168.0.1,hwaddr=4E:32:86:60:9C:B0,ip=192.168.0.11/20,type=veth

more information you get here
https://pve.proxmox.com/wiki/Linux_Container#pct_configuration

It is not possible to set the IP settings inside the container.
Hello,

thanks for your information. So id I understand correctly, because I use pct with parameter ip=192.168.0.11/32 I get netmask 255.255.255.255. If I used pct with parameter ip=192.168.0.11/20 then I get netmask 255.255.240.0?

I need netmask inside LXC containers 255.255.240.0

Regards,
 

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!