Oliver Kirchkamp

Checking connectivity between a z-Tree client and a z-Tree Server

If you can't connect from your z-Tree client and your z-Tree Server (and if you think that you should be able to connect), please follow these steps:
  1. Determine the ip-Address of the server. It should be one of the (comma separated) addresses in server.eec in the directory where you started the z-Tree server. The content of server.eec might, e.g., look like this:
    192.168.2.3,10.4.5.6,127.7.8.9
    
    This means that z-Tree thinks the machine has three network interfaces:
    • 192.168.2.3 is an address in a local network.
    • 10.4.5.6 is another address in another local network.
    • 127.7.8.9 is the address the machine uses when it is talking to itself.
    Also figure out the address of your client. Assume that your client has (among others) the address 192.168.2.199, then both machines should be connected through the 192.168.2.* network. Use the 192.168.2.3 address to connect to the server. If your client has, e.g., the address 10.4.8.9, then, hopefully, both machines are connected through the 10.4.* network, so use the 10.4.5.6 address to connect to the server. Use 127.7.8.9 only when the client is on the same machine as the server.

    In the following, I assume that we are on an IPv4 network and that the server's address is x.x.x.x

  2. Of course, you did start z-Leaf on the client as
    zLeaf.exe /server x.x.x.x
    didn't you? If this fails (i.e. z-Leaf tells you something like “Failed to connect to z-Tree. Try again?”), let us check why the connect between z-Leaf and z-Tree might have failed:
  3. ping: Open a terminal on the client and issue the command
    ping x.x.x.x
    As an answer, you should get something like
    PING x.x.x.x: 56 data bytes
    64 bytes from x.x.x.x: icmp_seq=0 ttl=64 time=0.036 ms
    ...
    
    If you only get the first line then, most likely, clients in your network are not allowed to talk to each other at all. Return to your terminal with Control-C and talk to your network administrator.

    If you succeed with ping, then there is at least some connection from client to server.

  4. nmap: Next try whether the connection allows communication on port 7000 (here I assume that z-Tree is listening on port 7000 which is the default. If in doubt, use netstat (see below) on the server to find out whether it is, really, port 7000). If nmap is installed on your client you should probe whether port 7000 on x.x.x.x is listening. On the client issue the following:
       nmap -p 7000 x.x.x.x
    
    You should get something like:
        PORT     STATE SERVICE
        7000/tcp open  afs3-fileserver
    
    If, instead, you get Host seems down. or 7000/tcp closed, then somebody is blocking at least communication on port 7000 (or you made a mistake with your your ip-address, so check again whether x.x.x.x is really the correct address. If yes, then talk to your network administrator).
  5. telnet: If nmap is not installed and if you can't install it (you should, it is a useful tool to diagnose networks) then you can still use telnet:
    telnet 10.x.x.x 7000
    
    You should get something like
    Trying x.x.x.x...
    Connected to x.x.x.x
    Escape character is '^]'.
    
    The Connected to means that, indeed, you are now connected to z-Tree. In principle you could now pretend to be a zLeaf (don't, it would require a lot of typing, zLeaf is better at this...).

    To return to your terminal enter telnet's command mode with a Control-] and they say QUIT. This brings you back to your terminal.

    If, instead, you get

    Trying x.x.x.x...
    telnet: connect to address x.x.x.x: Connection refused
    telnet: Unable to connect to remote host
    
    then somebody is blocking port 7000.
  6. There are more things which could fail. After all, z-Tree wants to talk back to its z-Leaves, hence the clients have to open a port, too.

    To find out which ports are opened by z-Leaf compare the output of netstat before and after your have started z-Leaf. On a terminal of your client, before starting z-Leaf, say the following:

    netstat -an4 | grep LISTEN
    
    You will get a list of open ports, similar to the following:
    ...
    tcp4       0      0 *.8000                 *.*                    LISTEN
    ...
    
    Once z-Leaf has started, it might say something like “Failed to connect to z-Tree. Try again?”. While you see this message, issue the same command again:
    netstat -an4 | grep LISTEN
    
    Now the output should have changed:
    ...
    tcp4       0      0 *.7999                 *.*                    LISTEN
    tcp4       0      0 *.8000                 *.*                    LISTEN
    ...
    
    A new open port, in this example 7999, has appeared. This should be the port which was opened by z-Leaf. (z-Leaf seems to try to get 7999 first, if this port is not free, it tries a smaller one, so 7998 next, then 7997, etc.). To test whether the server can talk back to the client, issue (on a terminal of the server):
    nmap -p 7999 y.y.y.y
    
    where y.y.y.y is the address of your client.