# Zcashd with --connect to a single IP adds a second connection

**URL:** <https://forum.zcashcommunity.com/t/zcashd-with-connect-to-a-single-ip-adds-a-second-connection/28942>\
**Category:** Technical Support\
**Created:** [May 12, 2018, 5:15pm UTC](https://forum.zcashcommunity.com/t/zcashd-with-connect-to-a-single-ip-adds-a-second-connection/28942 "2018-05-12T17:15:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![TO99](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@TO99](https://forum.zcashcommunity.com/u/TO99)\
**Post date:** [May 12, 2018, 5:15pm UTC](https://forum.zcashcommunity.com/t/zcashd-with-connect-to-a-single-ip-adds-a-second-connection/28942/1 "2018-05-12T17:15:49Z")

</div>

I have a full node that has been running for quite a while and everything is running fine. On a second machine on my private network, I start up a second full node and I use the connect option to specify that I am only connecting to my public node (using the internal address), like so:

zcashd -conf=zcash.conf -connect=192.168.17.105

Everything looks normal and the node has only one connection and it gets all the latest blocks. However after some period of time has past, I notice that it has two connections. An outgoing connection to an external address has been added. I did not issue any commands between startup and noticing that there were two connections.

Am I misunderstanding the -connect option with a single IP? I was expecting that the daemon would not initiate any connections besides to that one IP.

When I do “zcash-cli getpeerinfo” I see:

[  
{  
“id”: 1,  
“addr”: “192.168.17.105”,  
“services”: “0000000000000005”,  
“lastsend”: 1526144103,  
“lastrecv”: 1526144103,  
“bytessent”: 6592,  
“bytesrecv”: 690177,  
“conntime”: 1526143684,  
“timeoffset”: 50,  
“pingtime”: 0.000849,  
“version”: 170005,  
“subver”: “/MagicBean:1.1.0/”,  
“inbound”: false,  
“startingheight”: 322072,  
“banscore”: 0,  
“synced\_headers”: 322075,  
“synced\_blocks”: 322075,  
“inflight”: [  
],  
“whitelisted”: false  
},  
{  
“id”: 4,  
“addr”: “104.236.180.231:8233”,  
“addrlocal”: “xx.xxx.xx.xxx:xxxxx”,  
“services”: “0000000000000001”,  
“lastsend”: 1526144103,  
“lastrecv”: 1526144053,  
“bytessent”: 5561,  
“bytesrecv”: 80892,  
“conntime”: 1526143925,  
“timeoffset”: 50,  
“pingtime”: 0.026707,  
“version”: 170003,  
“subver”: “/MagicBean:1.0.15/”,  
“inbound”: false,  
“startingheight”: 322073,  
“banscore”: 0,  
“synced\_headers”: 322075,  
“synced\_blocks”: 322075,  
“inflight”: [  
],  
“whitelisted”: false  
}  
]

I am running zcashd version v1.1.0 on Ubuntu 16.04.

---

<div class="post-metadata">

**Author:** ![garethtdavies](https://sea2.discourse-cdn.com/zcash/user_avatar/forum.zcashcommunity.com/garethtdavies/32/210_2.png) [@garethtdavies](https://forum.zcashcommunity.com/u/garethtdavies)\
**Post date:** [May 12, 2018, 9:46pm UTC](https://forum.zcashcommunity.com/t/zcashd-with-connect-to-a-single-ip-adds-a-second-connection/28942/2 "2018-05-12T21:46:13Z")

</div>

Do you have `addnode` set in your config file?

---

<div class="post-metadata">

**Author:** ![TO99](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@TO99](https://forum.zcashcommunity.com/u/TO99)\
**Post date:** [May 12, 2018, 9:51pm UTC](https://forum.zcashcommunity.com/t/zcashd-with-connect-to-a-single-ip-adds-a-second-connection/28942/3 "2018-05-12T21:51:55Z")

</div>

I do, to mainnet. But if it goes by what’s in the config file, then what’s the purpose of the -connect option?

---

<div class="post-metadata">

**Author:** ![garethtdavies](https://sea2.discourse-cdn.com/zcash/user_avatar/forum.zcashcommunity.com/garethtdavies/32/210_2.png) [@garethtdavies](https://forum.zcashcommunity.com/u/garethtdavies)\
**Post date:** [May 12, 2018, 9:56pm UTC](https://forum.zcashcommunity.com/t/zcashd-with-connect-to-a-single-ip-adds-a-second-connection/28942/4 "2018-05-12T21:56:09Z")

</div>

I don’t know but I am guessing it uses both so just set the `connect` option and not `addnode` and see if that works?

---

<div class="post-metadata">

**Author:** ![jasondavies](https://sea2.discourse-cdn.com/zcash/user_avatar/forum.zcashcommunity.com/jasondavies/32/5620_2.png) [@jasondavies](https://forum.zcashcommunity.com/u/jasondavies)\
**Post date:** [May 12, 2018, 10:13pm UTC](https://forum.zcashcommunity.com/t/zcashd-with-connect-to-a-single-ip-adds-a-second-connection/28942/5 "2018-05-12T22:13:12Z")

</div>

> [@TO99](#):
>
> 104.236.180.231:8233

This IP address resolves to `mainnet.z.cash`.

As @garethtdavies points out, you probably have `addnode=mainnet.z.cash` in your `zcash.conf`.

I think the help information for `-connect` is misleading by saying it will “connect _only_ to the specified node(s)”. Looking at the source code (the best way to figure these things out!) – it is clear that it will also open connections to “added nodes”, i.e. those nodes specified using `addnode` either in the configuration file, command line, or RPC. It will not open additional _unspecified_ connections automatically if `-connect` is used.

---

<div class="post-metadata">

**Author:** ![TO99](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@TO99](https://forum.zcashcommunity.com/u/TO99)\
**Post date:** [May 12, 2018, 10:24pm UTC](https://forum.zcashcommunity.com/t/zcashd-with-connect-to-a-single-ip-adds-a-second-connection/28942/6 "2018-05-12T22:24:10Z")

</div>

Thanks for the clarification and thanks for taking time to look at the source!

---

<div class="post-metadata">

**Author:** ![bitcartel](https://sea2.discourse-cdn.com/zcash/user_avatar/forum.zcashcommunity.com/bitcartel/32/8558_2.png) [@bitcartel](https://forum.zcashcommunity.com/u/bitcartel)\
**Post date:** [May 14, 2018, 5:05am UTC](https://forum.zcashcommunity.com/t/zcashd-with-connect-to-a-single-ip-adds-a-second-connection/28942/7 "2018-05-14T05:05:32Z")

</div>

Also by default zcashd will contact the dns seeders to try and find peers. To disable this behaviour, launch as `zcashd -dnsseed=0` or place this option in your config file.
