Its a little confusing and I often have to remind myself how it works when I need it, I believe that collision layers are the layers that the object is on. In contrast, collision masks are the layers that the object will react to, but it does not necessarily have to be a part of.
For example, if Node_A is on layers 1 and 2, and is on masks 3 and 4, then it will react to any collision shapes on 3 and 4. Node_B, if it has a mask of 1 and/or 2, then it will be able to react to Node_A. If Node_B's layer is 5, it will not be noticed by Node_A, since it's mask doesn't include mask 5.
Hopefully that helps a bit. I always find the layer/mask system confusing and have to tinker around to remind myself how it works.
Edit: To answer your question of how to have both nodes detect each other, they need to share a layer and mask. For example, if both nodes have layer 3 and mask 3, then they will be able to detect each other.