The server configuration file cannot set multiple "push route"

Need help configuring your VPN? Just post here and you'll get that help.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
mohuangNPC
OpenVpn Newbie
Posts: 5
Joined: Mon Oct 17, 2022 10:18 am

The server configuration file cannot set multiple "push route"

Post by mohuangNPC » Mon Oct 17, 2022 10:32 am

If I set two "push route", the server can start normally,config like this:

Code: Select all

# to reach other private subnets behind

# the server.  Remember that these

# private subnets will also need

# to know to route the OpenVPN client

# address pool (10.8.0.0/255.255.255.0)

# back to the OpenVPN server.

push "route 10.110.120.0 255.255.255.0"
push "route 10.221.2.0 255.255.255.0"
But if I set more than two, config like this:

Code: Select all

# Push routes to the client to allow it

# to reach other private subnets behind

# the server.  Remember that these

# private subnets will also need

# to know to route the OpenVPN client

# address pool (10.8.0.0/255.255.255.0)

# back to the OpenVPN server.

push "route 10.110.120.0 255.255.255.0"
push "route 10.221.2.0 255.255.255.0"
push "route 172.16.0.1 255.255.255.0"
The server will fail to start, and the error is:

Code: Select all

Options error: Unrecognized option or missing or extra parameter(s) in server.ovpn:142: push (2.5.7)
Use --help for more information.
Has anyone encountered this problem, please help me

User avatar
ordex
OpenVPN Inc.
Posts: 444
Joined: Wed Dec 28, 2016 2:32 am
Location: IRC #openvpn-devel @ libera.chat

Re: The server configuration file cannot set multiple "push route"

Post by ordex » Mon Oct 17, 2022 12:22 pm

The error is related to the last route you added, not to the number of routes in total.

172.16.0.1 is not a valid network address. It should be 172.16.0.0

TinCanTech
OpenVPN Protagonist
Posts: 11139
Joined: Fri Jun 03, 2016 1:17 pm

Re: The server configuration file cannot set multiple "push route"

Post by TinCanTech » Mon Oct 17, 2022 12:36 pm

I cannot replicate this problem.

Using:

Code: Select all

push "route 10.11.12.1 255.255.255.0"
Does not cause the server to fail.

mohuangNPC
OpenVpn Newbie
Posts: 5
Joined: Mon Oct 17, 2022 10:18 am

Re: The server configuration file cannot set multiple "push route"

Post by mohuangNPC » Tue Oct 18, 2022 12:04 am

I tried it and the result is that it cannot be changed to any ip. My system is window server 2022, a configuration file edited with notepad. Could it be an encoding issue? Because the two "push routes" that take effect are from the original configuration file I modified

mohuangNPC
OpenVpn Newbie
Posts: 5
Joined: Mon Oct 17, 2022 10:18 am

Re: The server configuration file cannot set multiple "push route"

Post by mohuangNPC » Tue Oct 18, 2022 12:07 am

but the fact is that no matter what ip is added, an error will be reported. Will it be a file encoding problem, because the two "push routes" that take effect are the configuration that I modified from the original configuration file. But if I incrementally add "push route", it will report an error, for example, will the window server not add a newline after it by default?

mohuangNPC
OpenVpn Newbie
Posts: 5
Joined: Mon Oct 17, 2022 10:18 am

Re: The server configuration file cannot set multiple "push route"

Post by mohuangNPC » Tue Oct 18, 2022 12:10 am

ordex wrote:
Mon Oct 17, 2022 12:22 pm
The error is related to the last route you added, not to the number of routes in total.

172.16.0.1 is not a valid network address. It should be 172.16.0.0
I tried it and the result is that it cannot be changed to any ip. My system is window server 2022, a configuration file edited with notepad. Could it be an encoding issue? Because the two "push routes" that take effect are from the original configuration file I modified

mohuangNPC
OpenVpn Newbie
Posts: 5
Joined: Mon Oct 17, 2022 10:18 am

Re: The server configuration file cannot set multiple "push route"

Post by mohuangNPC » Tue Oct 18, 2022 12:13 am

TinCanTech wrote:
Mon Oct 17, 2022 12:36 pm
I cannot replicate this problem.

Using:

Code: Select all

push "route 10.11.12.1 255.255.255.0"
Does not cause the server to fail.
but the fact is that no matter what ip is added, an error will be reported. Will it be a file encoding problem, because the two "push routes" that take effect are the configuration that I modified from the original configuration file. But if I incrementally add "push route", it will report an error, for example, will the window server not add a newline after it by default?

User avatar
ordex
OpenVPN Inc.
Posts: 444
Joined: Wed Dec 28, 2016 2:32 am
Location: IRC #openvpn-devel @ libera.chat

Re: The server configuration file cannot set multiple "push route"

Post by ordex » Tue Oct 18, 2022 7:33 am

mohuangNPC wrote:
Tue Oct 18, 2022 12:07 am
but the fact is that no matter what ip is added, an error will be reported. Will it be a file encoding problem, because the two "push routes" that take effect are the configuration that I modified from the original configuration file. But if I incrementally add "push route", it will report an error, for example, will the window server not add a newline after it by default?
it could well be an encoding issue (especially if you are modifying the file on windows). You could try to recreate the file from scratch o modify it with a different tool.

Post Reply