Setting up a Network Bridge on Linux VM (Windows 7 Host)

0

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".

GrandAdmiral

Posted 2013-10-28T21:08:06.157

Reputation: 435

Answers

1

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

GrandAdmiral

Posted 2013-10-28T21:08:06.157

Reputation: 435