Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to use NetEm to simulate a low bandwidth environment while testing an Internet-connected device. My plan is to setup a bridge in a Linux VM (Linux Mint 13) on a Windows 7 host. Unfortunately I'm having trouble setting up the bridge. Then I can use NetEm in the Linux VM to limit the bandwidth to an external device. I went with the following script:

ifconfig eth0 0.0.0.0 promisc up
ifconfig eth1 0.0.0.0 promisc up

Then create the bridge and bring it up:

brctl addbr br0
brctl setfd br0 0
brctl addif br0 eth0
brctl addif br0 eth1
dhclient br0
ifconfig br0 up

When I run that script, I see the following warning:

Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service smbd reload

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the reload(8) utility, e.g. reload smbd

The device connecting to the bridge is able to obtain an IP Address, but it can only ping the IP Address of the bridge (both are 10.2.32.xx). Then after a few minutes, other parts of our network go down. I'm not sure why, but once I kill the bridge the network is fine.

Is it possible to setup a network bridge in a Linux VM? Do I need to do something else with the dhclient br0 part of the script?

By the way, I'm using VirtualBox. The wired connection is eth0 and the wireless connection is eth1. The wired connection is connecting to the device and the wireless connection is going to the network. Both adapters are set up as bridged adapters with promiscuous mode set to "allow all".

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

I can't say for certain that running Linux in a VM on a Windows 7 Host was a problem with setting up the bridge, but I have found evidence that the bridge won't work with a wireless card. The Linux Foundation answers that question with:

This is a known problem, and it is not caused by the bridge code. Many wireless cards don't allow spoofing of the source address.

I found information about setting up the bridge to replace the MAC Address of the connected device with the MAC Address of the wireless NIC, but that is more complicated than I want to pursue. Instead I set up an old PC with two wired NICs. Now I just use the following script to set up a bridge:

#!/bin/bash

# Set the interfaces to promiscuous mode
ifconfig eth0 0.0.0.0 promisc up
ifconfig eth1 0.0.0.0 promisc up

# Create the bridge
brctl addbr br0
brctl setfd br0 0
brctl addif br0 eth0
brctl addif br0 eth1

# Bring it up
ifconfig br0 up
dhclient br0
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.