OpenWRT ist great for creating simple Site2Site VPNs by OpenVPN.

I often use this settings (example) for Site2Site VPN:

  • Local Network: 192.168.1.0/24
  • Local ADSL Gateway: 192.168.1.1
  • Local OpenWRT VPN Gateway: 192.168.1.2
  • Remote Network: 192.168.9.0/24
  • Remote ADSL Gateway: 192.168.9.1
  • Remote OpenWRT VPN Gateway: 192.168.9.2

To Configure Local Gateway DNSMasq (DHCP Server) providing static routes for its clients, you can make this config:

/etc/config/dhcp

config dhcp 'lan'
	[...]
	list dhcp_option '249,192.168.9.0/24,192.168.1.2'
	list dhcp_option '121,192.168.9.0/24,192.168.1.2'

You can also set this options on luci web interface:

Network > Interfaces > LAN > Edit > DHCP Server > Advanced Settings > Dhcp-Options

  • 249,192.168.9.0/24,192.168.1.2
  • 121,192.168.9.0/24,192.168.1.2

I use 2 different options for the same route, that is not really needed.
Windows clients are reading option 249 (old clients) and linux clients are reading both options.
But I did only few tests, so you have to test what is the best way for you to implement.

https://tools.ietf.org/html/rfc3442

https://msdn.microsoft.com/en-us/library/cc227282.aspx


 PS: For ISC Dhcp Server, you can do it this way

option rfc3442-classless-routes code 121 = array of unsigned integer 8;
option ms-classless-routes code 249 = array of unsigned integer 8;
subnet 192.168.1.0 netmask 255.255.255.0 {
   option rfc3442-classless-static-routes 24, 192,168,9, 192,168,1,2;
   option ms-classless-static-routes 24, 192,168,9, 192,168,1,2;
}