Score:0

Error when openvpn config uses "*" in route

in flag

I'm trying to enable vpn only for specific hosts on mac

route-nopull
route *.dev1.com

dev tun
persist-tun

...

and getting the error:

Cannot resolve host address: *dev1.com: (nodename nor servname provided, or not known)

changing the config to

route d1.dev1.com 

works perfectly

How do I add a range of subdomain hosts

Score:0
ar flag

You can't.

Routes work at the IP level. When you input d1.dev1.com, this is passed to route command, which resolves it and adds a route towards the specific target. It's not possible to resolve *.dev1.com, nor know all valid subdomains of a domain.

OpenVPN in tun mode is a L3 VPN. It operates at the IP layer, which means it cares about IP addresses, not DNS names. DNS names is resolved at a higher layer, and IP addresses is used by applications when opening sockets. Neither OpenVPN or the routing table cares about DNS. They only care about packets and IP addresses.

If you want that kind of redirection, you have to work at a higher layer. If your traffic is e.g. http(s), you can use a HTTP proxy such as Squid or Nginx to redirect it over your VPN.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.