forked from sipa/bitcoin-seeder
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
134 lines (92 loc) · 4.53 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
wispr-seeder
==============
WISPR-seeder is a crawler for the WISPR network, which exposes a list
of reliable nodes via a built-in DNS server.
Features:
* regularly revisits known nodes to check their availability
* bans nodes after enough failures, or bad behaviour
* accepts nodes down to v0.3.19 to request new IP addresses from,
but only reports good post-v0.3.24 nodes.
* keeps statistics over (exponential) windows of 2 hours, 8 hours,
1 day and 1 week, to base decisions on.
* very low memory (a few tens of megabytes) and cpu requirements.
* crawlers run in parallel (by default 24 threads simultaneously).
REQUIREMENTS
------------
$ sudo apt-get install build-essential libboost-all-dev libssl-dev
COMPILING
---------
Compiling will require boost and ssl. On debian systems, these are provided
by `libboost-dev` and `libssl-dev` respectively.
$ make
This will produce the `dnsseed` binary.
BASIC USAGE/SETUP
-----
Assuming you want to run a dns seed on seed.MYURL.com, you will
need an authorative NS record in MYURL.com's domain record, pointing
to for example vps.MYURL.com:
$ dig -t NS seed.MYURL.com
;; ANSWER SECTION
seed.MYURL.com. 86400 IN NS vps.MYURL.com.
On the system vps.MYURL.com, you can now run dnsseed:
./dnsseed -h seed.MYURL.com -n vps.MYURL.com
If you want the DNS server to report SOA records, please provide an
e-mail address (with the @ part replaced by .) using -m.
RUNNING AS NON-ROOT
-------------------
Typically, you'll need root privileges to listen to port 53 (name service).
One solution is using an iptables rule (Linux only) to redirect it to
a non-privileged port:
$ iptables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-port 5353
If properly configured, this will allow you to run dnsseed in userspace, using
the -p 5353 option.
See also the example at the bottom which gives a working example of how to do this on ubuntu.
PERMANENT SETUP
____
For a more robust/permanent setup - that auto starts on server reboot.
1) Modify variables in dnsseed_service.sh
2) sudo cp dnsseed_service.sh /etc/init.d/wisprdnsseed
3) sudo chmod +x /etc/init.d/wisprdnsseed
4) sudo service wisprdnsseed start
5) sudo update-rc.d wisprdnsseed defaults
ADDITIONAL SETUP
________________
The seeders periodically scan for two files "nodes4.txt" (ipv4); "nodes6.txt" (ipv6). (Plain text files with one ip per line - no port numbering)
If these files are present, the seeders will use these as an additional source of IPs to feed into the crawler, this can help get better network coverage.
For best seeder performance, it is advised to acquire an external source that can provide such a list of IPs and then use a cronjob to have it periodically place new versions of the lists in these files.
EXAMPLE SETUP - RUNNING TWO DNS SEEDS ON ONE UBUNTU SERVER USING TWO IPS (testnet + mainnet)
__________________________________________________________________
Basic setup to run two DNS seeds from one box (one for mainnet one for testnet)
Assumes ufw is already set up and enabled.
Please ensure there is not already a service on port 53 (dnsmasq/avahi) if there is that must first be removed.
Assuming two external IPs for the box, with NS records already set up:
104.233.1.1 seed.example.com vps.example.com
104.233.1.2 testseed.example.com testvps.example.com
Place the following in /etc/ufw/before.rules to forward the incoming traffic to different ports based on the IPs:
*nat
:PREROUTING ACCEPT [0:0]
-F PREROUTING
-A PREROUTING -d 104.233.1.1 -p udp --dport 53 -j REDIRECT --to-port 5454
-A PREROUTING -d 104.233.1.1 -p tcp --dport 53 -j REDIRECT --to-port 5454
-A PREROUTING -d 104.233.1.2 -p udp --dport 53 -j REDIRECT --to-port 5455
-A PREROUTING -d 104.233.1.2 -p tcp --dport 53 -j REDIRECT --to-port 5455
COMMIT
Allow ports through ufw:
sudo ufw allow 53 && sudo ufw allow 5454 && sudo ufw allow 5455 && sudo ufw reload
Set up init scripts:
sudo cp dnsseed_service.sh /etc/init.d/wisprdns
sudo cp dnsseed_service.sh /etc/init.d/wisprdnstestnet
Configure init scripts:
Open wisprdns script and set the variables in it.
PREFIX1=seed
PREFIX2=vps
PORT=5454
URL=example.com
Open wisprdnstestnet and set the variables in it.
PREFIX1=testseed
PREFIX2=testvps
PORT=5455
URL=example.com
Note that you must also set the APPROOT for each of the above, to seperate folders, you will need two copies of the folder one for each app to run in.
Finally run the init scripts and wait a while. You can confirm from the inside if everything works by running tail -f on the log file. You can confirm (from the outside)
if everything works via nslookup.