Confused about new network scheme

vzfanatic

Active Member
Jul 22, 2008
67
0
26
Hi,

I'm a bit embarrassed to admit it but I'm not quite following the way that networking is done with LXC containers.

It doesn't make sense to me that i should have to setup an ethernet network setting for each ip. why can't i define a range of ips that should be allocated to that container? i've tried to subnet the ip range down by adding /29 and /30 but it doesn't work. i'm unsure if i should use a different gateway or if i should use the main gateway (.1).

for example, if i setup 192.168.1.20/30 shouldn't that give the container 2 ips? at the moment the only lucj i've had is to add multiple interfaces and give each one an ip and it has to be /24 subnet and i dont think this is right.

also, if i want to use vlan, do i have to already set the vlan up in my switch or will it work just setting it in the server container interface.

i've used proxmox a lot of years so i dont think i'm a noob, but i really am having a hard time with this network stuff.

i would really appreciate some examples of how to assign multiple ip's to one interface in a container (debian, not a kvm) and also a working example of a vlan.

thank you all very much.
 
for example, if i setup 192.168.1.20/30 shouldn't that give the container 2 ips? at the moment the only lucj i've had is to add multiple interfaces and give each one an ip and it has to be /24 subnet and i dont think this is right.

please read up on cidr notations.

When you allocate 192.168.1.20/30 to a LXC,

you basically do the same as
ip: 192.168.1.20
netmask: 255.255.255.252

You DO NOT allocate an IP-Range of 192.168.1.20 - 192.168.1.23, but that is rather the the IP's that can be reached from said specific IP because of the subnet you set.

If you want to assign 2 separate iP's via the GUI you need to create 2 separate vNics for the container. Make sure you use the right "/" for the subnet you use. Normally that is "/24", less if you have more then 254 Clients on the same subnet.

If you need help having that translated to oldschool notations. here is a calculator for you:
http://www.subnet-calculator.com/cidr.php
 
Last edited:
Thanks for answering.
I had tried subnetting it using the CIDR before posting.

for example, if in the network i assign 192.168.0.228/30 i can't ping 192.168.0.229 or .230 from the host. even if i change the mask to /24 i can't ping.

should i be breaking the network down by vmbr instead?
 
well, what type of IP is it ??

is it a isp provided IP ?
Or is it a home/company based IP ?

If its the latter, have a look at what your IP /subnet your other machines have set. then just replicate that for the IP/CIDR

e.g. 192.168.2.33 255.255.255.0 --> 192.168.2.33/24

then set the proper gateway for your machine if your home-router is at .200, then your gateway would be 192.168.2.200.

Then make sure you you set a DNS-Server.
If that is e.g. your home-router, then use 192.168.2.200, else use.your.ISP.DNSserver or the google dns at 8.8.4.4 or 8.8.8.8

Not sure what exactly you are trying to do, that fails.
 
Last edited:
It's a class c from the isp. i'd like to assign 16 of the ips from the class c to this server, but when i enter the cidr /28 i can't ping the virtual server. we have a dns server in the class c and im using it.
 
the same would apply. Generally,

You assign each IP of the /28 separately. You then use the appropriate gate-way (depends on ISP config) to connect the IP.


Some ISP's like e.g. ovh work with vMacs, so you go into their Robot, assign that IP to a vMac, then go into proxmox and assign that vMac as Mac to a network device.
some ISP's make you use your hosts IP as a gateway.
Some ISP's make you use a specific Gateway on their network.
Some ISP's make you use a specific IP on the subnet (e.g. .1 or .254)

check your isp's documentation, without knowing how they do it, i cannot even begin to troubleshoot this :)
 
i have to create an eth device for each ip? what's the point of CIDR if i have to add a eth device for each ip?
i have one gateway (.1) and a switch without any vlans on it.
 
yes, you create a vNic for every IP of the subnet that has been assigned to you.

Cidr is just a "language" to describe whats going on.

i could say 10.2.0.1 255.0.0.0
or i could say 10.2.0.1/8

quick question, which ISP you with ?
 
Last edited:
I was just wondering, so i could look up their "way" in their documentation. Typically they have a section where they explain which "way" they use.