Change netmask inside LXC container

MihaG

Active Member
Jun 16, 2019
23
0
41
49
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,