On some firearms the gun barrel is fastened to the receiver with a nut, referred to as a barrel nut.
A barrel nut (also known as steel cross dowel or dowel nut) is a specialized nut, and is commonly used in aerospace and ready-to-assemble furniture applications.
It is used to bolt thin sheet metal parts to larger, often billet or forged, parts. The barrel nut is a round slug, or formed sheet metal part with threads perpendicular to the length of the nut. The nut sits in a hole inside the forging and a standard bolt is threaded into the barrel nut from outside the sheet metal. They are preferred over a standard nut and bolt, because they do not require a flange to be machined or forged onto the receiving part, thus reducing weight.
Barrel nuts are also common in flat-pack furniture, where long bolts and barrel nuts are used to hold together T joints in chipboard sheets.