macOS-Simple-KVM icon indicating copy to clipboard operation
macOS-Simple-KVM copied to clipboard

how to setup to bridge host network?

Open jonnyman12345 opened this issue 2 years ago • 2 comments

how to setup to bridge host network?

jonnyman12345 avatar Aug 05 '21 06:08 jonnyman12345

for wifi ,the netdev default in foxlet's command with e1000 is ok with host so I guess you talk of setting up a bridge for host ethernet connection. let's try #!/bin/sh

create bridge br0,activate it

ip link add br0 type bridge ip link set br0 up

create a tap1 device for guest connection: create,activate,plug into bridge

ip tuntap add QemuTap1 mode tap user "votre_serviteur" ip link set QemuTap1 up ip link set QemuTap1 master

get real ethernet interface seen by mint-host,plug into br0

ethernet=ip link list | awk '{print $2}' | grep en ip link set $ethernet up ip link set $ethernet master br0

Now run this script before you launch "qemu VM" where you have to replace the two lines

-netdev user,id=net0 \
-device e1000-82545em,netdev=net0,id=net0,mac=52:54:00:c9:18:27 \

by the two following

-netdev tap,ifname=QemuTap1,id=net0,script=no \
-device e1000-82545em,netdev=net0,id=net0,mac=52:54:00:c9:18:27 \

when VM reaches networking in boot phase ,the QemuTap1 triggers the virtual device connect but the bridge just disconnect due to this Tap connection probably you have to reenable the bridge in host by executing ip link set br0 up

That's it for ethernet on your virtual mac ;

all that can be summarised as one line command

BridgeTapEthernet ; qq VM ;BridgeUp

Very probably you won't be able to plug wifi on the bridge for fun

hope that helps hoan3504 a.k.a nhakue_mac

hoan3504 avatar Oct 21 '21 13:10 hoan3504

correction : instead of ip link set QemuTap1 master it should be ip link set QemuTap1 master br0

hoan3504 avatar Oct 21 '21 13:10 hoan3504