my openvpn server is a redhat linux machine.
My net is 192.168.1.0/24, the openvpn server is 192.168.1.100
The openvpn server has an ethernet interface connected to my LAN and a default gateway to the modem/router (192.168.1.5)
The openvpn software serves many different operationg systems (linux, mac and win). The openvpn clients get an ip-address from the 192.168.2.0
The openvpn server has a tun0 interface with the address 192.168.2.1 and a route to 192.168.2.2, which seems to be a "local" link to the daemon.
According to the openvpn faq, the server reserves a /30 subnet für each client. So the first client gets the subnet 192.168.2.4/30 and has the ip 192.168.2.6. The server has the ip 192.168.2.5
I'd like to set a route on the client, that garantees, that all packages sent to192.168.1.0 are routed through the openvpn tunnel.
On a linux client, which was assigned the first /30 subnet (192.168.2.4/30) I tried two versions:
route add -net 192.168.1.0/24 gw 192.168.2.1 which resulted in a "network not found" error messagen
the other command is route add -net 192.168.1.0/24 gw 192.168.2.5 which was accepted. But sending packages to the server doesn't work. Contacting a webserver on this 192.168.1.0 subnet results in timeouts.
Are there any options for the client, that automatically sets the correct routes? What are the correct routing settings at all?
What if the client is assigned another ip-address and thus another /30 subnet? In this case, the router has a totally different ip-address? Is there a way to automatically find out the correct router?
thanks and greets