What's new

How to input a list of IP to VPN Director instead of putting single CIDR into each policy?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

vstevenphan

Occasional Visitor
I'm having trouble in putting many IPs or CIDRs in VPN Director right now. I have to put every single CIDR for every single policy, and it's a long list of CIDRs. Is there anyway to input a list of CIDRs for VPN Directors?
1647086533103.png

My list is very long CIDRs, almost 180 ones

1647086579403.png

Putting 180 policies is tedious
 
That’s a lot of effort for PornHub.

Technically you need an ipset of type hash:net, but there’s no built-in support for that in VPN Director. The aging x3mRouting script does use ipsets, but its status is uncertain as the developer is missing in action.
 
That’s a lot of effort for PornHub.

Technically you need an ipset of type hash:net, but there’s no built-in support for that in VPN Director. The aging x3mRouting script does use ipsets, but its status is uncertain as the developer is missing in action.
So I have to manually put every single one as I do it right now?
 
You could convert the input list into the internal format used by the VPN Director and update the rulelist directly in JFFS.

Code:
#!/bin/sh

cat << 'EOF' > /tmp/rules
177.177.177.177
188.188.188.188
199.199.199.0/24
EOF

rulelist=''; n=1

while read line; do
    rulelist="${rulelist}<1>PH$((n++))>>$line>OVPN1"
done < /tmp/rules

echo "$rulelist" > /jffs/openvpn/vpndirector_rulelist
:

If you already have a file containing just these rules, then obviously you can input that file directly. I only created a file of rules to illustrate the process.

Granted, it's not the most efficient means to deal w/ a long list of IPs/networks. Techniques involving ipset are better in that case. But at least if you're willing to live w/ such long lists using the VPN Director, the above will work.

P.S. Any changes you make to the file /jffs/openvpn/vpndirector_rulelist will only be recognized once you hit Apply on the VPN Director webpage.
 
Last edited:

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top