U-nails
U-nails (ours are 2 inches long) are versatile nails shaped like croquet wickets and pointed at both ends. They can be used conveniently to fasten just about anything (fencing, wire, pencil-holders, whatever) to trees and wooden posts. In the deer fence business we use them to attach fencing and top support lines to both trees (when trees are being used as posts) and to wooden posts, using about 5 per tree or post, and about 10 when the fencing is going around a corner.
If you are attaching U-nails to trees, be sure to leave some space between the top of the U-nail and the tree so that the tree has room to grow slowly up the U-nail without damaging the fencing.