I have the following network topology:
- Remote admin network (192.168.10.0/24) I connect to using PPTP to the public IP
- Remote gateway assigns an IP adress to me (192.168.10.100, for instance)
- I can reach any server on the 192.168.10.0/24 subnet
- I cannot reach any server on the 192.168.20.0/24 (DMZ) subnet
- Note that I added a static route in Windows in order to route the traffic to 192.168.20.0/24 through the VPN's gateway (192.168.100.1):
Persistent Routes:
Network Address Netmask Gateway Address Metric
192.168.20.0 255.255.255.0 192.168.10.1 1
(sorry for poor formating)
However when I do a trace route, I can clearly see that Windows is routing the packets to my default, non VPN, gateway:
Tracing route to 192.168.20.1 over a maximum of 30 hops
1 1 ms 1 ms 1 ms my.firewall [192.168.2.1]
2 5 ms 4 ms 4 ms 192.168.1.1
3 (edited out public ip) reports: Destination net unreachable.
How can this be? Why is Windows routing to my default gateway (192.168.2.1) when I explicitely specified a different gateway for this destination subnet (192.168.20.0) ?
Sorry for answering my own question but here goes.
Basically I simply had to re-add the route manually (route add 192.168.20.0 MASK 255.255.255.0 192.168.10.1). Doing this fixed the issue. Apparently, even though the route shows as "Persistent" it was not. This happens whenever I reboot. I don't know if it's a bug or simply because interface numbers can change between two reboots (both sound very doubtful but that's all I can think of).
Without further info I would guess you need to provide the interface number when adding the route. For example if the vpn if is number 18 then
route -p add 192.168.20.0 mask 255.255.255.0 192.168.10.1 if 18
Edit: Serves me right for writing this on my phone w/o access to a computer.
The route you're manually adding should reference the IP assigned to the local machine's PPTP interface, not the default gateway on the remote network. It's counter-intuitive, but it'll work. For a long-term solution you can use a DHCP option to push out the route.