In the vast majority of cases, pipes that sound like they are knocking together are shaking due to variances in water pressure inside the pipe. Air gets caught in the pipes, causing them to shake. To fix this, all you need to do is to turn off the main water pipe in your home completely. Then go to every faucet and hose in the house and open it fully, allowing all of the water standing in the pipes to drain out. After all the water has drained out, close the faucets and hoses and slowly turn the main water valve back on. This fills the supply pipes and in many cases, it gets rid of the knocking entirely.
If you notice that the pipes are knocking against the masonry, you may want to simply hold the pipe steady. Wedge a chunk of wood between the pipe and the masonry. Ideally, the chunk of wood will be sturdy enough and wide enough that there is no space between the wood and the pipe and the wood and the masonry. Then, you can use a U-strap to hold the pipe to the wood, further reducing any clatter.
In some cases, you can simply wrap the pipe with a slit length of hose, encasing it in the rubber to ensure that it wills stop knocking the pipes around it. In some cases, some people simply choose to muffle the sound of the knocking pipes using some cotton batting secured with duct tape. Choose a method that suits your needs and which will allow you to get the peace that you need from the noise!
As you can see, there are many different ways to stop knocking pipes from becoming a problem. Take a moment to think about what you can do to keep your home quiet. When in doubt, consult with a plumber. A plumber can figure out what is going on with your water system, and he or she can often quickly identify the problem and fix it. Don’t be afraid to turn the issue over to a pro!