Network card settings for VirtualBox on Linux

Once you have installed VirtualBox, you need to configure the Network


sudo apt-get install uml-utilities bridge-utils

Change the user (user) and the network card (physique) (ethx) used.

————–

# Set your machine in VirtualBox to use “Host Interface”, and set
# Interface name to “tap1”. Run this script every time you require the bridge set up,
# before you start your virtual machine.

#!/bin/sh

USERNAME=user # login name of HOST system
DHCP=1 # set to 1 to use dynamic ip for bridge
IP_ADDRESS=192.168.1.1 # static ip address of bridge (only used if DHCP set to 0)

tunctl -t tap1 -u $USERNAME
brctl addbr br0
ifconfig eth0 0.0.0.0 promisc
brctl addif br0 eth0

if [ DHCP = 1 ]; then
dhclient br0
else
ifconfig br0 $IP_ADDRESS
fi

brctl addif br0 tap1
ifconfig tap1 up
chmod 0666 /dev/net/tun

Leave a Reply