2nd NAT Network with access to the Internet

abacao

New Member
Sep 1, 2023
3
0
1
Hello all,

I want to have a segregated network configuration for a group of VMs but I only have one NIC.

vmbr0 is working fine and I wanted to have a vmbr1 with a different IP set just for all the VMs in that network.

I was able to create vmbr1 and attach it to 2 VMs.
I can ping VM1 from VM2 and vice-versa.

Now I want to add internet to that network.

How can that be done?
 
Thank you.

For later help, I was able to add this with success.

vim /etc/network/interfaces

Code:
auto vmbr1
iface vmbr1 inet static
        address 10.10.10.1/24
        bridge-ports none
        bridge-stp off
        bridge-fd 0
#Private LAN RC

post-up   echo 1 > /proc/sys/net/ipv4/ip_forward
post-up   iptables -t nat -A POSTROUTING -s 10.10.10.0/24 -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s 10.10.10.0/24 -o vmbr0 -j MASQUERADE
post-up   iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1


Remember that you need to setup IPs by hand as we don't have a DHCP server.