Why bridge interface on ubunty doesn't up with command ip link up?
Assistant
User
i want to connect virtual machine in qemu with remote server in share network. How can i configure this network?
Assistant
User
Explain me with example: set ip qemu machine 192.168.10.1, host ip 192.168.10.2, server ip 192.168.10.3
Assistant
When you create a bridge interface on Ubuntu (or Linux in general) using the ip command, sometimes running ip link set br0 up (assuming your bridge is named br0) does not bring the interface up as you expect. There are several reasons why the bridge interface might not come up just by this command:
Possible Reasons and Explanations
Bridge Interface Has No Member Interfaces Attached
A bridge interface is meant to connect multiple interfaces together. If you create a bridge but do not add any physical or virtual interfaces (like eth0, tap0, etc.) as members, the bridge may not fully initialize or come up as expected.
To add interfaces:
bash
ip link set eth0 master br0
# Then bring up the bridge
ip link set br0 up
ip link set eth0 up
Bridge Interfaces Require Kernel Module bridge
Ensure the bridge kernel module is loaded:
bash
lsmod | grep bridge
If not loaded, load it:
bash
sudo modprobe bridge
NetworkManager or Other Network Services Interference
If your system uses NetworkManager or other network management daemons, they may overwrite, down, or otherwise control interface states. Manually bringing interfaces up/down using ip might conflict with their control.
You can:
Temporarily disable NetworkManager for that interface
Use network management tools to create the bridge instead (e.g., netplan or NetworkManager GUI/CLI)
Or disable NetworkManager for the bridge device
Missing IP Address / Configuration
Bringing the interface up (ip link set br0 up) just makes the link device operational. It does not assign it an IP address or configure routing. If your "not up" means you can't ping or communicate, verify that the bridge is also configured with the proper IP or connected to members that provide connectivity.
Systemd-networkd Configuration Conflict
If you use systemd-networkd, make sure the bridge is defined properly in your .network and .netdev files under /etc/systemd/network. Manually changing interface state via ip link might conflict with the daemon-managed interface.
How to Check Bridge State
Run:
bash
bridge link
bridge vlan
ip addr show br0
Check that the bridge has member interfaces and is operational.
Example: Create and Bring Up a Bridge Interface
bash
sudo ip link add name br0 type bridge
sudo ip link set br0 up
# Add a physical interface to the bridge (replace eth0 with your interface)
sudo ip link set eth0 master br0
sudo ip link set eth0 up
# Assign IP or configure via DHCP on br0 (not on the member interface)
sudo ip addr add 192.168.1.100/24 dev br0
Summary
Simply running ip link set br0 up won't "fully" bring up the bridge if no member interfaces are attached.
Make sure the bridge kernel module is loaded.
Consider network manager or systemd-networkd conflicts.
Attach member interfaces and bring them up as well.
Configure IP on the bridge interface, not on member interfaces.
If you provide the exact commands you ran and the results of ip addr show br0 or bridge link I can help diagnose further.
To connect a QEMU virtual machine (VM) to a remote server on a shared network, you want the VM to appear as part of the same network as the remote server, so they can communicate directly. There are several ways to achieve this, depending on your environment and requirements, including:
Using a bridge network on the host machine
Using macvtap
Using user networking with port forwarding (limited, not full networking)
Using a tap interface + bridge
The best common and robust method is to create a Linux bridge interface on the host, attach your physical network interface and the VM's virtual NIC to this bridge; then your VM behaves like a peer on your LAN.
Step-by-step Guide: Setting Up Bridged Networking for QEMU VM on Ubuntu
1. Create a Linux Bridge on the Host
This makes the VM’s virtual network interface part of the LAN, alongside your host and remote server.
Using netplan (Ubuntu 18.04+)
Let’s assume your physical interface is enp3s0.
Edit /etc/netplan/01-netcfg.yaml or create a new file in /etc/netplan/:
yaml
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
dhcp4: no # We'll assign IP to bridge instead
bridges:
br0:
interfaces: [enp3s0]
dhcp4: yes # Or static IP config here
parameters:
stp: false
forward-delay: 0
This configures a new bridge br0 that includes the physical NIC enp3s0.
The bridge gets an IP address (DHCP or static).
The physical NIC does not get an IP directly (only br0 does).
Apply the changes:
bash
sudo netplan apply
Verify:
bash
ip addr show br0
bridge link
You should see br0 UP with IP and enp3s0 enslaved as a member.
2. Start QEMU with the VM attached to the bridge
When launching your VM via qemu-system-x86_64, create a TAP device that connects the VM NIC to the bridge.
Create a TAP interface
For simplicity, on the host:
bash
sudo ip tuntap add dev tap0 mode tap user $(whoami)
sudo ip link set tap0 up
script=no,downscript=no means QEMU does not try to create or remove the tap device for you—it's managed manually.
ifname=tap0 matches the manually created tap device.
e1000 is the virtual NIC device model; you can adjust as needed.
3. VM network configuration
Inside the VM:
Configure the VM guest OS NIC to get an IP address from the same network as your host.
For example, if your LAN uses DHCP, the VM will get DHCP lease from your network's router.
After configuration, you should be able to ping your remote server on the shared network.
4. Firewall and permissions
Make sure your host firewall allows bridged traffic.
If you use ufw or iptables, allow forwarding between br0 and tap0.
The tap device must be created with the same user that runs QEMU or have appropriate permissions.
Alternative: Using libvirt (if you prefer GUI/management tools)
libvirt has built-in tools to create bridges and connect VMs easily. virt-manager provides GUI; virsh CLI tools provide management.
Summary
Step
What it does
Create Linux bridge
Creates a virtual switch bridging physical NIC
Attach physical NIC
Connects host's NIC to the bridge network
Create tap0 device
Tap interface connects VM NIC to bridge
Attach tap0 to bridge
Joins tap0 and physical NIC on same subnet
Launch QEMU with tap0
VM uses bridged networking, gets LAN IP
Configure VM networking
VM boots, obtains IP, communicates on LAN
If you want me to provide an example netplan file for your interface, or a fully automated script to create tap device, or alternative solutions (macvtap, user-mode networking + port forwarding), just ask!
Certainly! You want to set up a QEMU virtual machine, your host, and a remote server (or another machine on the network) on the same subnet, say 192.168.10.0/24, with these fixed IP addresses:
QEMU VM: 192.168.10.1
Host: 192.168.10.2
Server: 192.168.10.3
And you want all three to be able to communicate as if they are on the same network. Here's how you can do this step-by-step with a bridged networking setup on the host.
Assumptions
Host physical network interface: enp3s0 (replace with your actual NIC name)
Server (192.168.10.3) is physically reachable on the same LAN as the host NIC
You want to assign static IPs (no DHCP)
You have root access on host and VM
Step 1: Create a Linux Bridge on Host with Static IP 192.168.10.2
Let’s configure a bridge device br0 on the host that includes enp3s0, and assign it the fixed IP 192.168.10.2.
If you're using netplan (Ubuntu 18.04+), create/edit /etc/netplan/01-netcfg.yaml:
yaml
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
dhcp4: no # We don't want IP on physical interface
bridges:
br0:
interfaces: [enp3s0]
dhcp4: no
addresses:
- 192.168.10.2/24
gateway4: 192.168.10.254 # Put your gateway IP here (if needed)
nameservers:
addresses: [8.8.8.8,8.8.4.4]
parameters:
stp: false
forward-delay: 0
Apply it:
bash
sudo netplan apply
Check:
bash
ip addr show br0
# Should see br0 with ip 192.168.10.2/24 and enp3s0 enslaved.
ping 192.168.10.3
Step 2: Create TAP interface and attach to Bridge
Make a tap device that QEMU VM will use for its NIC.
bash
sudo ip tuntap add dev tap0 mode tap user $(whoami)
sudo ip link set tap0 up
sudo ip link set tap0 master br0
Now tap0 is part of the bridge, like a virtual switch port.