Bitcoin is not connected in regtest mode I am having trouble using regtest mode on Linux.  Using pre-compiled version 0.9.2.1 for linux and starting regtest mode as instructed on bitcoin.org:

&lt;bitcoin-ver&gt;-linux/bin/64&gt;&gt; ./bitcoind -regtest -daemon


The server starts but doing a getinfo returns 'connections' : 0.  Tried experimenting with various rpc* settings in the .conf file.  What exactly do I need to set in order to use regtest mode?  Do I need to add real nodes via addnode for regtest?  It doesn't seem like I should need to.  I was able to get a few connections by adding several real nodes one time but after a few minutes 'connections' dropped back to 0.  Let me know if any additional info would help.
Although I believe Fred Tingey's answer is complete, it has the following attributes:


it depends on a config file.
it provides examples for bitcoin-qt on the windows platform, and the OP was asking about bitcoind on the linux platform.


Thus, I wanted to share the following concise bash script which does what the OP wants. As others have partially noted the key to getting this to work is:


specify a unique port (if listening) and rpcport (if using rpc) for each node
specify a unique data directory for each node
if using -connect to restrict to own nodes, remember to use -listen to accept connections from own nodes.


That said, here's my start-regtest-network.sh script:

#!/bin/bash
bitcoind -server -listen -port=17591 -rpcuser=bitcoinrpc -rpcpassword=P$SECONDS -rpcport=16591 -datadir=$HOME/regtest/A/ -connect=localhost:17592 -regtest -pid=$HOME/regtest/A/.pid -daemon -debug
bitcoind -server -listen -port=17592 -rpcuser=bitcoinrpc -rpcpassword=P$SECONDS -rpcport=16592 -datadir=$HOME/regtest/B/ -connect=localhost:17593 -regtest -pid=$HOME/regtest/B/.pid -daemon -debug
bitcoind -server -listen -port=17593 -rpcuser=bitcoinrpc -rpcpassword=P$SECONDS -rpcport=16593 -datadir=$HOME/regtest/C/ -connect=localhost:17594 -regtest -pid=$HOME/regtest/C/.pid -daemon -debug
bitcoind -server -listen -port=17594 -rpcuser=bitcoinrpc -rpcpassword=P$SECONDS -rpcport=16594 -datadir=$HOME/regtest/D/ -connect=localhost:17595 -regtest -pid=$HOME/regtest/D/.pid -daemon -debug
bitcoind -server -listen -port=17595 -rpcuser=bitcoinrpc -rpcpassword=P$SECONDS -rpcport=16595 -datadir=$HOME/regtest/E/ -connect=localhost:17591 -regtest -pid=$HOME/regtest/E/.pid -daemon -debug


Additionally, here's my stop-regtest-network.sh:

#!/bin/bash
sudo killall --regex bitcoin.*


I realize my stop script is sloppy, and will kill all bitcoin processes.. if you're so inclined you could modify this to pull the individual pids out of each data directory.

Lastly, You will probably need to precreate some data directors for bitcoind if you don't edit the script at all.

mkdir $HOME/regtest/A/
mkdir $HOME/regtest/B/
mkdir $HOME/regtest/C/
mkdir $HOME/regtest/D/
mkdir $HOME/regtest/E/


You should have regtest bitcoind nodes connecting round-robin on ports 17591, 17592, 17593, 17594 and 17595. Likewise, you should be able to connect to rpc ports 16591, 16592, 16593, 16594 and 16595. If you need to know the RPC password you can check ps aux, or set an explicit rpcpassword in the script.

HTH