Running a publicly available crust node within a private LAN

##Running a publicly available crust node within a private LAN (same method can be applied to Vaults to make them join public network)

  1. Configure your router to forward a specific port say 5484 to your local machine’s port 5484.

  2. Use preferred port configuration option to start a crust_peer example on a specific port. Crust uses a configuration file with name format <application_name>.bootstrap.cache. This file should be placed in the working directory. So for crust_peer example, the file looks like this:

     {
       "preferred_port": {
         "variant": "Tcp",
         "fields": [
           5484
         ]
       },
       "hard_coded_contacts": [],
       "contacts": []
     }
    
  3. Start the first crust_peer on your local machine (on forwarded port to be publicly accessible to other nodes).

    prakash@machine:~/rust/maidsafe/crust/target/debug/examples (rust_3)$
    ./crust_peer Listening for new connections on
    Tcp(V4(127.0.0.1:5484)), Tcp(V4(192.168.0.10:5484)),
    Tcp(V6([::1]:5484)), and listening for UDP broadcast on port 9999.
    Didn’t bootstrap to an existing network - this is the first node of a
    new network.

    Enter command (stop | connect | send )>

  4. Find your public IP address using your browser or command below
    curl -s https://4.ifcfg.me/
    Note: Above method is just an example. Safe network will not use above method(s) to find public IP address.

  5. Create a configuration for the second crust_peer to add the public address of first node.

     {
         "preferred_port": {
             "variant": "Tcp",
             "fields": [
                 0
             ]
         },
         "hard_coded_contacts": [
             {
                 "endpoint": "223.114.175.96:5484"
             }
         ],
         "contacts": []
     }
    
  6. Start second node from a different network. and send message to Node 1.

Node 2

Listening for new connections on Tcp(V4(127.0.0.1:47350)),
Tcp(V4(46.101.28.163:47350)), Tcp(V6([::1]:47350)), and listening for
UDP broadcast on port 9999. Bootstrapped to
Tcp(V4(223.114.175.96:5484))

Connected to peer at Tcp(V4(223.114.175.96:5484)) 1 connected node:
Tcp(V4(223.114.175.96:5484)) Enter command (stop | connect
| send )> Enter command (stop | connect
| send )>send 223.114.175.96:5484 Hello world
Successfully sent “Hello world” to Tcp(V4(223.114.175.96:5484)) Enter
command (stop | connect | send )>

Node 1 (Receiving 2 connections and a message from public network)

prakash@machine:~/rust/maidsafe/crust/target/debug/examples (rust_3)$
./crust_peer Listening for new connections on
Tcp(V4(127.0.0.1:5484)), Tcp(V4(192.168.0.10:5484)),
Tcp(V6([::1]:5484)), and listening for UDP broadcast on port 9999.
Didn’t bootstrap to an existing network - this is the first node of a
new network.

Enter command (stop | connect | send )>
Connected to peer at Tcp(V4(46.101.28.163:44791)) 1 connected node:
Tcp(V4(46.101.28.163:44791)) Enter command (stop | connect
| send )> Connected to peer at
Tcp(V4(46.101.28.163:44792)) 2 connected nodes:
Tcp(V4(46.101.28.163:44791)) Tcp(V4(46.101.28.163:44792)) Enter
command (stop | connect | send )>
Received from Tcp(V4(46.101.28.163:44792)) message: Hello world Enter
command (stop | connect | send )>

The above method may not sound great to some of the readers, as it involves configuring router.

The next step is UPnP integration in CRUST to allow automatic port mapping of crust nodes. Though this still require users to enable UPnP support in the router and has some security issues. This should be available hopefully this week itself.

To make this process completely automatic and without fiddling with router, we will need Hole Punching implemented in CRUST. Soon after uTP integration, we will have it in place.

Hope this help you to experiment more with Vaults :slight_smile:

13 Likes

I was under the impression that UPnP was a security disaster and should be disabled in all devices (on windows)

If your advocating trialing this over Public infrastructure, maybe a disclaimer may be prudent…especially given the information we leave on this forum and the possibility of a trail of crypto activities on the machines used to run this.

I’ll be waiting for the installers before opening up ports and the like…otherwise I might get hacked by the awesome ‘Hacking Team’ mob.

2 Likes

Works for me :slight_smile:

Digital Ocean droplet in Amsterdam talked to local machine in Glasgow

Feel free to connect to 178.62.158.150:56038 :smile:

Down for now - I’ll post again when it’s back up and look forward to seeing some messages from you all

5 Likes

I’ll have to admit I’m a little misty-eyed. This was two desktop ubuntu 15.04 computers at completely different locations.
Now to work on the vaults.

mranderson@neo:~/crust$ cargo run --example crust_peer
         Running `target/debug/examples/crust_peer`
    Listening for new connections on Tcp(5050), and listening for UDP broadcast on port 9999.
    Bootstrapped to Tcp(V4(**.***.**:5050))
    
    Connected to peer at Tcp(V4(**.***.**:5050))
    1 connected node: Tcp(V4(**.***.**:5050))
    Enter command (stop | connect <endpoint> | send <endpoint> <message>)>
    Enter command (stop | connect <endpoint> | send <endpoint> <message>)>send **.***.**:5050 hello morpheus
    Successfully sent "hello morpheus" to Tcp(V4(**.***.**:5050))
    Enter command (stop | connect <endpoint> | send <endpoint> <message>)>
    Received from Tcp(V4(**.***.**:5050)) message: Hello Mr Anderson
    Enter command (stop | connect <endpoint> | send <endpoint> <message>)>
    Received 2 messages with total size of 39 bytes in last 10 seconds.
    
    Received from Tcp(V4(**.***.**:5050)) message: Boom goes the dynamite
    Enter command (stop | connect <endpoint> | send <endpoint> <message>)>
3 Likes

Excellent :slight_smile:
Got chores to do ( What chores? A large Glenfiddich, thanks) then I’ll update my local and dropbox installs. If you are still about perhaps we could try connecting?

Well it looks like MrAnderson and Doomedj2008 have the honour of getting the first non-dev IRC network up using the messaging function in crust.

Congratulations guys :smile:
I joined in briefly too and exchanged messages with Doomedj2008.

If you are interested in joining in with further testing send me a DM with your ip and port.

5 Likes

@southside, maybe we can create an actual crust_irc example?

https://github.com/a-jamesregan/crust/blob/crust-irc/docs/crust_irc.md

4 Likes

Reading this now

I know more Python than Ruby but that’s not to say I know a lot of Python - enough to make simple django sites and wee scripts.

We don’t have to program one from scratch, we just need to modify the crust_peer example to do the following things:

  • Use nicknames instead of ip:ports
  • Be able to set your own nickname

and optionally

  • Send messages to all peers by default
2 Likes

Yeah, I know - Ive forked crust and will play about with it

1 Like

It was also the first time I have used an IRC type thing for online chatting. Thanks to the people who made it easy to do. We had four people from different areas on at the same time (one was my friend that doesn’t even have a membership to the forum, but love networks…yea that’s another whole thread)

My mind is going crazy with possibility after seeing this dream becoming reality. I left crust running all night and it still is going like a champ.

I also got the vault built and everything tested perfect. Did cargo run (imcluded above **.cache file) and it looked like it was doing something, but not sure what. Is there anything else I can do?

5 Likes

DM me with your ip and port please. If yor friend is up for it as well then send his too.

There is a slight security risk in this (OK OK the purists will tell me there is no such thing as a slight security risk).
I’ll keep a list of nicks and ip:ports - must check if I can put comments inn the bootstrap.cache file for now.
I’ll put this on a passwd-protected page - Send me your details and I’ll send you the password if you are happy with this for now.

Screenshots with IPs blanked out would be good for getting others interested especially if you can show 3 or 4 different connections.

1 Like

There is no clean way to put comments in a JSON file. The parsing of cache file will fail if you do so.

Well scratch that idea then :confounded:

The target is moving fast and I have been busy with other stuff for past few days.

Need to stand back look at the bigger picture.

Here is a screen pic of the very first non-dev use of crust.

4 Likes

I have been able to “get it running” on Windows 7 32-bit, but this error is the type I have to fix to compile:

Compiling crust v0.1.5 (file:///C:/users/noah/documents/github/maidsafe/crust)
src\getifaddrs.rs:254:40: 254:60 error: trivial numeric cast: u32 as u32. Cast can be replaced by coercion, this might require type ascription or a temporary variable
src\getifaddrs.rs:254 ifaddrs = libc::malloc(buffersize as size_t) as *mut IP_ADAPTER_ADDRESSES;
^~~~~~~~~~~~~~~~~~~~
src\lib.rs:28:24: 28:45 note: lint level defined here
src\lib.rs:28 #![warn(trivial_casts, trivial_numeric_casts, unused, unused_extern_crates, unused_import_braces,
^~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
Could not compile crust.

This code assumes that in the current environment size_t will not equal u_long in definition, but they are both defined as u32. Since lib.rs adds a warning for trivial_numeric_casts, it doesn’t compile without modification.

I have modified the statement in getifaddrs.rs line 247 to this:

#[allow(unsafe_code,trivial_numeric_casts)]

Now it allows this trivial cast, believe only in the context of the getifaddrs() method, where the issue lies on my platform.

@MrAnderson I would love to connect to someone’s network, are you connecting to an IP:port posted here or a privately communicated one?

Thanks -Noah

[Edited to add “definition”, a missing work in the 3rd paragraph (after the terminal output).]

I just have a localhost network going so far…


But this makes me very glad. :smile:

2 Likes

I was finally able to connect to a public crust node, and sent messages to Doomedj2008:

They weren’t around to respond I guess, but at least it technically worked.

5 Likes