To determine whether it's the toilet supply line or the drain line, simply turn off the water to the toilet and flush it to see if the banging noise happens.
Then you'll know what to look for to solve it. My guess is the supply line and you need to replace the toilet water inlet valve in the tank, as well as secure the supply line in the basement better. If so, I would go with a Fluidmaster 400A float-cup type tank valve. They're inexpensive (less than $10 bucks) and are easy to install. Just follow the illustrated installation directions that come with it.