openvpn push route via interface

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I configured my openvpn server to use 172.31.48.0/20, where ips from 172.31.48.0 to 172.31.62.255 are statically assigned, and 172.31.63.0/24 are dynamic.



tls-server
mode server
push "topology subnet"
ifconfig 172.31.48.1 255.255.240.0
ifconfig-pool 172.31.63.0 172.31.63.254 255.255.255.0


Where the static hosts have their ip set via ifconfig-push 172.31.48.2 255.255.240.0 in a file that matches their common name, and is in the client-configs directory that the server specified.



Clients that do not have a file with a corresponding common name will get a dynamic ip in the range 172.31.63.0/24, but they will not get a route to 172.31.48.0/20, so I cannot ping from the vpn host (172.31.48.1) to a client with a dynamic ip (such as 172.31.63.1)



On the dynamic client, it only has a route for 172.31.63.0/24, as is specified by ifconfig-pool. I would like to route all 172.31.48.0/20 traffic via the tun device that is created by the vpn client. If I run this command manually everything works:



sudo route add -net 172.31.48.0/20 dev vpn1


Where vpn1 is the vpn device specified in the client ovpn file



dev vpn1
dev-type tun


The route option in openvpn wants an ip and not a device interface, though. Meaning, this will not work:



push "route 172.31.48.0 255.255.240.0 vpn1"


And if I leave off vpn1 then openvpn on the client side will complain that no gateway was specified.



How can I route the 172.31.48.0/20 subnet on clients that get a dynamic ip?







share|improve this question






















  • My current workaround is to use a bogus ip as the gateway from the client. It gets routed appropriately on the server. push "route 172.31.48.0 255.255.240.0 172.31.63.254"
    – jonr
    Mar 22 at 23:25














up vote
0
down vote

favorite












I configured my openvpn server to use 172.31.48.0/20, where ips from 172.31.48.0 to 172.31.62.255 are statically assigned, and 172.31.63.0/24 are dynamic.



tls-server
mode server
push "topology subnet"
ifconfig 172.31.48.1 255.255.240.0
ifconfig-pool 172.31.63.0 172.31.63.254 255.255.255.0


Where the static hosts have their ip set via ifconfig-push 172.31.48.2 255.255.240.0 in a file that matches their common name, and is in the client-configs directory that the server specified.



Clients that do not have a file with a corresponding common name will get a dynamic ip in the range 172.31.63.0/24, but they will not get a route to 172.31.48.0/20, so I cannot ping from the vpn host (172.31.48.1) to a client with a dynamic ip (such as 172.31.63.1)



On the dynamic client, it only has a route for 172.31.63.0/24, as is specified by ifconfig-pool. I would like to route all 172.31.48.0/20 traffic via the tun device that is created by the vpn client. If I run this command manually everything works:



sudo route add -net 172.31.48.0/20 dev vpn1


Where vpn1 is the vpn device specified in the client ovpn file



dev vpn1
dev-type tun


The route option in openvpn wants an ip and not a device interface, though. Meaning, this will not work:



push "route 172.31.48.0 255.255.240.0 vpn1"


And if I leave off vpn1 then openvpn on the client side will complain that no gateway was specified.



How can I route the 172.31.48.0/20 subnet on clients that get a dynamic ip?







share|improve this question






















  • My current workaround is to use a bogus ip as the gateway from the client. It gets routed appropriately on the server. push "route 172.31.48.0 255.255.240.0 172.31.63.254"
    – jonr
    Mar 22 at 23:25












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I configured my openvpn server to use 172.31.48.0/20, where ips from 172.31.48.0 to 172.31.62.255 are statically assigned, and 172.31.63.0/24 are dynamic.



tls-server
mode server
push "topology subnet"
ifconfig 172.31.48.1 255.255.240.0
ifconfig-pool 172.31.63.0 172.31.63.254 255.255.255.0


Where the static hosts have their ip set via ifconfig-push 172.31.48.2 255.255.240.0 in a file that matches their common name, and is in the client-configs directory that the server specified.



Clients that do not have a file with a corresponding common name will get a dynamic ip in the range 172.31.63.0/24, but they will not get a route to 172.31.48.0/20, so I cannot ping from the vpn host (172.31.48.1) to a client with a dynamic ip (such as 172.31.63.1)



On the dynamic client, it only has a route for 172.31.63.0/24, as is specified by ifconfig-pool. I would like to route all 172.31.48.0/20 traffic via the tun device that is created by the vpn client. If I run this command manually everything works:



sudo route add -net 172.31.48.0/20 dev vpn1


Where vpn1 is the vpn device specified in the client ovpn file



dev vpn1
dev-type tun


The route option in openvpn wants an ip and not a device interface, though. Meaning, this will not work:



push "route 172.31.48.0 255.255.240.0 vpn1"


And if I leave off vpn1 then openvpn on the client side will complain that no gateway was specified.



How can I route the 172.31.48.0/20 subnet on clients that get a dynamic ip?







share|improve this question














I configured my openvpn server to use 172.31.48.0/20, where ips from 172.31.48.0 to 172.31.62.255 are statically assigned, and 172.31.63.0/24 are dynamic.



tls-server
mode server
push "topology subnet"
ifconfig 172.31.48.1 255.255.240.0
ifconfig-pool 172.31.63.0 172.31.63.254 255.255.255.0


Where the static hosts have their ip set via ifconfig-push 172.31.48.2 255.255.240.0 in a file that matches their common name, and is in the client-configs directory that the server specified.



Clients that do not have a file with a corresponding common name will get a dynamic ip in the range 172.31.63.0/24, but they will not get a route to 172.31.48.0/20, so I cannot ping from the vpn host (172.31.48.1) to a client with a dynamic ip (such as 172.31.63.1)



On the dynamic client, it only has a route for 172.31.63.0/24, as is specified by ifconfig-pool. I would like to route all 172.31.48.0/20 traffic via the tun device that is created by the vpn client. If I run this command manually everything works:



sudo route add -net 172.31.48.0/20 dev vpn1


Where vpn1 is the vpn device specified in the client ovpn file



dev vpn1
dev-type tun


The route option in openvpn wants an ip and not a device interface, though. Meaning, this will not work:



push "route 172.31.48.0 255.255.240.0 vpn1"


And if I leave off vpn1 then openvpn on the client side will complain that no gateway was specified.



How can I route the 172.31.48.0/20 subnet on clients that get a dynamic ip?









share|improve this question













share|improve this question




share|improve this question








edited Mar 22 at 22:16

























asked Mar 22 at 21:13









jonr

1011




1011











  • My current workaround is to use a bogus ip as the gateway from the client. It gets routed appropriately on the server. push "route 172.31.48.0 255.255.240.0 172.31.63.254"
    – jonr
    Mar 22 at 23:25
















  • My current workaround is to use a bogus ip as the gateway from the client. It gets routed appropriately on the server. push "route 172.31.48.0 255.255.240.0 172.31.63.254"
    – jonr
    Mar 22 at 23:25















My current workaround is to use a bogus ip as the gateway from the client. It gets routed appropriately on the server. push "route 172.31.48.0 255.255.240.0 172.31.63.254"
– jonr
Mar 22 at 23:25




My current workaround is to use a bogus ip as the gateway from the client. It gets routed appropriately on the server. push "route 172.31.48.0 255.255.240.0 172.31.63.254"
– jonr
Mar 22 at 23:25















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f432935%2fopenvpn-push-route-via-interface%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f432935%2fopenvpn-push-route-via-interface%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay