2 Ethernet, 2 Gateway (1 for host and 1 for CT)

kamzata

Renowned Member
Jan 21, 2011
219
9
83
Italy
I have a server with 2 Ethernet. How can configure Proxmox to have: Host with (eth0) address 192.168.10.50, netmask 255.255.255.0, Gateway 192.168.10.1; CT with (eth0) address 192.168.10.51, netmask 255.255.255.0 and (eth1) address 192.168.1.51, netmask 255.255.255.0, Gateway: 192.168.1.1. Any idea?
 
I have a server with 2 Ethernet. How can configure Proxmox to have: Host with (eth0) address 192.168.10.50, netmask 255.255.255.0, Gateway 192.168.10.1; CT with (eth0) address 192.168.10.51, netmask 255.255.255.0 and (eth1) address 192.168.1.51, netmask 255.255.255.0, Gateway: 192.168.1.1. Any idea?
Hi,
use bridged networks and use vmbr0 for 192.168.10.0/24 and vmbr1 for 192.168.1.0/24.
The networkconfig on the host (default gateway) has nothing to do with the networkconfig inside the CT/VM.

Udo
 
Sorry, this is exactly what I would do:

- Host should be 192.168.10.50, netmask 255.255.255.0, gateway 192.168.10.1

- When I connect to CT from outside LAN (internet) through gateway 192.168.1.1 CT should be use ip 192.168.1.51, netmask 255.255.255.0, gateway 192.168.1.1.

- When I connect to CT from inside LAN (192.168.10.x) CT should be use ip 192.168.10.51, netmask 255.255.255.0, gateway 192.168.10.1.

- DNS server should be always 192.168.10.1.
 
so you want the host to use vmbr0 192.168.10.50. (eth0 should not have an IP address)
the guest machine will be multihomed and have vmbr0 & vmbr1 assigned to it. (vmbr0 - eth0 & vmbr1 - eth1. neither eth0 or eth1 have an IP)
in guest - eth0 will be 192.168.10.51/24 gw 192.168.10.1 && eth1 will be 192.168.1.1/24 (no GW as you can only assign one GW to a machine).
DNS set on both NIC's (if it's a windows box) or in resolv.conf (Linux). Simple enough.
 
Ok, this is what i've done:

- Host: i created vmbr0 with bridge port eth0 and I've assigned ip 192.168.10.1, netmask 255.255.255.0, gateway 192.168.10.1. Then I've created vmbr1 with bridge port eth1 and no ip assigned. DNS set to 192.168.10.1
- CT: I added two network device (veth) with respectively eth0 with bridge vmbr0 and eth1 with vmbr1. Then i added /etc/network/interface.tail with this configuration:
Code:
auto eth1
iface eth1 inet static
        address 192.168.1.51
        netmask 255.255.255.0
        gateway 192.168.1.1


auto eth0
iface eth0 inet static
        address 192.168.10.51
        netmask 255.255.255.0

you must ensure that eth1 comes BEFORE eth0 if you want that it is your default net and gateway. DNS set to 192.168.1.1.

But now if I access through host inside CT with vzctl enter command i continue to use 192.168.1.1 gateway and not 192.168.10.1 how I want. How can I do?
 
I believe this is an artifact of putting the veth in the same subnet as the host venet. Do you actually need an address in that subnet? Perhaps to access other VMs?
 
I have this:
CT1.jpg CT2.jpg
and it works fine for me.. This is multihomed to the internet. Temporary solution in place while we are moving things around. works just fine.
 
Last edited:
And is there a way to do something similar with iptables rules? Something like "if www request comes from 192.168.1.1 forwarding to CT 192.168.10.51 and answer with gateway 192.168.1.1" and "if www request comes from 192.168.10.x forwarding to CT 192.168.10.51 and answer with gateway 192.168.10.1".

What do you think?
 

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!