I am trying to create an ethernet bridge between my server subnet on 10.0.0.0 with server IP at 10.0.0.2 and gateway 10.0.0.1. My client is on subnet 192.168.0.0. I assigned a pool of addresses for openvpn from 10.0.0.105 to 10.0.0.115. This does not confict with my DHCP that starts at 10.0.0.200. The authentication seems to work, and I see that the client gets assigned IP 10.0.0.105. If I try to ping 10.0.0.105 from the server, I get Host Unreachable, and if I try to ping 10.0.0.2 from the client, I also get host unreachable. Here are all the specific logs and scripts that I can think of. I am new to setting up networking stuff on Linux, so I am probably doing something stupid. I have been banging my head against the wall for several days searching forums for answers. Any help is appreciated.
This is what happens when I ping the client from the server
root@Mustang:/home/johancsi# ping 10.0.0.105
PING 10.0.0.105 (10.0.0.105) 56(84) bytes of data.
From 10.0.0.2 icmp_seq=1 Destination Host Unreachable
From 10.0.0.2 icmp_seq=2 Destination Host Unreachable
From 10.0.0.2 icmp_seq=3 Destination Host Unreachable
^C
--- 10.0.0.105 ping statistics ---
4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2999ms
pipe 4
root@Mustang:/home/johancsi#
This is what happens when I ping the server from the client
root@graymatter:/home/johancsi# ping 10.0.0.2
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
From 10.0.0.105 icmp_seq=1 Destination Host Unreachable
From 10.0.0.105 icmp_seq=2 Destination Host Unreachable
From 10.0.0.105 icmp_seq=3 Destination Host Unreachable
From 10.0.0.105 icmp_seq=4 Destination Host Unreachable
From 10.0.0.105 icmp_seq=5 Destination Host Unreachable
From 10.0.0.105 icmp_seq=6 Destination Host Unreachable
^C
--- 10.0.0.2 ping statistics ---
7 packets transmitted, 0 received, +6 errors, 100% packet loss, time 6031ms
pipe 3
root@graymatter:/home/johancsi#
server.conf
local 10.0.0.2
port 1194
proto udp
dev tap
ca /etc/openvpn/ca.crt
cert /etc/openvpn/server.crt
key /etc/openvpn/server.key # This file should be kept secret
dh /etc/openvpn/dh1024.pem
ifconfig-pool-persist ipp.txt
server-bridge 10.0.0.2 255.255.255.0 10.0.0.105 10.0.0.115
client-to-client
keepalive 10 120
tls-auth /etc/openvpn/ta.key 0 # This file is secret
comp-lzo
max-clients 10
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
log-append openvpn_server.log
verb 3
client.conf
client
dev tap
proto udp
remote 67.2.34.234 1194
resolv-retry infinite
nobind
persist-key
persist-tun
log-append openvpn_client.log
ca /etc/openvpn/ca.crt
cert /etc/openvpn/client1.crt
key /etc/openvpn/client1.key
ns-cert-type server
tls-auth /etc/openvpn/ta.key 1
comp-lzo
link-mtu 1574
verb 3
This is how I am initializing my bridge
/etc/init.d/bridge.sh
#bridge.sh
#!/bin/bash
# Create global variables
# Define Bridge Interface
br="br0"
# Define list of TAP interfaces to be bridged,
# for example tap="tap0 tap1 tap2".
tap="tap0"
# Define physical ethernet interface to be bridged
# with TAP interface(s) above.
eth="eth0"
eth_ip="10.0.0.2"
eth_netmask="255.255.255.0"
eth_broadcast="10.0.0.255"
gw="10.0.0.1"
start_bridge () {
#################################
# Set up Ethernet bridge on Linux
#################################
for t in $tap; do
openvpn --mktun --dev $t
done
for t in $tap; do
ifconfig $t 0.0.0.0 promisc up
done
ifconfig $eth 0.0.0.0 promisc up
brctl addbr $br
brctl addif $br $eth
for t in $tap; do
brctl addif $br $t
done
ifconfig $br $eth_ip netmask $eth_netmask broadcast $eth_broadcast up
route add default gw $gw $br
iptables -A INPUT -i tap0 -j ACCEPT
iptables -A INPUT -i br0 -j ACCEPT
iptables -A FORWARD -i br0 -j ACCEPT
}
stop_bridge () {
####################################
# Pull Down Ethernet bridge on Linux
####################################
ifconfig $br down
brctl delbr $br
for t in $tap; do
openvpn --rmtun --dev $t
done
ifconfig $eth $eth_ip netmask $eth_netmask broadcast $eth_broadcast up
route add default gw $gw $eth
}
case "$1" in
start)
echo -n "Starting Bridge"
start_bridge
;;
stop)
echo -n "Stopping Bridge"
stop_bridge
;;
restart)
stop_bridge
sleep 2
start_bridge
;;
*)
echo "Usage: $0 {start|stop|restart}" >&2
exit 1
;;
esac
This is my server ifconfig
root@Mustang:/home/johancsi# ifconfig
br0 Link encap:Ethernet HWaddr 00:25:22:6d:51:53
inet addr:10.0.0.2 Bcast:10.0.0.255 Mask:255.255.255.0
inet6 addr: fe80::225:22ff:fe6d:5153/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1695 errors:0 dropped:12 overruns:0 frame:0
TX packets:739 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:276886 (270.3 KiB) TX bytes:76933 (75.1 KiB)
eth0 Link encap:Ethernet HWaddr 00:25:22:6d:51:53
inet6 addr: fe80::225:22ff:fe6d:5153/64 Scope:Link
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:1705 errors:0 dropped:0 overruns:0 frame:0
TX packets:746 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:301216 (294.1 KiB) TX bytes:79951 (78.0 KiB)
Interrupt:72 Base address:0xc000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:180 errors:0 dropped:0 overruns:0 frame:0
TX packets:180 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:57821 (56.4 KiB) TX bytes:57821 (56.4 KiB)
tap0 Link encap:Ethernet HWaddr 3a:15:5f:9b:63:b7
UP BROADCAST PROMISC MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
root@Mustang:/home/johancsi#
This is my client ifconfig
root@graymatter:/home/johancsi# ifconfig
eth0 Link encap:Ethernet HWaddr bc:ae:c5:0e:2b:25
inet addr:192.168.0.2 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::beae:c5ff:fe0e:2b25/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:239436 errors:0 dropped:0 overruns:0 frame:0
TX packets:238109 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:44605234 (42.5 MiB) TX bytes:34256879 (32.6 MiB)
Interrupt:43 Base address:0xc000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:4375 errors:0 dropped:0 overruns:0 frame:0
TX packets:4375 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1353289 (1.2 MiB) TX bytes:1353289 (1.2 MiB)
tap0 Link encap:Ethernet HWaddr 32:2b:8f:d2:1b:00
inet addr:10.0.0.105 Bcast:10.0.0.255 Mask:255.255.255.0
inet6 addr: fe80::302b:8fff:fed2:1b00/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:67 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 B) TX bytes:9772 (9.5 KiB)
root@graymatter:/home/johancsi#
This is my server route -n
root@Mustang:/home/johancsi/openvpn# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.0.0.1 0.0.0.0 UG 0 0 0 br0
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 br0
root@Mustang:/home/johancsi/openvpn#
This is my client route -n
root@graymatter:/home/johancsi# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 tap0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
root@graymatter:/home/johancsi#
This is my server log
Sun Nov 24 14:52:10 2013 OpenVPN 2.2.1 x86_64-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [eurephia] [MH] [PF_INET6] [IPv6 payload 20110424-2 (2.2RC2)] built on Jun 18 2013
Sun Nov 24 14:52:10 2013 NOTE: when bridging your LAN adapter with the TAP adapter, note that the new bridge adapter will often take on its own IP address that is different from what the LAN adapter was previously set to
Sun Nov 24 14:52:10 2013 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Sun Nov 24 14:52:10 2013 Diffie-Hellman initialized with 1024 bit key
Sun Nov 24 14:52:10 2013 Control Channel Authentication: using '/etc/openvpn/ta.key' as a OpenVPN static key file
Sun Nov 24 14:52:10 2013 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Sun Nov 24 14:52:10 2013 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Sun Nov 24 14:52:10 2013 TLS-Auth MTU parms [ L:1574 D:166 EF:66 EB:0 ET:0 EL:0 ]
Sun Nov 24 14:52:10 2013 Socket Buffers: R=[229376->131072] S=[229376->131072]
Sun Nov 24 14:52:10 2013 TUN/TAP device tap1 opened
Sun Nov 24 14:52:10 2013 TUN/TAP TX queue length set to 100
Sun Nov 24 14:52:10 2013 Data Channel MTU parms [ L:1574 D:1450 EF:42 EB:135 ET:32 EL:0 AF:3/1 ]
Sun Nov 24 14:52:10 2013 GID set to nogroup
Sun Nov 24 14:52:10 2013 UID set to nobody
Sun Nov 24 14:52:10 2013 UDPv4 link local (bound): [AF_INET]10.0.0.2:1194
Sun Nov 24 14:52:10 2013 UDPv4 link remote: [undef]
Sun Nov 24 14:52:10 2013 MULTI: multi_init called, r=256 v=256
Sun Nov 24 14:52:10 2013 IFCONFIG POOL: base=10.0.0.105 size=11, ipv6=0
Sun Nov 24 14:52:10 2013 ifconfig_pool_read(), in='client1,10.0.0.105', TODO: IPv6
Sun Nov 24 14:52:10 2013 succeeded -> ifconfig_pool_set()
Sun Nov 24 14:52:10 2013 IFCONFIG POOL LIST
Sun Nov 24 14:52:10 2013 client1,10.0.0.105
Sun Nov 24 14:52:10 2013 Initialization Sequence Completed
Sun Nov 24 14:52:16 2013 MULTI: multi_create_instance called
Sun Nov 24 14:52:16 2013 174.23.143.132:37792 Re-using SSL/TLS context
Sun Nov 24 14:52:16 2013 174.23.143.132:37792 LZO compression initialized
Sun Nov 24 14:52:16 2013 174.23.143.132:37792 Control Channel MTU parms [ L:1574 D:166 EF:66 EB:0 ET:0 EL:0 ]
Sun Nov 24 14:52:16 2013 174.23.143.132:37792 Data Channel MTU parms [ L:1574 D:1450 EF:42 EB:135 ET:32 EL:0 AF:3/1 ]
Sun Nov 24 14:52:16 2013 174.23.143.132:37792 Local Options hash (VER=V4): '360696c5'
Sun Nov 24 14:52:16 2013 174.23.143.132:37792 Expected Remote Options hash (VER=V4): '13a273ba'
Sun Nov 24 14:52:16 2013 174.23.143.132:37792 TLS: Initial packet from [AF_INET]174.23.143.132:37792, sid=aaa00b15 f789d702
Sun Nov 24 14:52:16 2013 174.23.143.132:37792 VERIFY OK: depth=1, /C=US/ST=UT/L=Salt_Lake_City/O=Mustang/OU=changeme/CN=mustang/name=graymatter/emailAddress=tracyj@xmission.com
Sun Nov 24 14:52:16 2013 174.23.143.132:37792 VERIFY OK: depth=0, /C=US/ST=UT/L=Salt_Lake_City/O=Mustang/OU=changeme/CN=client1/name=graymatter/emailAddress=tracyj@xmission.com
Sun Nov 24 14:52:17 2013 174.23.143.132:37792 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
Sun Nov 24 14:52:17 2013 174.23.143.132:37792 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Sun Nov 24 14:52:17 2013 174.23.143.132:37792 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
Sun Nov 24 14:52:17 2013 174.23.143.132:37792 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Sun Nov 24 14:52:17 2013 174.23.143.132:37792 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 1024 bit RSA
Sun Nov 24 14:52:17 2013 174.23.143.132:37792 [client1] Peer Connection Initiated with [AF_INET]174.23.143.132:37792
Sun Nov 24 14:52:17 2013 client1/174.23.143.132:37792 MULTI_sva: pool returned IPv4=10.0.0.105, IPv6=1::1c00:0:247f:0
Sun Nov 24 14:52:19 2013 client1/174.23.143.132:37792 PUSH: Received control message: 'PUSH_REQUEST'
Sun Nov 24 14:52:19 2013 client1/174.23.143.132:37792 send_push_reply(): safe_cap=960
Sun Nov 24 14:52:19 2013 client1/174.23.143.132:37792 SENT CONTROL [client1]: 'PUSH_REPLY,route-gateway 10.0.0.2,ping 10,ping-restart 120,ifconfig 10.0.0.105 255.255.255.0' (status=1)
Sun Nov 24 14:52:19 2013 client1/174.23.143.132:37792 MULTI: Learn: de:97:16:53:99:cc -> client1/174.23.143.132:37792
This is my client log
Sat Nov 23 10:52:16 2013 OpenVPN 2.2.1 x86_64-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [eurephia] [MH] [PF_INET6] [IPv6 payload 20110424-2 (2.2RC2)] built on Jun 4 2013
Sat Nov 23 10:52:16 2013 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Sat Nov 23 10:52:16 2013 Control Channel Authentication: using '/etc/openvpn/ta.key' as a OpenVPN static key file
Sat Nov 23 10:52:16 2013 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Sat Nov 23 10:52:16 2013 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Sat Nov 23 10:52:16 2013 LZO compression initialized
Sat Nov 23 10:52:16 2013 Control Channel MTU parms [ L:1574 D:166 EF:66 EB:0 ET:0 EL:0 ]
Sat Nov 23 10:52:16 2013 Socket Buffers: R=[229376->131072] S=[229376->131072]
Sat Nov 23 10:52:16 2013 Data Channel MTU parms [ L:1574 D:1450 EF:42 EB:135 ET:32 EL:0 AF:3/1 ]
Sat Nov 23 10:52:16 2013 Local Options hash (VER=V4): '13a273ba'
Sat Nov 23 10:52:16 2013 Expected Remote Options hash (VER=V4): '360696c5'
Sat Nov 23 10:52:16 2013 UDPv4 link local: [undef]
Sat Nov 23 10:52:16 2013 UDPv4 link remote: [AF_INET]67.2.34.234:1194
Sat Nov 23 10:52:16 2013 TLS: Initial packet from [AF_INET]67.2.34.234:1194, sid=bdec3de3 a1974a57
Sat Nov 23 10:52:16 2013 VERIFY OK: depth=1, /C=US/ST=UT/L=Salt_Lake_City/O=Mustang/OU=changeme/CN=mustang/name=graymatter/emailAddress=tracyj@xmission.com
Sat Nov 23 10:52:16 2013 VERIFY OK: nsCertType=SERVER
Sat Nov 23 10:52:16 2013 VERIFY OK: depth=0, /C=US/ST=UT/L=Salt_Lake_City/O=Mustang/OU=changeme/CN=server/name=graymatter/emailAddress=tracyj@xmission.com
Sat Nov 23 10:52:17 2013 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
Sat Nov 23 10:52:17 2013 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Sat Nov 23 10:52:17 2013 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
Sat Nov 23 10:52:17 2013 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Sat Nov 23 10:52:17 2013 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 1024 bit RSA
Sat Nov 23 10:52:17 2013 [server] Peer Connection Initiated with [AF_INET]67.2.34.234:1194
Sat Nov 23 10:52:19 2013 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
Sat Nov 23 10:52:19 2013 PUSH: Received control message: 'PUSH_REPLY,route-gateway 10.0.0.2,ping 10,ping-restart 120,ifconfig 10.0.0.105 255.255.255.0'
Sat Nov 23 10:52:19 2013 OPTIONS IMPORT: timers and/or timeouts modified
Sat Nov 23 10:52:19 2013 OPTIONS IMPORT: --ifconfig/up options modified
Sat Nov 23 10:52:19 2013 OPTIONS IMPORT: route-related options modified
Sat Nov 23 10:52:19 2013 TUN/TAP device tap0 opened
Sat Nov 23 10:52:19 2013 TUN/TAP TX queue length set to 100
Sat Nov 23 10:52:19 2013 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Sat Nov 23 10:52:19 2013 /sbin/ifconfig tap0 10.0.0.105 netmask 255.255.255.0 mtu 1500 broadcast 10.0.0.255
Sat Nov 23 10:52:19 2013 Initialization Sequence Completed