On Sun, Sep 4, 2022 at 4:40 PM Rand Pritelrohm <rand.pritelr...@gmx.com> wrote:
> Hello, > > I am not a network specialist and despite a lot of documentation > readings and searchs on the net I haven't get a simple and clear answer > to my question. > > 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 > > > 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 > > > 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)? > > Regards, > Rand. > > MAC is used in L2 networking level and GW is L3 routing hence the MAC is irrelevant. If you run `ip route show` locally all you see is IPs and network interfaces no MACs in there at all.