VPN Policy Routing Error

I'm trying to route some IP over a VPN interface and I'm getting this error

Service Errors
Error running custom user file '/etc/vpn-policy-routing.vpn.user'!

and here is the Custom User File Includes
/etc/vpn-policy-routing.vpn.user

Content of the file:

#!/bin/sh

TARGET_IPSET='wan'
TARGET_FNAME="/etc/vpn-ipv4.list"

_ret=1

if [ -s "$TARGET_FNAME" ]; then
	awk -v ipset="$TARGET_IPSET" '{print "add " ipset " " $1}' "$TARGET_FNAME" | ipset restore -! && _ret=0
fi

return $_ret

and IP list content:
nano /etc/vpn-ipv4.list

1.1.1.1/32
8.8.8.8/32

Does it run fine when you call the /etc/vpn-policy-routing.vpn.user from the shell?

How can I run it ?
Because when I try ./etc/vpn-policy-routing.vpn.user
-ash: ./etc/vpn-policy-routing.vpn.user: Permission denied

Just /etc/vpn-policy-routing.vpn.user
I hope you have already made it executable.

That didn't work, but I made it work with this command and got this output

root@router:/etc# /bin/ash vpn-policy-routing.vpn.user
ipset v7.6: Error in line 1: The set with the given name does not exist

ls -la /etc/vpn-policy-routing.vpn.user ?

-rw-r--r-- 1 root root 226 Apr 9 16:32 /etc/vpn-policy-routing.vpn.user

chmod +x /etc/vpn-policy-routing.vpn.user
1 Like

It was already executable and I did it again with and same error. Even preconfigured aws and Netflix have the same issues.

root@router:/etc# chmod +x /etc/vpn-policy-routing.vpn.user
root@router:/etc# /bin/ash /etc/vpn-policy-routing.vpn.user
ipset v7.6: Error in line 1: The set with the given name does not exist
root@router:~# /etc/vpn-policy-routing.aws.user
-ash: /etc/vpn-policy-routing.aws.user: Permission denied
root@router:~# /bin/ash /etc/vpn-policy-routing.aws.user
ipset v7.6: Error in line 1: The set with the given name does not exist

The file attributes you posted say different.

1 Like

You have messed up something in your system, the file can run fine without calling ash.

root@magiatiko:[~]#vim  /etc/vpn-policy-routing.vpn.user
root@magiatiko:[~]#nano /etc/vpn-ipv4.list
root@magiatiko:[~]#chmod +x /etc/vpn-policy-routing.vpn.user
root@magiatiko:[~]#/etc/vpn-policy-routing.vpn.user 
ipset v7.6: Error in line 1: The set with the given name does not exist

Still, you need to fix the errors, starting by creating the ipset.

1 Like

That's how I build the firmware from image builder.

make -j4 image PROFILE=zbtlink_zbt-we1326 PACKAGES="luci luci-theme-material luci-app-upnp luci-app-sqm luci-app-wireguard luci-app-https-dns-proxy luci-app-vpn-policy-routing wget curl ca-certificates ca-bundle nano -luci-theme-bootstrap" FILES=files/

I configure some other rules and these are working with some warning like this

Service Errors
Error running custom user file '/etc/vpn-policy-routing.vpn.user'!
Service Warnings
The 'resolver_ipset' is set to 'dnsmasq.ipset', but DNSMASQ ipsets are not supported on this system!

Are you running dnsmasq-full

1 Like

Deselect dnsmasq in your build.

1 Like

Just added new firmware with full dnsmsq and working.
Thanks

Now I'm getting another issue.

root@OpenWrt:~# /etc/vpn-policy-routing.ca-ipv4.user 
ipset v7.6: Missing second mandatory argument to command add
Try `ipset help' for more information

If you have an unrelated issue, please start a new topic instead.

No, it's the same topic but now when I am able to run the script it gives me that error.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.