I have openvpn server in bridge mode setup and some clients connected to it.
Server running on Ubuntu 12.04, openvpn 2.2.1, server config:
port 1194
proto tcp
dev tap0
ca /etc/openvpn/keys/ca.crt
key /etc/openvpn/keys/server.key # This file should be kept secret.
cert /etc/openvpn/keys/server.crt
dh /etc/openvpn/keys/dh1024.pem
cipher AES-256-CBC
ifconfig-pool-persist ipp.txt
server-bridge 192.168.253.4 255.255.255.0 192.168.253.100 192.168.253.200
keepalive 10 120
user nobody
group nogroup
persist-key
persist-tun
status /var/log/openvpn-mikrotik-status.log
verb 3
Tap device for openvpn created from /etc/network/interfaces and it's included to br0 bridge, along with eth0.7 interface.
iface br0 inet static
bridge_ports eth0.7
bridge_fd 0
bridge_stp off
address 192.168.71.253
netmask 255.255.254.0
up openvpn --mktun --dev tap0
up ip link set dev eth0.7 promisc on
up ip link set dev tap0 promisc on
up ip link set dev tap0 up
up ip a a 192.168.74.1/24 dev br0
up brctl addif br0 tap0
down brctl delif br0 tap0
down openvpn --rmtun --dev tap0
Clients are mikrotik RouterOS routers. At mikrotik side we have ovpn-out1 interface, which is openvpn connection to the server. This interface and some local eth inetrfaces included in bridge "vpn-bridge". So, basically we plug some devices onto mikrotik, and they are transparently gets L2 connectivity to server's eth0.7.
This setup is working and most of devices gets their transparent access to the vlan7. The problem is:
some special devices are not accessible after plugging into mikrotik router. When mikrotik connects to the server, we see record "MULTI: Learn: " in log, which represents all mac addresses of the devices, connected to mikrotik, EXCEPT macs of "some special devices. For some reason their MACs staying unknown to openvpn, so no connectivity with them in the result.
....
Feb 21 14:17:51 hydrogen ovpn-mikrotik-gw[21061]: mikrotik-3218/192.168.74.21:35656 MULTI_sva: pool returned IPv4=192.168.253.105, IPv6=1::2100:0:e47f:0
Feb 21 14:17:51 hydrogen ovpn-mikrotik-gw[21061]: mikrotik-3218/192.168.74.21:35656 PUSH: Received control message: 'PUSH_REQUEST'
Feb 21 14:17:51 hydrogen ovpn-mikrotik-gw[21061]: mikrotik-3218/192.168.74.21:35656 send_push_reply(): safe_cap=960
Feb 21 14:17:51 hydrogen ovpn-mikrotik-gw[21061]: mikrotik-3218/192.168.74.21:35656 SENT CONTROL [mikrotik-3218]: 'PUSH_REPLY,route-gateway 192.168.253.4,ping 10,ping-restart 120,ifconfig 192.168.253.105 255.255
.255.0' (status=1)
Feb 21 14:17:51 hydrogen ovpn-mikrotik-gw[21061]: mikrotik-3218/192.168.74.21:35656 MULTI: Learn: d4:ca:6d:af:85:c5 -> mikrotik-3218/192.168.74.21:35656
Feb 21 14:17:52 hydrogen ovpn-mikrotik-gw[21061]: mikrotik-3218/192.168.74.21:35656 MULTI: Learn: 00:d0:89:0a:4b:79 -> mikrotik-3218/192.168.74.21:35656
Feb 21 14:18:06 hydrogen ovpn-mikrotik-gw[21061]: mikrotik-3218/192.168.74.21:35656 MULTI: Learn: 00:20:4a:ef:17:ed -> mikrotik-3218/192.168.74.21:35656
Feb 21 14:18:08 hydrogen ovpn-mikrotik-gw[21061]: mikrotik-3218/192.168.74.21:35656 MULTI: Learn: 00:05:fe:03:72:54 -> mikrotik-3218/192.168.74.21:35656
I've looked inside src/openvpn/multi.c trying to determine how openvpn learns mac addresses, but it looks way complicated for me.
From openvpn server side I can ping special device with no success, BUT while doing this, MAC address of the device becomes known to linux arp cache (but not to openvpn):
# ping 192.168.70.187
PING 192.168.70.187 (192.168.70.187) 56(84) bytes of data.
^C
--- 192.168.70.187 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2009ms
# arp 192.168.70.187
Address HWtype HWaddress Flags Mask Iface
192.168.70.187 ether 00:0c:c6:79:e4:e0 C br0
While doing this, I see ARP query and answer:
# tcpdump -n -i br0 -e host 192.168.70.187
...
14:53:58.279279 0a:a7:16:d4:ff:46 > 00:0c:c6:79:e4:e0, ethertype ARP (0x0806), length 42: Request who-has 192.168.70.187 tell 192.168.71.253, length 28
14:53:59.263396 0a:a7:16:d4:ff:46 > 00:0c:c6:79:e4:e0, ethertype IPv4 (0x0800), length 98: 192.168.71.253 > 192.168.70.187: ICMP echo request, id 28521, seq 24, length 64
14:53:59.279342 0a:a7:16:d4:ff:46 > 00:0c:c6:79:e4:e0, ethertype ARP (0x0806), length 42: Request who-has 192.168.70.187 tell 192.168.71.253, length 28
14:54:00.263431 0a:a7:16:d4:ff:46 > 00:0c:c6:79:e4:e0, ethertype IPv4 (0x0800), length 98: 192.168.71.253 > 192.168.70.187: ICMP echo request, id 28521, seq 25, length 64
14:54:00.279347 0a:a7:16:d4:ff:46 > 00:0c:c6:79:e4:e0, ethertype ARP (0x0806), length 42: Request who-has 192.168.70.187 tell 192.168.71.253, length 28
14:54:01.263384 0a:a7:16:d4:ff:46 > 00:0c:c6:79:e4:e0, ethertype IPv4 (0x0800), length 98: 192.168.71.253 > 192.168.70.187: ICMP echo request, id 28521, seq 26, length 64
14:54:02.264938 0a:a7:16:d4:ff:46 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Request who-has 192.168.70.187 tell 192.168.71.253, length 28
14:54:02.284016 00:05:fe:03:72:60 > 0a:a7:16:d4:ff:46, ethertype ARP (0x0806), length 60: Reply 192.168.70.187 is-at 00:0c:c6:79:e4:e0, length 46
14:54:02.284026 0a:a7:16:d4:ff:46 > 00:0c:c6:79:e4:e0, ethertype IPv4 (0x0800), length 98: 192.168.71.253 > 192.168.70.187: ICMP echo request, id 28521, seq 27, length 64
14:54:03.273376 0a:a7:16:d4:ff:46 > 00:0c:c6:79:e4:e0, ethertype IPv4 (0x0800), length 98: 192.168.71.253 > 192.168.70.187: ICMP echo request, id 28521, seq 28, length 64
The only way I can restore network connectivity to this special device is reboot it. After reboot it works while openvpn tunnel is up. If it restarts for some reason, device became inaccesible again.
So, my question is: how does exactly openvpn learns MACs which belongs to client side, and probably advice about how to figure out why these special devices are so special with such an unexpected network behavior.