[SOLVED] Assigning two IPv4 subnets to one server

wdq

New Member
Jul 19, 2013
4
0
1
There are already some threads on here with some information on assigning multiple subnets to one Proxmox VE server, but none of them have been able to help me.

I have one dedicated server in a datacenter that has one Ethernet port. I have had a /29 subnet assigned to the server for a few weeks now, but recently ordered a /30 subnet and have been spending my day trying to figure out how to set it up. Below is some information on each subnet.

Size: /29
Addresses: 199.x.x.34 - 199.x.x.46
Gateway: 199.x.x.33
Netmask: 255.255.255.240

Size: /30
Addresses: 162.x.x.218 - 162.x.x.222
Gateway:
162.x.x.217
Netmask:
255.255.255.248


Here is my current /etc/network/interfaces file on the host machine.

auto loiface lo inet loopback


auto eth0
iface eth0 inet static
address 199.x.x.34
netmask 255.255.255.240
gateway 199.x.x.33
broadcast 199.x.x.47


auto vmbr0
iface vmbr0 inet static
address 199.x.x.34
netmask 255.255.255.240
gateway 199.x.x.33
bridge_ports eth0
bridge_stp off
bridge_fd 0


How do I go about assigning the additional subnet to my dedicated server? I have tried to just create vmbr1 just like how vmbr0 is configured, but with the new subnet information, but when I create a new OpenVZ VPS and give it an IP address from that subnet it won't work.

If possible I'd prefer to be able to set all of this up through SSH and then just restart some services instead of restarting the entire machine.
 
Last edited:
Hi,from my experience one can't have two default gateways on same server.The default gateway for one subnet could be on the server. For other subnet gateways should be somewhere else.In my situation on some servers I've got configuration like this:
1. no ip address for ETH devices where briges are configured, only for br devices.
2. I've got router with different subnets on different vlans; let's say vlan X 1.1.1.0/24 (with ip 1.1.1.1/24) and vlan Y 2.2.2.0/24 (with ip 2.2.2.1/24)
3. so using switches I send these vlans to port, where my proxmox server is. That port is configured in "trunk" mode and has both vlans on it configured.
4. on proxmox server I create these two vlans and bridge for each of them.
5. then I configure br0 with ip 1.1.1.1.10/24 and br1 with ip 2.2.2.10/24 without default gateways.
6. then, when I create VM on appropriate br and set an IP from that br subnet (ie for vlan X it would be 1.1.1.15/24 and gw would be 1.1.1.1 (the ip of interface on my router))
7. for network on my proxmox server I've got another eth (without bridges) configured with /30 network network with default gw
so something like this.
 
Last edited:
Thanks for the information. Is there any way to do something similar without a router?
 
Have not tried myself, but you could try to do it like this:
1. configure one interface with default gateway (I suggest it would be /30?) on one interface
2. configure second interface for work with proxmox (bridge) but without default gateway (/29?) for your VMs. Then configure created VM's network interface to use the second interface's IP as default gateway.

If you have only one network interface, try to do the same, using vlans, but I affraid, that you will lose connectivity with youur server
 
I feel like an idiot. For OpenVZ all I have to do is edit /etc/vz/vz.conf so that NEIGHBOUR_DEVS=all. I'll probably end up figuring out KVM soon.
 
Oh, didn't think you were asking about vz containers.. But you still can't have two default gateways. You have to remove one and set up routing manually using ip route command... Read about multiple default gateways for same host on google. For kvm you'll have to add post-up script for bridge with manually added routing to get it working after reboot also.
 

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!