1#!/bin/sh
2
3#################################
4# Set up Ethernet bridge on Linux
5# Requires: bridge-utils
6#################################
7
8# Define Bridge Interface
9br="br0"
10
11# Define list of TAP interfaces to be bridged,
12# for example tap="tap0 tap1 tap2".
13tap="tap0"
14
15# Define physical ethernet interface to be bridged
16# with TAP interface(s) above.
17eth="eth0"
18eth_ip="192.168.8.4"
19eth_netmask="255.255.255.0"
20eth_broadcast="192.168.8.255"
21
22for t in $tap; do
23    openvpn --mktun --dev $t
24done
25
26brctl addbr $br
27brctl addif $br $eth
28
29for t in $tap; do
30    brctl addif $br $t
31done
32
33for t in $tap; do
34    ifconfig $t 0.0.0.0 promisc up
35done
36
37ifconfig $eth 0.0.0.0 promisc up
38
39ifconfig $br $eth_ip netmask $eth_netmask broadcast $eth_broadcast
40