Hello all!
I just might be blind and could appreciate some help.
What I have:
- an OpenVPN server sitting in a public IP, Debian GNU/Linux
- several clients, all getting ip:s from the server's 10.8.1.x subnet
- one client, that's in front of a 192.168.100.0 subnet
What I want:
-the 192.168.100.0 subnet needs to be reached from both the server and all the clients
Now everything is working pretty well, but the problem is that the OpenVPN server sets a wrong mask for the 192.168.100.0 subnet when starting.
Server's routing table before the OpenVPN is running:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
x.y.z.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 x.y.z.1 0.0.0.0 UG 0 0 0 eth0
Then I launch the OpenVPN server:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.100.0 10.8.1.2 255.255.255.255 UGH 0 0 0 tun0
10.8.1.0 10.8.1.2 255.255.255.255 UGH 0 0 0 tun0
10.8.1.2 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
x.y.z.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.8.1.0 10.8.1.2 255.255.255.0 UG 0 0 0 tun0
0.0.0.0 x.y.z.1 0.0.0.0 UG 0 0 0 eth0
Then I bring on the clients. All clients can ping 192.168.100.0 once the particular client in front of that subnet is connected, but because of the 255.255.255.255 mask no packets from the server is going there. If I manually do
route del 192.168.100.0
route add -net 192.168.100.0 gw 10.8.1.2 netmask 255.255.255.0
my table becomes:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.8.1.0 10.8.1.2 255.255.255.255 UGH 0 0 0 tun0
10.8.1.2 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
192.168.100.0 10.8.1.2 255.255.255.0 UG 0 0 0 tun0
x.y.z.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.8.1.0 10.8.1.2 255.255.255.0 UG 0 0 0 tun0
0.0.0.0 x.y.z.1 0.0.0.0 UG 0 0 0 eth0
and from now on I can not only ping from other clients to the 192.168.100.x but also from the server - which is the goal.
But I just can't understand where the 255.255.255.255 comes automatically and what do I need to change in my config to get it 255.255.255.0 automatically. Conf:
local x.y.z.n
port 1194
proto udp
dev tun
cd /etc/openvpn/demo/
log /var/log/openvpn-demo.log
ca ca.crt
cert server.crt
key server.key
dh dh1024.pem
cipher AES-256-CBC
persist-tun
persist-key
persist-local-ip
client-config-dir /etc/openvpn/ccd
server 10.8.1.0 255.255.255.0
keepalive 10 120
route "192.168.100.0 255.255.255.0"
route "10.8.1.0 255.255.255.0"
push "route 192.168.100.0 255.255.255.0"
push "route 10.8.1.0 255.255.255.0"
client-to-client
user nobody
group nogroup
persist-key
persist-tun
persist-local-ip
verb 3
and of course in the ccd there's that one client with just:
iroute 192.168.100.0 255.255.255.0