openvpn 2.4.6 tun on gentoo with netifrc
server conf
local 172.25.120.2
server 172.25.121.0 255.255.255.0
route-gateway 172.25.120.1
topology subnet
client-to-client
route 172.25.0.0 255.255.0.0
route 172.23.0.0 255.255.0.0
route 172.24.0.0 255.255.0.0
route 172.27.0.0 255.255.0.0
route 172.30.0.0 255.255.0.0
push "route 172.25.0.0 255.255.0.0"
push "route 172.23.0.0 255.255.0.0"
push "route 172.24.0.0 255.255.0.0"
push "route 172.27.0.0 255.255.0.0"
push "route 172.30.0.0 255.255.0.0"
server log
ROUTE_GATEWAY 172.25.120.1/255.255.255.0 IFACE=eth0 HWADDR=00:16:3e:88:b0:c5
TUN/TAP device tun0 opened
/bin/ifconfig tun0 172.25.121.1 netmask 255.255.255.0 mtu 9000 broadcast 172.25.121.255
/bin/route add -net 172.25.0.0 netmask 255.255.0.0 gw 172.25.120.1
/bin/route add -net 172.23.0.0 netmask 255.255.0.0 gw 172.25.120.1
/bin/route add -net 172.24.0.0 netmask 255.255.0.0 gw 172.25.120.1
/bin/route add -net 172.27.0.0 netmask 255.255.0.0 gw 172.25.120.1
/bin/route add -net 172.30.0.0 netmask 255.255.0.0 gw 172.25.120.1
UDPv4 link local (bound): [AF_INET]172.25.120.2:61023
IFCONFIG POOL: base=172.25.121.2 size=252, ipv6=0
IFCONFIG POOL LIST
ip r
default via 172.25.120.1 dev eth0 metric 47
172.23.0.0/16 via 172.25.120.1 dev eth0
172.24.0.0/16 via 172.25.120.1 dev eth0
172.25.0.0/16 via 172.25.120.1 dev eth0
172.25.120.0/24 dev eth0 proto kernel scope link src 172.25.120.2
172.25.121.0/24 dev tun0 proto kernel scope link src 172.25.121.1
172.27.0.0/16 via 172.25.120.1 dev eth0
172.30.0.0/16 via 172.25.120.1 dev eth0
Thus far thus good, I reckon. Targets at the subnets are reachable via icmp.
However, when a client connects openvpn is pusing the wrong gateway to the client, for reasons
inexplicable to me. The routing tables at the server are unchanged after client connect, as one would expect.
server log
[obfuscted]:61023 MULTI_sva: pool returned IPv4=172.25.121.2, IPv6=(Not enabled)
[obfuscted]:61023 MULTI: Learn: 172.25.121.2 -> [obfuscted]:61023
[obfuscted]:61023 MULTI: primary virtual IP for [obfuscted]:61023: 172.25.121.2
[obfuscted]:61023 PUSH: Received control message: 'PUSH_REQUEST'
[obfuscted]:61023 SENT CONTROL [TO Router]: 'PUSH_REPLY,route 172.25.0.0 255.255.0.0,route 172.23.0.0 255.255.0.0,route 172.24.0.0 255.255.0.0,route 172.27.0.0 255.255.0.0,route 172.30.0.0 255.255.0.0,route-gateway 172.25.121.1,topology subnet,ping 10,ping-restart 120,ifconfig 172.25.121.2 255.255.255.0,peer-id 0,cipher AES-256-GCM' (status=1)
client log
[OVPN Server] Peer Connection Initiated with [AF_INET][obfuscated]:61023
SENT CONTROL [OVPN Server]: 'PUSH_REQUEST' (status=1)
PUSH: Received control message: 'PUSH_REPLY,route 172.25.0.0 255.255.0.0,route 172.23.0.0 255.255.0.0,route 172.24.0.0 255.255.0.0,route 172.27.0.0 255.255.0.0,route 172.30.0.0 255.255.0.0,route-gateway 172.25.121.1,topology subnet,ping 10,ping-restart 120,ifconfig 172.25.121.2 255.255.255.0,peer-id 0,cipher AES-256-GCM'
OPTIONS IMPORT: timers and/or timeouts modified
OPTIONS IMPORT: --ifconfig/up options modified
OPTIONS IMPORT: route options modified
OPTIONS IMPORT: route-related options modified
TUN/TAP device tun0 opened
do_ifconfig, tt->did_ifconfig_ipv6_setup=0
/sbin/ifconfig tun0 172.25.121.2 netmask 255.255.255.0 mtu 9000 broadcast 172.25.121.255
/sbin/route add -net 172.25.0.0 netmask 255.255.0.0 gw 172.25.121.1
/sbin/route add -net 172.23.0.0 netmask 255.255.0.0 gw 172.25.121.1
/sbin/route add -net 172.24.0.0 netmask 255.255.0.0 gw 172.25.121.1
/sbin/route add -net 172.27.0.0 netmask 255.255.0.0 gw 172.25.121.1
/sbin/route add -net 172.30.0.0 netmask 255.255.0.0 gw 172.25.121.1
And sure the client's routing tables are wrong
172.23.0.0/16 via 172.25.121.1 dev tun0
172.24.0.0/16 via 172.25.121.1 dev tun0
172.25.0.0/16 via 172.25.121.1 dev tun0
172.25.121.0/24 dev tun0 proto kernel scope link src 172.25.121.2
172.27.0.0/16 via 172.25.121.1 dev tun0
172.30.0.0/16 via 172.25.121.1 dev tun0