kewlfft / opennic-up

OpenNIC auto DNS updater

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not enough responsive OpenNIC servers available

ChandelierX opened this issue · comments

Each time I run
opennic-up
I will see

Checking network is up
Using 88.198.116.156 as API host
https://api.opennicproject.org/geoip/?list&ipv=4&res=200&adm=0&bl&wl
Pinging 49 hosts to determine the top ones...
Resulting in 1 responsive hosts
Not enough responsive OpenNIC servers available

in my terminal.

  • Is it an expected error for Chinese users?
  • Or what can I do to fix it given that I am in China and only have SOCKS proxy?
commented

Would you be ok with only one DNS ? in this case I can lift the condition and it will set only one DNS.

Well. I prefer to have more (with at least one in IPv6). So I just manually set them in resolv.conf and Write-protect it.
So it's no need for you to work on my mere trifle any more. I just wonder whether it will work when I go abroad.
Anyway. Thanks a lot for reply.

commented

Thanks - do you manage to find manually 2 fast opennic dns while the program can find only one? I would be surprised

Weird. After test, I'm sure that I can use at least two IPv4 opennic dns (and I consider they are fast), namely, the two listed at Archwiki
Not only can I ping them, but also I could open Github by each one of them.
Maybe you should check what happened with the pinging process of opennic-up.
Please see the screenshot below:
screenshot_20180326_153909

commented

Please check the new version I am less strict on the period (400ms now) and it should return more servers.

  • Good news is: they can select 3 host for me.
    And after restart NetworkManager, I get
# Generated by NetworkManager
nameserver 202.114.96.1
nameserver 101.7.8.9
nameserver 198.206.14.241
# NOTE: the libc resolver may not support more than 3 nameservers.
# The nameservers listed below may not be recognized.
nameserver 63.231.92.27
nameserver 128.52.130.209

Where the last 3 dns is from opennic-up

  • However opennic-up shows
$ opennic-up              
Checking network is up
Using 88.198.116.156 as API host
https://api.opennicproject.org/geoip/?list&ipv=4&res=200&adm=0&bl&wl
Pinging 49 hosts to determine the top ones...
Resulting in 39 responsive hosts
Selected top 3 hosts:
198.206.14.241 # ns7.tx.us # 99.82%
63.231.92.27 # ns1.co.us(w) # 92.64%
128.52.130.209 # ns1.ma.us # 99.95%
No dns change

This happens and actually, your 3 dns are appended in resolv.conf in /etc/
I know why it shows No dns change. Since the result of nmcli -terse -fields ipv4.dns connection show $id is already the 3 new dns from opennic-up.
Of course I cancelled the write-protect. And stopped resolvconf from controlling resolv.conf.
I see in your github webpage:

Replaces the Network Manager's DNS servers with the 3 most responsive OpenNIC DNS servers for your location. resolv.conf is also updated for immediate implementation of the new DNS entries.

However in my case it doesn't work in the way you described before. It doesn't replace, but appends. What's wrong?
How can I stop /etc/resolv.conf from showing the default 2 dns allocated from my ISP?

commented

Few questions:

  1. What is the output of nmcli connection modify id -ipv4.dns "202.114.96.1" (replacing id with your interface)?
  2. Delete resolv.conf and run ./opennic-up, can you confirm it is fine now? Then at what stage are new dns added on top of the opennic ones, this is what you need to find out and prevent this process from running.
  3. also please show the output of nmcli -terse -fields ipv4.dns connection show id (replacing id with your interface) and nmcli -terse -fields UUID connection show --active

For the first question: failed to remove a value from ipv4.dns: the property doesn't contain DNS server '202.114.96.1'.

Details are listed below:

{21:05}~ ➭ cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 202.114.96.1
nameserver 114.114.114.114

{21:05}~ ➭ opennic-up
Checking network is up
Using 88.198.116.156 as API host
https://api.opennicproject.org/geoip/?list&ipv=4&res=200&adm=0&bl&wl
Pinging 49 hosts to determine the top ones...
Resulting in 8 responsive hosts
Selected top 3 hosts:
198.206.14.241 # ns7.tx.us # 99.82%
45.32.160.206 # ns4.fl.us # 90.48%
77.73.68.161 # ns1.ru # 99.40%
Updating 2c7a85f9-1a1a-452e-8ae2-c5129f5615c4
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/17)

{21:06}~ ➭ cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 202.114.96.1
nameserver 114.114.114.114
nameserver 198.206.14.241
# NOTE: the libc resolver may not support more than 3 nameservers.
# The nameservers listed below may not be recognized.
nameserver 45.32.160.206
nameserver 77.73.68.161

{21:06}~ ➭ nmcli -terse -fields UUID connection show --active
2c7a85f9-1a1a-452e-8ae2-c5129f5615c4
{21:08}~ ➭ nmcli -terse -fields ipv4.dns connection show 2c7a85f9-1a1a-452e-8ae2-c5129f5615c4
ipv4.dns:198.206.14.241,45.32.160.206,77.73.68.161

{21:08}~ ➭ nmcli connection modify 2c7a85f9-1a1a-452e-8ae2-c5129f5615c4 -ipv4.dns "202.114.96.1"
Error: failed to remove a value from ipv4.dns: the property doesn't contain DNS server '202.114.96.1'.
{21:09}~ ➭ 

For the second question, I can confirm removing resolv.conf is not a practicable solution. Sometimes it fails to create a new resolv.conf, while at other times, it just create the same one as before deleted.

  • BTW, I know the contaminated DNS are allocated by my Wifi network's provider, namely, Chinese ISP. Once I get an access to a network, unless I configure manually in NetworkManager, I will be given these 2 contaminated DNS. After I chose the option below, everything works well.
    image
    Details are listed below:
~> cat /etc/resolv.conf
# Generated by NetworkManager

~> opennic-up
Checking network is up
Using 88.198.116.156 as API host
https://api.opennicproject.org/geoip/?list&ipv=4&res=200&adm=0&bl&wl
Pinging 51 hosts to determine the top ones...
Resulting in 5 responsive hosts
Selected top 3 hosts:
77.73.68.161 # ns1.ru # 99.08%
198.206.14.241 # ns7.tx.us # 99.74%
91.217.137.37 # ns5.ru # 97.93%
Updating 2c7a85f9-1a1a-452e-8ae2-c5129f5615c4
Error: Connection activation failed: 802.1X supplicant failed

~> cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 77.73.68.161
nameserver 198.206.14.241
nameserver 91.217.137.37

For the third question,

~> nmcli -terse -fields ipv4.dns connection show 2c7a85f9-1a1a-452e-8ae2-c5129f5615c4
ipv4.dns:198.206.14.241,77.73.68.161,128.52.130.209
~> nmcli -terse -fields UUID connection show --active
2c7a85f9-1a1a-452e-8ae2-c5129f5615c4

So my problem is almost solved. Thanks a lot!

commented

I can't replicate your setup I am not sure why you can't remove the entry 202.114.96.1 using nmcli. Let me know if I can help further in sorting out your issue or if we should close it.

I can't remove the entry 202.114.96.1 using nmcli, cause it is not in ipv4.dns:198.206.14.241,77.73.68.161,128.52.130.209
But it is in /etc/resolv.conf I don't know why.
A further probe on resolv.conf and nmcli seems off-topic. So as long as you are sure that it can Replaces the Network Manager's DNS servers with the 3 most responsive OpenNIC DNS servers for your location. resolv.conf is also updated for immediate implementation of the new DNS entries in other cases than mine, this issue shall be closed.
Again, thanks for your endeavour.

commented

ok you therefore have to prevent the process writing in your resolv.conf to do so, you can follow the very good Arch wiki to investigate.

Okay. And Arch wiki is where I found your tool.