I’m using ubuntu server 20.04 and I’m trying to set up a bridge connection for qemu to tap into. I updated the kernel to 5.14 just to see if that changed anything and it didn’t. The qemu stuff works on windows just fine its only ubuntu that the vm doesn’t get a ip so I think I have done something incorrectly on the networking side. Any recommendations would be really appreciated
my start script v1:
TAPDEV="$1"
BRIDGEDEV=“br0”
ip tuntap add $TAPDEV mode tap
ip link set dev $TAPDEV up
ip link set $TAPDEV master br0
my start script v2
TAPDEV="$1"
BRIDGEDEV=“br0”
tunctl -t $TAPDEV -u ‘user’
brctl addif br0 $TAPDEV
ifconfig $TAPDEV up
ifconfig br0 up
brctl show
this is what I have after running my tap up script:
user@mac-emulation:~/Documents/Test PPC/tap-scripts$ sudo ./tap-up.txt tap1
user@mac-emulation:~/Documents/Test PPC/tap-scripts$ ip addr
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP group default qlen 1000
link/ether 00:50:56:b0:a8:8c brd ff:ff:ff:ff:ff:ff
3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:50:56:b0:a8:8c brd ff:ff:ff:ff:ff:ff
inet 10.5.1.118/20 brd 10.5.15.255 scope global br0
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:feb0:a88c/64 scope link
valid_lft forever preferred_lft forever
16: tap1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel master br0 state DOWN group default qlen 1000
link/ether 26:21:90:a1:ed:fd brd ff:ff:ff:ff:ff:ff
my stop script:
TAPDEV="$1"
BRIDGEDEV=“br0”
sudo ip link delete $TAPDEV
no-carrier on tap1 tells me that qemu is not bothering to use the nic,…in real network cards it means nothing’s plugged into the other end, in tap interfaces it means the device socket is still closed. There’s a few further things I’d test/try out…
what if you used a Linux image in guest?
what if you used e1000 or pcnet instead of sungem
do you see any DHCP requests coming from the tap1 interface in tcpdump -ni tap1; what are they going out on ens160 and getting any replies?
maybe you have iptables forwarding disabled and [sysctls configured to use it on bridge traffic](Net.bridge.bridge-nf-call and sysctl.conf - Libvirt Wiki] in which case tcpdump will show DHCP requests coming in on tap1 and not going out on ens160 , or vice-versa. (I don’t think your VM was up when you got no-carrier, so it’s possible drivers are fine, and other host is just being firewalled).
i don’t see any dhcp requests coming from tap0 or ens160, maybe qemu is never jacking into the tap interface but it doesn’t say no-carrier so its connected?
maybe you have iptables forwarding disabled and [sysctls configured to use it on bridge traffic](Net.bridge.bridge-nf-call and sysctl.conf - Libvirt Wiki] in which case tcpdump will show DHCP requests coming in on tap1 and not going out on ens160 , or vice-versa. (I don’t think your VM was up when you got no-carrier, so it’s possible drivers are fine, and other host is just being firewalled).
X: I don’t get the errors described and i checked /etc/sysconfig/bridge.conf and the lines are there like it says they should be, and running sysctl -p doesn’t give me the key error
Bridges in Linux come with “spanning tree protocol” aka. stp enabled by default (…or is it that most distros enable them? you can disable this as a once off, I’m doubtful it’s what’s causing you issues).
TUNSETIF: Device or resource busy
This is omenous, putting on my rubber ducky hat, it tells me your scripts, or your command line are wrong and you’re opening the tap interface twice somehow.
(sorry, got to head out to work… check the qemu man page as horrible as it is to read, and as lacking in examples as it might be, it may have more details on scripts to use).
So i used wireshark to better look at packets and I did see the dhcp happening on tun0 and on br0! However the offer never gets to tap0, capture in picture is of br0
So it’s probably something to do with iptables? Internal linux networking is French to me haha, but i guess i need to allow these type of requests to my tap devices? (i do plan on making multiple)