how to Add another Subnet with different gateway in proxmox VE

kumarullal

Renowned Member
Jun 17, 2009
184
0
81
LA, USA
First of all I dont have VLAN setup. I however have two local subnets.
The main subnet is 192.168.1.0 (gateway 192.168.1.1 --> T1 line) where all the servers and desktops are connected through the main switch.
Then I have another subnet 192.168.45.0 (Gateway 192.168.45.1 -->DSL line) for testing etc, which is connected to the same main switch so that the subnet 192.168.45.0 can be accessed from any where in the building. As they are both different subnets, they cannot ping one another. However, If you have both IP addresses added in your network configuration on your windows desktop, (192.168.1.x and 192.168.45.x) you can access both the networks internally. Ofcourse, to go out on the internet, once has to choose the gateway, 192.168.1.1 (for T1) or 192.168.45.1 (For DSL)
I have setup proxmox (only one physical NIC) on the 192.168.45.0 subnet. I have all my test VMs running on the 192.168.45.0 subnet. Everything is working fine.
Now, I want to use the proxmox server and create VM on it with 192.168.1.0 subnet, so that it can be used in the production environment.
The problem is when I use
route add -net 192.168.1.0 netmask 255.255.255.0 dev vmbr0
The VM crated with 192.168.1.x IP works great on the internal network (192.168.1.0). But since in the "route add" command, there is no gateway defined (192.168.1.1) it can not go out on the internet. So I can not do anything from the web, like yum, apt-get, wget etc from inside the VM.
so in the command:
Code:
route add -net 192.168.1.0 netmask 255.255.255.0 dev vmbr0
How do I add gateway 192.168.1.1 ?
How to solve this problem?
Many thanks in advance.
 
Last edited:
Code:
route add -net 192.168.1.0 netmask 255.255.255.0 dev vmbr0
How do I add gateway 192.168.1.1 ?

If you use 'bridged' network, you can simply assign the IP/Gateway inside the VM (the VM behave like a physical one connected to the network). Where is the problem?
 
I have used Virtual network while creating the VE. The VE is Centos 5.2. Is there a way to solve the problem?
The file /var/lib/vz/private/100/etc/sysconfig/network-scripts/ifcfg-venet0:0
Has these lines
Code:
DEVICE=venet0:0
ONBOOT=yes
IPADDR=192.168.1.188
NETMASK=255.255.255.255
I added the following line as per your suggestion
Code:
GATEWAY=192.168.1.1
It still does not work. Local IPs are reachable, but not on the internet.
 
Last edited:

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!