Pages:
Author

Topic: Help with DNS Seeder and hardcoded Seednodes (Read 5202 times)

jr. member
Activity: 43
Merit: 16
I realize this is an extremely old post, but it seems that even to this day people still struggle with setting up DNS seeders for their altcoins. I just want to point out that nowadays there is a clone of the bitcoin-seeder called the generic-seeder that is much easier to setup for most altcoins and also includes a step-by-step setup guide for all parts of the process. It adds new optional features, some small fixes and most importantly, you no longer have to edit the source code to get it to work with your altcoin because all the common variables that change across altcoins have been separated into a config file for easy configuration.

Read more here: https://bitcointalksearch.org/topic/dns-seeder-setup-guide-using-the-generic-seeder-5239304
legendary
Activity: 966
Merit: 1000
Hi guys, i am trying to run a dns seeder, all works fine thank to this great tutorial except one thing, the dns dnsseed only get the peers that use the default p2p port and discard all of them who uses another ports, there are some way to avoid

thanks very much in advance

full member
Activity: 193
Merit: 100
September 20, 2014, 08:45:49 PM
#27
Thanks to bee7 and bigredmachine pnSeeds and the dns seeder are properly functioning. Solutions will be posted in OP.

No worries!  It would be awesome if you made a good addition to the post with all the solutions (keep the original question and just add the answer, so that others in the future can search and find it!).
newbie
Activity: 21
Merit: 0
September 20, 2014, 07:56:55 PM
#26
Thanks to bee7 and bigredmachine pnSeeds and the dns seeder are properly functioning. Solutions will be posted in OP.
hero member
Activity: 574
Merit: 523
September 20, 2014, 06:31:00 PM
#25
@OP, check PM, please
newbie
Activity: 21
Merit: 0
September 20, 2014, 06:12:44 PM
#24
Thank you bigredmachine! that was exactly the mistake I've been struggling with.  Clients are now able to connect to the seednode and subsequently to other clients.  I can't offer much but pm me and it would be my pleasure to buy you a beer. Wink

Quote
Cannot connect to kjy2eqzk4zwi5zd3.onion:9751: unsupported network

Are you running Tor? And have you put up a hidden service at port 9751 on that node?

I am not running Tor. The coin daemon attempts this connection automatically.

You should be running the instance of your coin wallet at cryptodistributed.org as your dnsseed has this address encoded as an address of a seed node.
The dnsseed then collect the list of known to this node peers form it and publish it through dns.

I am now running an instance of the coin daemon on vps 104.131.53.44 and am still unable to connect to peers using DNS.

I get the following:
Code:
dnsseed thread start
Loading addresses from DNS seeds (could take a while)
addcon thread start
msghand thread start
opencon thread start
net thread start
dumpaddr thread start
init message: Done loading
0 addresses found from DNS seeds
dnsseed thread exit
GetMyExternalIP() received [104.131.18.112] 104.131.18.112:0
GetMyExternalIP() returned 104.131.18.112
AddLocal(104.131.18.112:9751,4)
ext-ip thread exit
Adding fixed seed nodes as DNS doesn't seem to be available.

The DNS seeder shows nothing:
Code:
$ 0/1 available (1 tried in 800s, 0 new, 0 active), 0 banned; 0 DNS requests, 4 db queries

Something is definitely wrong with my current DNS configuration. I have a hunch it has to do with an improperly configured reverse zone file. 

I came across this stackoverflow as a possible solution, but I have not been able to find any posts within the cryptocurrency community where this solution was necessary. I'm not sure it will even be of use in this situation.
http://stackoverflow.com/questions/15338232/how-to-forward-a-subzone


full member
Activity: 193
Merit: 100
September 20, 2014, 09:06:29 AM
#23

104.131.18.228 is the IP address of my seednode as is configured as follows;

unsigned int pnSeed[] =
{
      0x688312e4
};


I am fairly certain this is your problem.  I believe that you have to reverse the IP address, so your pnSeed should be 0xe4128368.

Here is a perl script I found that will do this for you:

Code:
#!/usr/bin/perl

# Twobits twobit integer dotted quad to reverse hex convertor
#  designed for q&d use to put seeds into pnSeeds in *coins

my $ip;

if (@ARGV) {
    $ip = shift @ARGV;
} else {
    print "Enter an (dotted quad) ip address: ";
    chomp( $ip = );
}

printf "0x%08x\n",  unpack 'N', pack 'C4', reverse split '\.', $ip;

I got that from this Bitcointalk comment by twobits:
https://bitcointalksearch.org/topic/m.1983185
hero member
Activity: 574
Merit: 523
September 20, 2014, 08:04:37 AM
#22
I am not running a wallet on cryptodistributed.org.

Do you mean that I should be running an instance of the coin daemon on 104.131.53.44? If this is the case I definitely did not understand that to be so.

You should be running the instance of your coin wallet at cryptodistributed.org as your dnsseed has this address encoded as an address of a seed node.
The dnsseed then collect the list of known to this node peers form it and publish it through dns.


Edit: This is not correct.

newbie
Activity: 21
Merit: 0
September 19, 2014, 11:14:30 PM
#21
I am not running a wallet on cryptodistributed.org.

Do you mean that I should be running an instance of the coin daemon on 104.131.53.44? If this is the case I definitely did not understand that to be so.
hero member
Activity: 574
Merit: 523
September 19, 2014, 10:42:34 PM
#20


Code:
telnet cryptodistributed.org 9751
Trying 104.131.53.44...
telnet: connect to address 104.131.53.44: Connection refused

Do you have a wallet running at cryptodistributed.org?

the dnsseed daemon pools the list of nodes from all nodes it could connect that are listed in bitcoin.cpp, line 299:

Code:
-  CService ip("litecointools.com", 9333, true);
+ CService ip("cryptodistributed.org", 9751, true);   // 9751 is the P2P Port for my Pfennig clone
newbie
Activity: 21
Merit: 0
September 19, 2014, 10:27:06 PM
#19

so it returns no A records. Did you customize dnsseed to suit your coin?


I'm using https://github.com/n00bsys0p/altcoin-seeder modified appropriately for my coin.

The changes are as follows;

bitcoin.cpp

Line 299
-  CService ip("litecointools.com", 9333, true);
+ CService ip("cryptodistributed.org", 9751, true);   // 9751 is the P2P Port for my Pfennig clone

combine.pl
Line 61 
- if ($addr =~ /\A(\d+)\.(\d+)\.(\d+)\.(\d+):9333/) {
+ if ($addr =~ /\A(\d+)\.(\d+)\.(\d+)\.(\d+):9751/) { 

db.h
Line 15
- #define REQUIRE_VERSION 70002
+#define REQUIRE_VERSION 70002  // Pfennig require version same as Bitcoin

Line 19
-  return testnet ? 0 : 470000;
+ return testnet ? 0 : 0;         // Set to 0 as genesis is only current checkpoint block

Line 122
-  if (clientVersion && clientVersion < 50000) { return 604800; }
+ if (clientVersion && clientVersion < 90201) { return 604800; }       // client version for Pfennig clone

main.cpp
Line 342
- static const string mainnet_seeds[] = {"dnsseed.litecointools.com", "dnsseed.litecoinpool.org", "dnsseed.ltc.xurious.com", ""};
- static const string testnet_seeds[] = {"testnet-seed.litecointools.com", ""};

+static const string mainnet_seeds[] = {"seed.cryptodistributed.org", ""};
+static const string testnet_seeds[] = {"testnet-seed.cryptodistributed.org", ""};

Line 351
-  db.Add(CService("kjy2eqzk4zwi5zd3.onion", 9333), true);
+ db.Add(CService("kjy2eqzk4zwi5zd3.onion", 9751), true); 

Line 380-383
- pchMessageStart[0] = 0xfc;
- pchMessageStart[1] = 0xc1;
- pchMessageStart[2] = 0xb7;
- pchMessageStart[3] = 0xdc;

+pchMessageStart[0] = 0x0b;
+pchMessageStart[1] = 0x11;
+pchMessageStart[2] = 0x09;
+pchMessageStart[3] = 0x07;   //testnet Pfennig magic numbers

protocol.cpp
+unsigned char pchMessageStart[4] = { 0xfb, 0xc0, 0xb6, 0xdb };
-unsigned char pchMessageStart[4] = { 0xf9, 0xbe, 0xb4, 0xd9 };   // mainnet Pfennig Magic number

protocol.h
- return testnet ? 19333 : 9333;
+ return testnet ? 19751 : 9751;
hero member
Activity: 574
Merit: 523
September 19, 2014, 09:10:31 PM
#18
On the dns seeder:
$ dig @127.0.0.1 seed.cryptodistributed.org

;<<>> DiG 9.9.5-3-Ubuntu <<>> @127.0.0.1 seed.cryptodistributed.org
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 61122
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEDUOSECTION:
; EDNS: version; 0, flags:; udp: 4096
;; QUESTION SECTION:
; seed.cryptodistributed.org.        IN        A

;; Query time: 20 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Sep 19 20:23:31 EDT 2014
;; MSG SIZE rcvd: 55



so it returns no A records. Did you customize dnsseed to suit your coin?
newbie
Activity: 21
Merit: 0
September 19, 2014, 08:40:58 PM
#17
On the dns seeder:
$ dig @127.0.0.1 seed.cryptodistributed.org

;<<>> DiG 9.9.5-3-Ubuntu <<>> @127.0.0.1 seed.cryptodistributed.org
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 61122
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEDUOSECTION:
; EDNS: version; 0, flags:; udp: 4096
;; QUESTION SECTION:
; seed.cryptodistributed.org.        IN        A

;; Query time: 20 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Sep 19 20:23:31 EDT 2014
;; MSG SIZE rcvd: 55

On a client VPS:
$ dig @104.131.20.192 seed.cryptodistributed.org

; <<>> DiG 9.9.3-rpz2+rl.13214.22-P2-Ubuntu-1:9.9.3.dfsg.P2-4ubuntu1.1 <<>> @104.131.20.192 seed.cryptodistributed.org
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 35619
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;seed.cryptodistributed.org.   IN   A

;; Query time: 227 msec
;; SERVER: 104.131.20.192#53(104.131.20.192)
;; WHEN: Fri Sep 19 20:38:17 EDT 2014
;; MSG SIZE  rcvd: 55

Master zone file checks:

Forward zones look good:

$ named-checkzone cryptodistributed.org /etc/bind/zones/db.cryptodistributed.org
zone autun.hom /IN: loaded serial   2
Ok

$ named-checkzone cryptodistributed.org /etc/bind/zones/db.cryptodistributed.org
zone autun.hom /IN: loaded serial   2
Ok

I think I may have found the problem, it appears  that I've made a mistake in my reverse zone file:

$ names-checkzone cryptodistributed.org /etc/bind/zones/db.104.131.55
zone cryptodistributed.org/IN: NS 'ns1.cryptodistributed.org' has no address records (A or AAAA)
zone cryptodistributed.org/IN: NS 'ns2.cryptodistributed.org' has no address records (A or AAAA)
zone cryptodistributed.org/IN: not loaded due to errors

$ named-checkzone 55.131.104.in-addr.arpa /etc/bind/zones/db.104.131.55
zone 55.131.104.in-addr.arpa/IN: loaded serial 10
OK

As I understand it, I should not need to create an A record in the reverse zone file as the PTR record fulfils this function.

/etc/bind/zones/db.104.131.55

$TTL    604800
@       IN      SOA     cryptodistributed.org. admin.cryptodistributed.org. (
                              10         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;

; Name servers
        IN      NS      ns1.cryptodistributed.org.
        IN      NS      ns2.cryptodistributed.org.

; PTR records
112          IN      PTR      ns1.cryptodistributed.org.
252.18      IN      PTR      ns2.cryptodistributed.org.
44.53      IN       PTR      www.cryptodistributed.org.
192.20       IN      PTR    seed.cryptodistributed.org.

Thoughts on where I've gone wrong?
hero member
Activity: 574
Merit: 523
September 19, 2014, 03:03:20 PM
#16
I understand the clients should not connect directly to the dnsseeder, I meant that the DNS seeder is not logging attempted connections or IP addresses from coin clients.

It is running as root and listening on port 53.

In the post above I showed you that I could not connect. Is the port 53 open in firewall?

Anyway, what 'dig @127.0.0.1 seed.cryptodistributed.org' does report being issued locally at this host?
newbie
Activity: 21
Merit: 0
September 19, 2014, 02:15:39 PM
#15
I understand the clients should not connect directly to the dnsseeder, I meant that the DNS seeder is not logging attempted connections or IP addresses from coin clients.

It is running as root and listening on port 53.
hero member
Activity: 574
Merit: 523
September 19, 2014, 01:46:52 PM
#14
It hardly would connect directly as it uses standard resolver library to get all A mappings from the zone.

is it running and listening at port 53 at all? :

Code:
dig @104.131.20.192 seed.cryptodistributed.org

; <<>> DiG 9.9.4-P2-RedHat-9.9.4-15.P2.fc20 <<>> @104.131.20.192 seed.cryptodistributed.org
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached
newbie
Activity: 21
Merit: 0
September 19, 2014, 01:33:20 PM
#13
I configured my DNS as:

; Name servers
cryptodistributed.org.    IN    NS    ns1.cryptodistributed.org.
cryptodistributed.org.    IN    NS    ns2.cryptodistributed.org.
seed.cryptodistributed.org.  IN  NS  seedvps.cryptodistributed.org.

; A records for name servers
ns1    IN    A    104.131.55.112
ns2    IN    A    104.131.18.252
seedvps    IN    A    104.131.20.192

And chainparams.cpp as I originally had it configured;

vSeeds.push_back(CDNSSeedData("cryptodistributed.org", "seed.cryptodistributed.org"));

but I am now getting the following error;

connect() to 228.18.131.104:9751 failed: Network in unreachable (101)
Cannot connect to kjy2eqzk4zwi5zd3.onion:9751: unsupported network

104.131.18.228 is the IP address of my seednode as is configured as follows;

unsigned int pnSeed[] =
{
      0x688312e4
};

So I'm not sure why it's attempting to connect to that IP instead.

There are no visible attempts from the coin daemon to connect to the DNS seeder on 104.131.20.192.

On the VPS 104.131.20.192, on which I'm running the dns seeder using;

./dnsseed -h seed.cryptodistributed.org -n 104.131.20.192

I get;

$ 0/1 available (1 tried in 800s, 0 new, 0 active), 0 banned; 10 DNS requests, 14 db queries
hero member
Activity: 574
Merit: 523
September 19, 2014, 07:59:03 AM
#12
Just one correction:

chainparams.cpp
vSeeds.push_back(CDNSSeedData("cryptodistributed.org", "seed.cryptodistributed.org"));

newbie
Activity: 21
Merit: 0
September 19, 2014, 07:53:37 AM
#11
You are making it much harder than needed. The seednode in the source should be like coin.seednode.org - Then you point that DNS to your node(s). When it looks for a seednode it looks for a list of IPs to basically addnode

This is why you only have connections through addnodes

FYI:

NS record should point to FQDN (see http://www.rfc-editor.org/rfc/rfc1035.txt, chapter 3.3.11), that may not belong to specifically this domain, which in turn must have an A record in its zone. So basically all you need is this:

Code:
seed.cryptodistributed.org.  IN  NS  seedvps.cryptodistributed.org.
seedvps  IN  A  a.b.c.d

and the host a.b.c.d must run your dnsseed daemon.

 Shocked

Now I see! I've been going crazy but I see now where the problem is. I should set up my dns like this;

; Name servers
cryptodistributed.org.    IN    NS    ns1.cryptodistributed.org.
cryptodistributed.org.    IN    NS    ns2.cryptodistributed.org.
seed.cryptodistributed.org.  IN  NS  seedvps.cryptodistributed.org.

; A records for name servers
ns1    IN    A    104.131.55.112
ns2    IN    A    104.131.18.252
seedvps    IN    A    104.131.20.192

and in the coin like so;

chainparams.cpp
vSeeds.push_back(CDNSSeedData("cryptodistributed.org", "seedvps.cryptodistributed.org"));

Superficially, this looks redundant to me and is probably the reason why I had failed to understand.
Going to try this tonight.
hero member
Activity: 574
Merit: 523
September 19, 2014, 12:01:56 AM
#10
FYI:

NS record should point to FQDN (see http://www.rfc-editor.org/rfc/rfc1035.txt, chapter 3.3.11), that may not belong to specifically this domain, which in turn must have an A record in its zone. So basically all you need is this:

Code:
seed.cryptodistributed.org.  IN  NS  seedvps.cryptodistributed.org.
seedvps  IN  A  a.b.c.d

and the host a.b.c.d must run your dnsseed daemon.
Pages:
Jump to: