The attackers rode vehicles mounted with machine guns, a military official said. The highway between the towns of Tarhouna and Bani Walid, on which the post was located, was closed immediately after the attack in an attempt to track down the attackers.
The official said the attack took place at Wishtata area, some 60 kilometres (40 miles) from the entrance to Bani Walid.
The town was one of the last strongholds for supporters of dictator Moammar Gadhafi in the country's 2011 civil war, and was besieged again by pro-government militias last year.
Both officials spoke on condition of anonymity in line with institutional regulations.
Also Read
Libya has been hit by a months-long wave of attacks targeting military officers, activists, judges and security agents.
Gadhafi was deposed and killed after an eight-month uprising that descended into a civil war in 2011. Since then, successive Libyan interim governments have failed to impose law and order.
The country remains held hostage by unruly militia forces initially formed to fight Gadhafi. The militias, which have huge stockpiles of sophisticated weaponry, now threaten Libya's nascent democracy.