Short résumé
No errors, no dropped packets, pings reach clients, tcpdump shows packages travelling, everything else never reaches the LAN hosts (or OpenVPN clients).
Edit
After trying to eliminate all possible disruptive factors, I reconfigured my VM setup to use bridges instead of MacVTap. Now access to LAN clients works as expected. I hope this is not the ultimate answer (I'd like to keep MacVTap).
I've done a little bit of VM stuff and networking before, still such a behaviour as described below is completely new to me.
Edit: What strikes me most is that the responses (e.g. DNS query) are routed back to the client (I added a tcpdump of that), yet dig still runs into a timeout.
I've been scratching my head over this for some days now and I can't find anything on the interwebz (maybe weak search-fu), so I thought it was time for you ServerFaulters out there.
Task (essentially easy): Setup an OpenVPN server, route traffic to LAN behind it.
Problem: Pings succeed, "everything else" doesn't. On the host there's a DNS server running as well as an OpenSSH-Server, both of which can't be reached.
I thought that there might be masquerading / NATing involved, but that was not the culprit at all.
Actually, I think I'm just too stupid right now. So, please, help a desparate guy (and don't hesitate to ask for even more details).
Setup
VPN-Server and Host are VMs running on a Machine VPN-Client is directly connected to. Boths VMs can see each other, iptables policies are set to ACCEPT on all hosts.
OpenVPN-Server
eth0 10.0.0.3
tun0:1 172.16.0.3
tun0 10.8.0.1
# cat /proc/sys/net/ipv4/ip_forward
1
# lsmod
xt_conntrack 12681 3
iptable_filter 12536 1
ipt_MASQUERADE 12594 3
iptable_nat 12646 1
nf_conntrack_ipv4 18499 4
nf_defrag_ipv4 12483 1 nf_conntrack_ipv4
nf_nat_ipv4 12912 1 iptable_nat
nf_nat 22379 3 ipt_MASQUERADE,nf_nat_ipv4,iptable_nat
nf_conntrack 70753 6 ipt_MASQUERADE,nf_nat,nf_nat_ipv4,xt_conntrack,iptable_nat,nf_conntrack_ipv4
ip_tables 21914 2 iptable_filter,iptable_nat
x_tables 23015 4 ip_tables,ipt_MASQUERADE,xt_conntrack,iptable_filter
[…]
/etc/openvpn/server.conf
port 1194
proto udp
dev tun
server 10.8.0.0 255.255.255.0
push "route 10.0.0.0 255.255.255.0"
topology subnet # is this actually needed?
VPN-Client
eth0 172.16.0.100
tun0 10.8.0.4
$ ip route
10.0.0.0/24 via 10.8.0.1 dev tun0
10.8.0.0/24 dev tun0 proto kernel scope link src 10.8.0.4
172.16.0.0/24 dev eth0 proto kernel scope link src 172.16.0.100
OpenVPN connection (excerpts)
$ sudo openvpn --config vpn.ovpn
…
UDPv4 link remote: [AF_INET]172.16.0.3:1194
TLS: Initial packet from [AF_INET]172.16.0.3:1194, sid=b636ac88 2ef4c575
[…] Peer Connection Initiated with [AF_INET]172.16.0.3:1194
SENT CONTROL […]: 'PUSH_REQUEST' (status=1)
PUSH: Received control message: 'PUSH_REPLY,route 10.0.0.0 255.255.255.0,route-gateway 10.8.0.1,topology subnet,ping 10,ping-restart 120,ifconfig 10.8.0.4 255.255.255.0'
/sbin/ip link set dev tun0 up mtu 1500
/sbin/ip addr add dev tun0 10.8.0.4/24 broadcast 10.8.0.255
/sbin/ip route add 10.0.0.0/24 via 10.8.0.1
Host
eth0 10.0.0.2
$ ip route
10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.2
10.8.0.0/24 via 10.0.0.3 dev eth0
ICMP Echo
As you can see below, pings success from VPN-Client to Host. (Pings from Host to VPN-Client work equally well, but I omitted them here)
This was done without any iptables rules.
VPN-Client
$ ping -c1 10.0.0.2
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_seq=1 ttl=63 time=1.30 ms
--- 10.0.0.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.303/1.303/1.303/0.000 ms
OpenVPN-Server
tcpdump -i tun0
11:01:25.787428 IP 10.8.0.4 > 10.0.0.2: ICMP echo request, id 4209, seq 1, length 64
11:01:25.787899 IP 10.0.0.2 > 10.8.0.4: ICMP echo reply, id 4209, seq 1, length 64
Host
# tcpdump net 10.8.0.0/24
11:01:25.797640 IP 10.8.0.4 > 10.0.0.2: ICMP echo request, id 4209, seq 1, length 64
11:01:25.797682 IP 10.0.0.2 > 10.8.0.4: ICMP echo reply, id 4209, seq 1, length 64
DNS Query
Again, no iptables rules.
VPN-Client
$ dig @10.0.0.2 serverfault.com
; <<>> DiG 9.9.3-rpz2+rl.13214.22-P2-Debian-1:9.9.3.dfsg.P2-4 <<>> @10.0.0.2 serverfault.com
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached
Edit: Connection times out, yet there's a response that can be seen in tcpdump:
# tcpdump -i tun0
14:26:26.609399 IP vpnclient.56553 > 10.0.0.2.domain: 44738+ [1au] A? serverfault.com. (44)
14:26:26.738504 IP 10.0.0.2.domain > vpnclient.56553: 44738$ 1/0/0 A 198.252.206.16 (49)
OpenVPN-Server
# tcpdump -i tun0
10:03:52.077784 IP 10.8.0.4.58792 > 10.0.0.2.domain: 61705+ [1au] A? serverfault.com. (44)
10:03:52.092420 IP 10.0.0.2.domain > 10.8.0.4.58792: 61705$ 1/0/0 A 198.252.206.16 (49)
Host
# tcpdump net 10.8.0.0/24
10:03:57.061048 IP 10.8.0.4.58792 > 10.0.0.2.domain: 61705+ [1au] A? serverfault.com. (44)
10:03:57.075223 IP 10.0.0.2.domain > 10.8.0.4.58792: 61705$ 1/0/0 A 198.252.206.16 (49)