|
1 <html> |
|
2 <head> |
|
3 <title> DTN2 Manual: Building a bigger DTN </title> |
|
4 <link rel="stylesheet" type="text/css" href="manual.css" /> |
|
5 </head> |
|
6 <body> |
|
7 <h1>Building a bigger DTN |
|
8 </h1> |
|
9 |
|
10 <p> |
|
11 This tutorial will show you how to set up two DTN2 daemons on two separate |
|
12 computers and make them talk to one another. |
|
13 |
|
14 <h2>Setting up the config files</h2> |
|
15 |
|
16 <p> You'll be using server config files like the one from the |
|
17 <a href="tutorial-1.html">first tutorial</a>. Follow these instructions |
|
18 on both servers, making each refer to the other one. |
|
19 |
|
20 |
|
21 <h3> Routing </h3> |
|
22 |
|
23 Find the area called Routing |
|
24 configuration. Create a route for each daemon like this: |
|
25 |
|
26 <blockquote><pre>route local_eid dtn://<i>name</i>.dtn</pre></blockquote> |
|
27 |
|
28 <p> |
|
29 Name can be anything you want it to be, provided it is unique for each daemon. |
|
30 e.g. dtn://bob.dtn. EID stands for Endpoint identifier. These are used to |
|
31 identify the sender and the final destination of the bundles. |
|
32 |
|
33 <h3>Interfaces</h3> |
|
34 |
|
35 <p> |
|
36 We need to modify the interfaces a little. An interface looks for |
|
37 bundles directed to that specific daemon. It is also used for routing bundles |
|
38 onwards that are not intended for that specific daemon. The <tt>interface</tt> |
|
39 command has the following format: |
|
40 |
|
41 <blockquote> |
|
42 interface add <i>name_of_interface</i> <i>type_of_interface</i> |
|
43 local_addr = <i>local address</i> local_port = <i>local port number</i> |
|
44 </blockquote> |
|
45 |
|
46 <p>For example: |
|
47 |
|
48 <blockquote><pre>interface add tcp0 tcp local_port=4556</pre></blockquote> |
|
49 |
|
50 <p> tcp0 is merely the name of the interface. It doesn't matter what you choose |
|
51 as it's just used to refer back to the interface later on. TCP is the type of |
|
52 interface being used. TCP stands for Transmission Control Protocol. It is the |
|
53 transport layer protocol we will be using to send our bundles on. There are |
|
54 other transport layer protocols we can use but for now we are going to use TCP. |
|
55 The local_addr is the address of the computer. It can be an IP address or a |
|
56 name. We won't be using the name as we will be using the default IP address on |
|
57 the machine. Finally the (optional) local_port is the port of the |
|
58 machine that the daemon will listen for incoming bundles on. The default is |
|
59 4556. |
|
60 |
|
61 <h3>Links</h3> |
|
62 |
|
63 <p> Next we have to set up a link between our computers. A link allows the |
|
64 daemons to communicate to one another via the correct IP addresses and ports. |
|
65 It points the bundles in the direction of the distant computer. |
|
66 Go down to the link section in the conf file. Add the following: |
|
67 |
|
68 <blockquote> |
|
69 link add <i>link_name</i> <i>ip address</i>[:<i>port number</i>] ONDEMAND tcp |
|
70 </blockquote> |
|
71 |
|
72 <p>For example: |
|
73 |
|
74 <blockquote><pre>link add link_tcp 131.12.45.192:4556 ONDEMAND tcp</pre></blockquote> |
|
75 |
|
76 <p> |
|
77 The link_name is what the link will be called and referenced to. It may be |
|
78 called anything. The ip address is the IP address of the computer running the |
|
79 other DTN daemon. The computer name on the network can be used, for |
|
80 instance if DHCP is in use and we don't know the IP address of the machine. We |
|
81 will stick with IP addresses for now. The (optional) port number should be the port |
|
82 number that the other DTN daemon will listen on. |
|
83 |
|
84 <h3>Route</h3> |
|
85 |
|
86 <p> Lastly, add a route for the end point of the daemon. This locates the |
|
87 daemon on the other computer. Without it the bundles will not be sent. |
|
88 |
|
89 <blockquote>route add <i>name</i> <i>link_name</i></blockquote> |
|
90 |
|
91 <p> For example: |
|
92 |
|
93 <blockquote><pre>route add dtn://george.dtn/* link_tcp</pre></blockquote> |
|
94 |
|
95 Don't forget to add the star. The asterisk is there to make all |
|
96 bundles match this route, instead of being mistaken as administrative |
|
97 bundles to be processed on the local node. |
|
98 |
|
99 <h2> Setting System Clocks </h2> |
|
100 |
|
101 <p> |
|
102 DTN uses the system clock to place an expiry timestamp into each bundle created |
|
103 in the node. This timestamp controls |
|
104 when the bundle will be discarded. The timestamp is compared with the |
|
105 local system clock on any node that processes the bundle. If the system |
|
106 clock is set to a value that is very different from the value in other nodes, |
|
107 bundles may be discarded inappropriately. Typically the lifetime of bundles |
|
108 will be set in the range of several tens of seconds to several days. This means that there is no need for precision synchronisation of system clocks, but |
|
109 communication between nodes will be unlikely to work if system clocks are set |
|
110 to widely differing values. However if very short lifetimes are used the |
|
111 required synchronisation will be correspondingly precise. |
|
112 |
|
113 <h2>Communication: dtnsend and dtnrecv</h2> |
|
114 |
|
115 Now you're ready to send bundles to and from daemons! Load both daemons up. |
|
116 Open a terminal up and go into the dtn2/apps/dtnsend folder or find the dtnsend |
|
117 executable. |
|
118 Dtnsend is a function of DTN2 that creates bundles and passes |
|
119 them to a daemon on the local machine. It also allows you to set options for |
|
120 each bundle you wish to create. The dtnsend program communicates with a DTN |
|
121 daemon through port 5010 on the local machine. Note that this port number may |
|
122 be changed in the configuration of the DTN daemon. |
|
123 |
|
124 <blockquote>./dtnsend -s <i>name of sender</i> -d <i>name of destination</i> |
|
125 -t <i> type of message to be sent</i> |
|
126 -p <i>name of file being sent/message being sent</i> |
|
127 </blockquote> |
|
128 |
|
129 <p> |
|
130 The -t argument can have three values (m, f, or d) for message, file, or date. |
|
131 |
|
132 <p> |
|
133 Use dtnsend to send to one of the daemons. In this example, we'll |
|
134 make bob send to george: |
|
135 |
|
136 <blockquote><pre>./dtnsend -s dtn://bob.dtn/b -d dtn://george.dtn/g -t m -p "Hello george"</pre></blockquote> |
|
137 |
|
138 <p> |
|
139 Notice how I have added an extra part to the daemon's EID in the source and |
|
140 destination parameters of the dtnsend command. The g and b are merely there to |
|
141 add a path for the bundle. Without the path the receiving |
|
142 daemon will interpret the bundle as an administrative bundle. The bundles will |
|
143 still go to the daemon indicated by the EID. The name of the extra part to the |
|
144 EID doesn't matter. It can be whatever you want it to be. Type bundle list |
|
145 into bob's daemon. We should see no bundles there! Then type bundle list into |
|
146 george's daemon. A bundle should be waiting there to be retrieved. |
|
147 |
|
148 <p> |
|
149 To retrieve the bundle, use dtnrecv. It collects the bundles and delivers the |
|
150 message/file/date. The dtnrecv program will wait indefinitely for new bundles |
|
151 to arrive from the DTN daemon. To get out of dtnrecv hit Control-C. |
|
152 |
|
153 <blockquote><pre>dtn2/apps/dtnrecv/dtnrecv dtn://george.dtn/g</pre></blockquote> |
|
154 |
|
155 <p> |
|
156 The message "Hello george" should be displayed. Success! |
|
157 |
|
158 </body> |
|
159 </html> |
|
160 |
|
161 </body> |
|
162 </html> |
|
163 |