I have alpine linux running on virutalbox which works as gateway for my other virtual instances resides on the virtualbox. technically alpine running as virtual router with ip forwarding and masquerading with few support services like dnsmasq for DHCP and DNS. below is my interface setup on virtualbox side
NIC1 -> NAT NIC2 -> INTERNAL(ALPNET) * ALPNET is the name for virutalbox internal network
Inside my alpine instance I configured network as follows
auto lo iface lo inet loopback #NATEd WAN IFACE FROM VBOX auto eth0 iface eth0 inet dhcp hostname alprouter #ALPNET auto eth1 iface eth1 inet static address 192.168.10.1 netmask 255.255.255.0 #ALPNET-VLAN50 auto vlan50 iface vlan50 inet static address 192.168.50.1 netmask 255.255.255.0 vlan-raw-device eth1
I enabled VLAN in kernel modules and other setting for IP forwarding and NAT rules for masquerading outgoing traffic on interface eth0
Chain POSTROUTING (policy ACCEPT) target prot opt source destination MASQUERADE all -- 0.0.0.0/0 0.0.0.0/0
After this I installed debian on virtualbox and configure network from virtualbox side like this
NIC1 -> INTERNAL(ALPNET)
then inside the debian virtual instance I enabled VLAN support and configure 1 physical and 1 vlan interface using NMCLI.
enp0s3 -> 192.168.10.10/24 enp0s8 -> 192.168.50.10/24
then I set All the NICs ON both instances to Promiscuous mode. when all up I can ping to 192.168.50.1 from my debian VM. But as I know it's not because of VLAN configured but the both networks are present in the same gateway and ICMP can reachable via default gateway which is 192.168.10.1
What I trying to achieve is two totally separated VLAN networks based on same virtualbox network interface (ALPNET) withing my virutalbox setup. how can I achieve this? is this possible to do without external physical VLAN tagging device ? Or I have to tag outgoing traffic to VLAN ID inside my virtual router ?