Using Linux as a bridge
by Traumatan from LinuxQuestions.org on (#55NCB)
My goal is to build a setup for a man-in-the-middle-attack. I have 2 VMs in Virtual Box. I want to create the following setup with VM1 being the attacker:
Outside world <-----> VM 1 <-----> VM 2
VM 1 has 2 interfaces. I want all traffic to pass VM1 unchanged as if it was not there. I think that VM1 needs to act like a bridge. I tried to make it work with Netplan but I failed.
What is wrong with the following Netplan config? Or is there an easier way that I can not see?
Code:network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: false
dhcp6: false
enp0s8:
dhcp4: false
dhcp6: false
bridges:
br0:
interfaces: [enp0s3,enp0s8]
addresses: [192.168.0.239/24]
gateway4: 192.168.0.1
mtu: 1500
nameservers:
addresses: [8.8.8.8]
parameters:
stp: true
forward-delay: 4
dhcp4: no
dhcp6: no


Outside world <-----> VM 1 <-----> VM 2
VM 1 has 2 interfaces. I want all traffic to pass VM1 unchanged as if it was not there. I think that VM1 needs to act like a bridge. I tried to make it work with Netplan but I failed.
What is wrong with the following Netplan config? Or is there an easier way that I can not see?
Code:network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: false
dhcp6: false
enp0s8:
dhcp4: false
dhcp6: false
bridges:
br0:
interfaces: [enp0s3,enp0s8]
addresses: [192.168.0.239/24]
gateway4: 192.168.0.1
mtu: 1500
nameservers:
addresses: [8.8.8.8]
parameters:
stp: true
forward-delay: 4
dhcp4: no
dhcp6: no