On 9/4/2022 8:39 AM, Rand Pritelrohm wrote:
Consider this simple schematic:

     | VM | -----> | HOST | -----> | GW | -----> ISP


Lets say the physical interface name on the 'host' is eth0 and the LAN
subnet is 192.168.0.0.

I want to configure the network on the 'host' in order for the VM to
access the Internet.

Thus I consider 2 scenarios to setup the 'host' network.


1. Bridge using routed subnet:

     ip link add dev br0 type bridge
     ip addr add 192.168.222.1/24 dev br0
     ip link set dev br0 up

     ip tuntap add tap0 mode tap
     ip link set dev tap0 up
     ip link set dev tap0 master br0

     #Then I have to enable routing
     echo '1' > /proc/sys/net/ipv4/ip_forward
     iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

You are answering your own question, if you masquerade the MAC addr from
the VM will not be seen upstream.

2. Bridge on the same subnet as the LAN:

     ip link add dev br0 type bridge
     ip link set dev br0 up

     ip link set dev eth0 master br0
     ip link set dev eth0 up
     ip addr add 192.168.0.200/24 dev br0
     ip route add default via 192.168.0.1

     ip tuntap add tap0 mode tap
     ip link set dev tap0 up
     ip link set dev tap0 master br0


The MAC addr of the VM will be seen upstream.

For both scenarios the VM is then setup with it's own MAC address and
it's IP on the configured subnet of the bridge.


Here is my question:
     For both scenarios, what is the effectively seen MAC address by the
     GW when the VM access the Internet (host or VM MAC address)?

The best way to answer your question is to get dirty!!! :)

--
John Doe

Reply via email to