Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASUS-Merlin Services-start #116

Closed
maghuro opened this issue Mar 31, 2020 · 11 comments
Closed

ASUS-Merlin Services-start #116

maghuro opened this issue Mar 31, 2020 · 11 comments

Comments

@maghuro
Copy link
Contributor

maghuro commented Mar 31, 2020

on Merlin router, the script must be called BEFORE all scripts. because most of people have some scripts being called on services-start, and if nextdns is the last one, it causes some errors and incompatibilities. In my case, I have a script that routes a vpn server traffic to a vpn client. And if it is executed before the nextdns, some values will be overridden (don't know which and how) and I have to call this script again after nextdns.
changing nextdns calling line from last line to first line (so it can be called before everything else) is the preferable way, as from then, router will start to call any scripts with the nextdns activated. Maybe adding a little pause before executing, like 30-60s or so, so the router can have proper time to establish a wan connection.

Let me just add this little outburst - I'm no pro in coding, but as an advanced user, and as a noob coder, I think nextdns implementation right now is a little bit intrusive in a way that many scripts that we are also using are somehow bypassed, "blocked", muffled (can't find better word) by nextdns script. Talking in asus-merlin firmware, of course.
I think it should be less intrusive and a little more transparent (maybe some simple webgui?) so users can now what have been deactivated, activated, well... What's really going on.

@rs rs changed the title Services-start ASUS-Merlin Services-start Apr 1, 2020
@rs
Copy link
Contributor

rs commented Apr 1, 2020

Related to #115

@dave14305 what do you think?

@dave14305
Copy link
Contributor

The way dnsmasq.postconf is setup, dnsmasq.conf will only be updated if the nextdns daemon is running. I’m not familiar with how this can conflict with a vpn client (I don’t use vpn client on the router). If nextdns hasn’t started when dnsmasq starts, it will default to the WAN DNS settings. @maghuro can you give a more specific example? Or PM me on SNB with the details.

It is bad to add artificial delays to startup scripts.

@maghuro
Copy link
Contributor Author

maghuro commented Apr 1, 2020

I'm using a script that routes all vpn server traffic to one of the vpn clients (x3mRouting, option 4). This script isn't called from services-start, it's called In other way (I think on openvpn-start)
I think it adds some things to iptables, not sure.
It runs at boot. After that, nextdns starts and somehow the settings added from x3mRouting blow away (?)
Then if I'm on my mobile, for example and I connect to my routers vpn server, I can only have access to lan. If I want to gain access to lan and wan (through vpn client which is on), I have to manually call x3mRouting script again.
Unfortunately I don't have the proper knowledge to say what's really going on or to debug it properly.

However, if I put the command line to start NextDNS on the first line of services-start, it works and I can properly remote connect to my vpn server and have access to both lan and wan.
Probably because If nextdns is called after everything, the x3mRouting scripts is called a little bit later and properly configure everything.

Despite of all of this, every script that I have configured on services-start (including a couple of scripts I've written) must be called AFTER nextdns is properly configured, so they can access network through nextdns's DNS and not through router's default DNS.
That way, in resume, I think the best to have is to call nextdns script after everything, so it must be put in the first line (second, if we take in account !#/bin/sh) of services-start

@maghuro
Copy link
Contributor Author

maghuro commented Apr 2, 2020

Turns out it was a problem with the script I'm using to write iptables and that wasn't have nothing to do with nextdns.
I'm sorry, but it was hard to debug and everything pointed to an issue with nextdns.

However I keep my thinking that nextdns script SHOULD be called before everything else.
Please check that the pull request I made is good to achieve this.
Don't know golang but I think it'll do the job.

@maghuro
Copy link
Contributor Author

maghuro commented Apr 16, 2020

#118

@maghuro
Copy link
Contributor Author

maghuro commented May 3, 2020

You really should look at that, put the calling nextdns line on the top of everything (after the shebang of course)

@rs
Copy link
Contributor

rs commented May 4, 2020

Is this related to #144?

@maghuro
Copy link
Contributor Author

maghuro commented May 4, 2020

No, different things.
This one is to add the "nextdns.init start" to the first place of services-start file, instead of just appending it to the ending.

The other one is that when the script is called through services-start, everything looks good.
If I call it manually through terminal, everything's good.
But if I manually add the line to, for example, "openvpn-event" file so the script is let's say restarted everytime I reboot a vpn, that error happens.

@rs rs added ✨ feature-request New feature or request 🧩 init-rc and removed 🧩 router-setup labels May 4, 2020
@rs rs reopened this Jun 17, 2020
@rs rs closed this as completed in 7600c8e Jun 17, 2020
@rs
Copy link
Contributor

rs commented Jun 17, 2020

@maghuro can you please test master and confirm it works?

@maghuro
Copy link
Contributor Author

maghuro commented Jun 17, 2020

I'm not at home right now and without possibility to compile it.
Assuming that it is putting the line at the top, it will work.
Have you took in account if the file has more lines? So it won't delete it?

Thanks! 😊

@maghuro
Copy link
Contributor Author

maghuro commented Jun 19, 2020

Just tested it, perfectly working.

However... #265

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants