-
Notifications
You must be signed in to change notification settings - Fork 12
Connect To External Network
In this tutorial, you will learn how to setup your las2peer node to connect to an external las2peer network (that is, connecting to a node that might reside behind some firewall in another network than the one your node belongs to).
You need to open a UDP and TCP port at your router, since a las2peer node uses both at the same time. Please refer to the manual of your router manufacturer for more information on how this works for your router, but the result should look something like this:
This example shows the configuration for a node you want to start at port 9011. You can also just enable UPnP at your router, but please be aware of the (general) security threats this can cause.
Please refer to your routers manual on how to enable UPnP support.
In future releases the following step might become obsolete, because we integrate the libs into the core jar package
Then add the needed libraries to your project's "lib" folder. You need the following three libraries, which you can just download from some open source repository and then put them into the "lib" folder. Do not replace any existing libraries and please download the exact version as stated below, since the underlying FreePastry library that realizes las2peer's network functionality does not work with newer versions.
commons-jxpath-1.1.jar http://www.java2s.com/Code/JarDownload/commons-jxpath/commons-jxpath-1.1.jar.zip
commons-logging-1.2.jar http://mirror.synyx.de/apache//commons/logging/binaries/commons-logging-1.2-bin.zip
sbbi-upnplib-1.0.4.jar http://www.java2s.com/Code/JarDownload/sbbi/sbbi-upnplib-1.0.4.jar.zip
Please add the following parameters to your pastry nodes properties file or create a new one as described here.
nat_network_prefixes = 127.0.0.1;10.;192.168.
nat_search_policy = prefix
probe_for_external_address = true
firewall_test_policy = always
nat_handler_class = rice.pastry.socket.nat.sbbi.SBBINatHandler
This configuration should be sufficient for all commonly configured home networks. las2peer will automatically use this file, you don't have to point it to it somehow.
This is it. You now can join an external network. Therefore specify a bootstrap node at node startup. Please be aware that if you have disabled UPnP, you will see an error at your node startup called "UPNPResponseException". This does not affect your node in any way, if you have configured your port forwarding correctly in step 1. Please also note that it can take a considerable amount of time until your node is fully started, up to 2 minutes are normal, so don't Ctrl+C it too fast;-).