At military funerals, one often sees three volleys of shots fired in honor of the deceased veteran. This is often mistaken by the laymen as a 21-gun salute, although it is entirely different (in the military, a "gun" is a large-calibered weapon. The three volleys are fired from "rifles," not "guns." Therefore, the three volleys isn't any kind of "gun salute," at all).
Anyone who is entitled to a military funeral (generally anyone who dies on active duty, honorably discharged veterans, and military retirees) are entitled to the three rifle volleys, subject to availability of honor guard teams. As I said, this is not a 21-gun salute, nor any other type of "gun salute." They are simply three rifle volleys fired. The firing team can consist of any number, but one usually sees a team of eight, with a noncommissioned officer in charge of the firing detail. Whether the team consists of three or eight, or ten, each member fires three times (three volleys).
The three volleys comes from an old battlefield custom. The two warring sides would cease hostilities to clear their dead from the battlefield, and the firing of three volleys meant that the dead had been properly cared for and the side was ready to resume the battle.
The flag detail often slips three shell-casings into the folded flag before presenting the flag to the family. Each casing represents one volley.
For complete details, see our article about The 21 Gun Salute.