Need help: My IPv6 test network tries to connect to 127.0.0.1?

As I have an issue with IPv6 inside a podman container, I’m asked to create a test network outside of containers and see what the result is of that.
But for some reason I encounter a different issue, which is that all my nodes seem to be looking at 127.0.0.1.

Anyone got any idea why that could be?

node_dir_1/sn_node.log to node_dir15/sn_node.log

 INFO 2022-03-17T07:08:37.003712Z [sn/src/node/api/mod.rs:L209]:
	 ➤ d9367e.. Bootstrapping a new node.
 ERROR 2022-03-17T07:09:13.399735Z [/cargo/registry/src/github.com-1ecc6299db9ec823/qp2p-0.28.5/src/endpoint.rs:L278]:
	 ➤ bootstrap {bootstrap_nodes=[127.0.0.1:12000]}
	 ➤ Failed to bootstrap to the network, last error: timed out

node_dir_0/sn_node.log

 INFO 2022-03-17T22:05:38.063977Z [sn/src/node/api/mod.rs:L144]:
	 ➤ a15b0f.. Starting a new network as the genesis node (PID: 7217).
 INFO 2022-03-17T22:05:38.136114Z [sn/src/node/core/mod.rs:L146]:
	 ➤ Creating Liveness checks
 INFO 2022-03-17T22:05:38.136232Z [sn/src/node/core/mod.rs:L155]:
	 ➤ Liveness check: Liveness { unfulfilled_requests: {}, 
       closest_nodes_to: {} }
 INFO 2022-03-17T22:05:38.136387Z [sn/src/node/api/mod.rs:L187]:
	 ➤ a15b0f.. Genesis node started!. Genesis key PublicKey(00b4..13a5), 
       hex: 80b4...07e3
 INFO 2022-03-17T22:05:38.136485Z [sn/src/node/api/dispatcher.rs:L113]:
	 ➤ Starting to probe network
 INFO 2022-03-17T22:05:38.136543Z [sn/src/node/api/dispatcher.rs:L143]:
	 ➤ Starting cleaning up network links
 INFO 2022-03-17T22:05:38.136561Z [sn/src/node/api/dispatcher.rs:L164]:
	 ➤ Writing our PrefixMap to disk
 INFO 2022-03-17T22:05:38.136566Z [sn/src/node/core/mod.rs:L211]:
	 ➤ Writing our latest PrefixMap to disk
 INFO 2022-03-17T22:05:38.140426Z [sn/src/node/api/mod.rs:L112]:
	 ➤ Node PID: 7217, prefix: Prefix(), name: a15b0f(10100001).., 
       age: 255, connection info: "[x:x:x:x:x:x:x:x]:12000"

sn_network.sh

#!/bin/bash

NODE_PATH=~/.safe/node
HOST_IP=[$(ip -6 -o addr show up primary scope global | while read -r num dev fam addr rest; do echo ${addr%/*}; done | head -n 1)]
PORT_BASE=12000
PORT=$PORT_BASE
VERBOSE=-vv
NUM_NODES=15

sn_node $VERBOSE \
  --idle-timeout-msec 5500 \
  --keep-alive-interval-msec 4000 \
  --skip-auto-port-forwarding \
  --local-addr $HOST_IP:$PORT \
  --public-addr $HOST_IP:$PORT \
  --log-dir $NODE_PATH/node_dir_0 \
  --root-dir $NODE_PATH/node_dir_0 \
  --first &

sleep 10

safe networks add sjefolaht
safe networks switch sjefolaht

for (( i = 1; i <= NUM_NODES; i++ ))
do
  PORT=$(($PORT_BASE + $i))
  sudo sn_node $VERBOSE \
    --idle-timeout-msec 5500 \
    --keep-alive-interval-msec 4000 \
    --skip-auto-port-forwarding \
    --local-addr $HOST_IP:$PORT \
    --public-addr $HOST_IP:$PORT \
    --log-dir $NODE_PATH/node_dir_$i \
    --root-dir $NODE_PATH/node_dir_$i &
  sleep 5
done

/home/folaht/.safe/cli/networks/sjefolaht_node_connection_info.config & /home/folaht/.safe/node/node_connection_info.config

["xxxxxx...xxxxxxx",["[x:x:x:x:x:x:x:x]:12000"]]
3 Likes

Not sure if that can explain the problem you came across but I see a potential problem: I suspect that safe networks commands need that source node_connection_info.config exists and it’s possible that genesis node hasn’t created it yet.

Try adding sleep 10 after launching genesis node to give it some time to create this file.

1 Like

I see there is no set $HOST_PORT_BASE?

2 Likes

Good catch.

This means that ports used by non genesis nodes are 1, 2, 3, … This is probably not what was intended but I am not sure this is the source of problem.

If a port number is already in use by another program, there should be a more explicit error (something like port already in use).

2 Likes

sure, just an error I spotted

2 Likes

Great observations guys!

Unfortunetaly, neither of those solved my issue.

1 Like

Does sn_node look at the .safe/cli/networks directory at all? I am not so sure sn_node has any knowledge of the CLI. Maybe by setting the logging to debug you can see what configuration is actually loaded. From what I quickly can gather, if --hard-coded-contacts is not provided, it will search for .safe/node/node_connection_info.config?

Else, it might be a better solution to pass --hard-coded-contacts to sn_node in scripts…

2 Likes

Yes indeed, but we need to know beforehand just what is the contents of --hard-coded-contacts. That will require another discovery step at least. Hints welcome :slight_smile:

The run-baby-fleming option does this but it is entirely local so we know the hard-coded-contacts before we start. For long-running networks also this will not be a problem. But for wee ad-hoc testnets as we have now its not always trivial. To me anyway. Educate me folks :slight_smile:

1 Like

That config is the same as cli/networks one.

[update]

I found out what I was doing wrong.
I got confused over which user needed to run the script as in the test network it’s run as user/root as the safe nodes are run in the container as root and so I replicated that as user/root in the other shell scrip, but it needs to be run as just root.

This topic was automatically closed after 60 days. New replies are no longer allowed.