Chord (Distributed Hash Table) - networking

I want to create my own Chord implementation for P2P file sharing
I followed an article which explained that every node has it's ID (hash of the IP for example)
my questions are:
how a new client join the network? there must be a server to manage it. right?
how you set for the new client the finger table?

Chord authors have their own implementation published:
http://pdos.csail.mit.edu/chord/#downloads
You can check how they manage those questions.

how a new client join the network?
By advertising its presence to other peers.
there must be a server to manage it. right?
Either a server or a location (URL) where peers can fetch IP addresses of other peers. This location is updated by peers themselves with fresh data.
If you dig deeper in this issue, you'll face the NAT traversal issue.
how you set for the new client the finger table?
By knowing/fetching other peers' id and computing the 'finger' order.

Related

WiFi data protection from landlord / Router as encrypted repeater?

I have a spare router lying around. In our house, we’re using our landlords WiFi and we’re a bit sketched out to allow them to read all our visited websites and whatnot.
So there are basically two ideas.
A) use one of the many VPNs to undermine this
B) (and this would be easier for having guests for example,) setting up a second router to basically mimic a repeater but with a layer of encryption. Would that work?
Could we connect to this second WiFi network, encrypt every data package, so our landlord doesn’t get to read anything?
Thanks for every input/idea!
A) use one of the many VPNs to undermine this
Yes, effectively this is the only way
B)... setting up a second router to basically mimic a repeater but with a layer of encryption.
Point B alone won't give you full privacy without point A. I mean - even with an additional router it's posible to see DNS queries (dnssec is still not common) and target IP addresses.
As Maarten already commented, combination of both (=having a router with VPN connection) would give you ensurance the all the connections are confidential (up to the VPN endpoint)

Is it possible, for an other client, to 'trust' a client in a network

I'm considering a problem in which a node lives in a network of many nodes. Nodes come and go. Each new node is spawned from an other (trusted) node (at least I could do that). Data is being transmitted between the nodes. No central authority exists.
Is it possible for a receiving node to know that the transmitting node is trusted?
I'm looking for all sorts of attack vectors. The server running the node could be compromised. Man in the middle attacks? How does Bittorrent prevent malicious bytes entering the network (do they at all)? Could public/private encryption play a role?
Try looking into PGP, which uses the 'web of trust' concept. It sounds to me like that's what you're looking for.

Joining a Chord network (dht)

I'm writing a chord netowrk on my LAN (the node key is an hash of the IP)
I read many articles about Chord network
but I didn't figure it out:
when a new client want to join the network, it must know another client in the network
or some kind of server to manage a new client joining.
am I right?
Yes, when joining a DHT network, you must know at least one other node in the network you can announce yourself to.

p2p simulation and distributed hash table

I am learning the p2p architecture through a simulation within a single machine. For that I was told that I can use named pipes. I am in the design phase of the simulation. Here is how I plan to move forward:
Create a peer program that is able to join the p2p 'network'. The network is a collection of such peers. The peer is identified via the process id in the machine.
When a peer is created i.e., joins the network, it announces it's arrival through bootstrapping itself to a 'master-node' or tracker. When the peer announces its arrival, the master-node updates its list of peers (process ids), and returns the list of peers available in the network to the new peer.
Once in the network, the peer can now download a file from the network or upload a file to an incoming request for a file that s/he has. The files that the peer receives through the network automatically becomes available for upload.
To download a file, the peer calls a location algorithm that locates the peer with the file that the current peer is seeking to download.
As you can see, there is a gap in my understanding of the design. From my naive approach, I see #2 and #3 as different steps. However, I have a feeling that they must somehow be related. I guess my understanding lacks in knowing how a distributed hash table and algorithm like Chord or CAN works. I need help in rounding up these scattered ideas that will help me actually implement the simulation.
To begin, my first question is: where and how do I initiate the location algorithm? Or where is the distributed hash table created in the steps listed above?
You have a choice of either implementing a tracker server a la Napster. Or you can implement DHT-capable nodes - Bit torrent style.
In the former case, the tracker keeps track of all the nodes and the files they are hosting.
And in the latter, each node keeps track of the information (at least one peer in the network assumed in this case). A new peer will then contact one of the DHT - capable peer and get information about the node that is hosting the file that it requires.

How to get unique client identifer on server?

I am making an EventLog which will log the transaction log in my website. The details of the log will include the Public IP from where the transaction has orginated and also the local IP address (under the public IP).
I have found ways to obtain the Public IP Address, but i am unable to find out the local IP or machine IP from where the transaction is made.
A large number of entries will be done by people using the same connection. ie 5 or 10 computers connected to the same connection.
I need to find the machine IP (192.168.0.1 for 1 system 192.168.0.2 for the next) of the machines making the transactions and also the Computer name...
Is this possible
To clarify, you want the private IP address of a client when the client is connecting through a router? Then no, there isn't a way to do this.
Are you doing this purely to distinguish between different users?
Can you use another method like cookies?
If your client connects from behind a NAT or firewall you cannot reliably get his address or computer name. If you need such information then your protocol should request them as part of the request and the client machine should voluntarily provide them. There is no way to validate the information provided (short of deploying a trusted cryptographic infrastructure, ie. you establish a strong trust in the client machines themselves).
Sadly, the answer is no. No modern browser will present that private address in the HTTP transaction. The client's router which performs the NAT (Network Address Translation) offers only the public client IP address when making the IP connection.
Not likely. See a short discussion in http://javascript.about.com/library/blip.htm
Well yes we are doing this just to differentiate between the computers to know who is doing the entries...
Since you guys say that tracing the IP is not very reliable are there any other methods that i can use to do the same thing
I just need to know from which computer each entry is entered.
Any suggestions would be welcome
You are making the false assumption that there is a way to know from which computer each entry is entered. Nobody has the job of ensuring that this information exists. Often, it will not exist.
The only way to make sure each computer is uniquely identified is for you to identify it. You can do this through client certificates, for instance. In general, if you want each computer to have a unique identifier, then you need to create a unique identifier, then put it on that computer. You then need the computer to send that identifier back.
There is no other unique identifier for computers.
This is probably way beyond what you're looking for but it makes for an interesting read: Remote physical device fingerprinting
This allows you to uniquely identify a remote physical device without its cooperation, across NAT or whatever else you can imagine.

Resources