I would like to bridge between br0 and tap0 for my OpenVPN server, but I get the error at the bottom of this post.
Background
The server have one physical eth0 with IP xxx.xxx.68.58.
The bridge should have xxx.xxx.85.5 and the tap0 NIC, where the OpenVPN clients gets an IP from is in the range xxx.xxx.85.50 - xxx.xxx.85.100.
To make the bridge I do:
#!/bin/bash
br="br0"
tap="tap0"
eth="eth0:0"
eth_ip="xxx.xxx.85.5"
eth_netmask="255.255.255.0"
eth_broadcast="255.255.71.255"
openvpn --mktun --dev $tap
brctl addbr $br
brctl addif $br $eth
brctl addif $br $tap
ifconfig $tap 0.0.0.0 promisc up
echo "debug"
ifconfig $eth 0.0.0.0 promisc up
echo "debug"
ifconfig $br $eth_ip netmask $eth_netmask broadcast $eth_broadcast
but get this error;
Tue Sep 13 10:40:46 2011 TUN/TAP device tap0 opened
Tue Sep 13 10:40:46 2011 Persist state set to: ON
debug
SIOCSIFFLAGS: Cannot assign requested address
SIOCSIFFLAGS: Cannot assign requested address
SIOCSIFFLAGS: Cannot assign requested address
debug
What am I doing wrong?
Update
With set -vx added in the top of the script, I get:
br="br0"
+ br=br0
tap="tap0"
+ tap=tap0
eth="eth0:0"
+ eth=eth0:0
eth_ip="xxx.xxx.85.5"
+ eth_ip=xxx.xxx.85.5
eth_netmask="255.255.255.0"
+ eth_netmask=255.255.255.0
eth_broadcast="255.255.71.255"
+ eth_broadcast=255.255.71.255
openvpn --mktun --dev $tap
+ openvpn --mktun --dev tap0
Tue Sep 13 11:42:33 2011 TUN/TAP device tap0 opened
Tue Sep 13 11:42:33 2011 Persist state set to: ON
brctl addbr $br
+ brctl addbr br0
brctl addif $br $eth
+ brctl addif br0 eth0:0
brctl addif $br $tap
+ brctl addif br0 tap0
ifconfig $tap 0.0.0.0 promisc up
+ ifconfig tap0 0.0.0.0 promisc up
ifconfig $eth 0.0.0.0 promisc up
+ ifconfig eth0:0 0.0.0.0 promisc up
SIOCSIFFLAGS: Cannot assign requested address
SIOCSIFFLAGS: Cannot assign requested address
SIOCSIFFLAGS: Cannot assign requested address
ifconfig $br $eth_ip netmask $eth_netmask broadcast $eth_broadcast
+ ifconfig br0 xxx.xxx.85.5 netmask 255.255.255.0 broadcast 255.255.71.255