Creating a bridge in linux
putting your vm's in existing network
When running virtual machines on a host in your home network. You might want to make those vm's first class siticens. Meaning: give them a ipadress in within your existing home network To do this you can use a bridge explain more about what is a bridge
add ip to bridge (instead of nic) if want same network as host
sudo ip link set eno1 down
sudo ip link add name bridget type bridge
sudo ip addr add 192.168.178.55/24 dev bridget
sudo ip link set eno1 master bridget
sudo ip link set eno1 up
sudo ip link set bridget up
sudo ip route add default via 192.168.178.1
another solution is creating a new network for your vm's
create bridge: sudo ip link add name bridget type bridge
bring up: sudo ip link set bridget up
assign ip to bridge with new subnet: ip a add 10.0.0.1/24 dev bridget
start vm (with tap interface) : sudo qemu-system-x86_64 -enable-kvm -m 1024M -cdrom archlinux-2016.09.03-dual.iso -boot order=d -drive file=maria.cow,if=virtio -net nic -net bridge,br=bridget
attach tap interface to bridge : sudo ip link set tap0 master bridget
give guest vm a ip within host subnet: ip a add 10.0.0.2/24 dev ens3 bring interface up: ip link set ens3 up add route in guest (default -> host ip) : ip route add default via 10.0.0.1
enable routing on host echo 1 > /proc/sys/net/ipv4/ip_forward
allow traffic from guest to to outside (internet) source NAT: iptables -t nat -A POSTROUTING --out-interface eno1 -j MASQUERADE
create route from other pc on network to guest ip route add 10.0.0.0/24 via 192.168.178.55