JOHANNESBURG, FEB. 20 -- South African aircraft today bombed and strafed southern Angola guerrilla bases of the South West Africa People's Organization (SWAPO) in what Pretoria said was retaliation for yesterday's bombing of a crowded bank in northern Namibia.

As the death toll in the bank bombing rose to 18 with the discovery of four more bodies under rubble, the South African military command in Pretoria warned that it would not hesitate to strike again outside the country against terrorist groups.

The warning came after two senior Cabinet officials, Foreign Minister Roelof F. (Pik) Botha and Defense Minister Magnus Malan, put neighboring Zimbabwe on notice that if it allows guerrillas to enter South Africa, the Army will not hesitate to cross the Limpopo River in pursuit, even if it means engaging Zimbabwean troops.

In a separate statement, Malan today warned that South Africa would "cut out the cancer of terrorism at its roots -- namely training camps and bases."

Malan added, "With this action, South Africa reaffirms its determination that no terrorism, violence or revolution should be exported to South Africa's area of responsibility."

South Africa administers Namibia, the former German colony of South West Africa, in defiance of United Nations resolutions, which name SWAPO as the legitimate representative of the Namibian people.

The South African Army command said eight Mirage fighters flew into Angola this morning and attacked SWAPO's main guerrilla training base near the provincial capital of Lubango, about 180 miles north of the Namibian border. It said the aircraft also attacked a SWAPO staging area six miles west of Lubango.

Simultaneously, five Air Force Impala helicopter gunships attacked SWAPO targets in Ongiva, 18 miles north of the border, which has served as a launching base for guerrilla attacks inside Namibia, the military command said.

{Angolan officials said several civilians were killed in the raids, The Associated Press reported.}

The chief of the South African Defense Force, Lt. Gen. Jannie Geldenhuys, said that guerrillas at the Lubango base receive training in explosives, adding, "This training center can be regarded as the breeding ground for terrorism against the inhabitants of South West Africa-Namibia."

"By these attacks," he said, "the security forces demonstrated their willingness never to allow SWAPO terrorism to go unpunished. Terrorists will be tracked down and destroyed."

The headquarters of SWAPO's legalized political wing in the Namibian capital of Windhoek denied yesterday that the group was involved in the bombing of the bank in Oshakati, and charged that it was part of "South Africa's dirty propaganda campaign."

The death toll from the bombing, if carried out by SWAPO, would be the highest of any attack in SWAPO's 21-year battle for independence for Namibia.

The security forces, Geldenhuys added, "will also not hesitate to act in the country's security interests against any terrorist organizations outside the country where they skulk under the security umbrellas of other armed forces, just as SWAPO hides under {the Angolan Army's} umbrella."

Geldenhuys' comment appeared to be a reference to the African National Congress, the antiapartheid guerrilla force. The ANC maintains its main training bases in Angola, but infiltrates most of its guerrillas into South Africa through the borders with Botswana and Zimbabwe.

Botha, appearing with Malan yesterday at a farmhouse that was attacked on Feb. 13 near Messina, on the Zimbabwe border, warned that if Zimbabwean residents across the frontier failed to report the movements of ANC infiltrators, "they will pay the price."

The militant rhetoric by senior Cabinet ministers in recent days appeared to set back efforts to organize a regional conference between South Africa and its neighboring black-ruled states to discuss security and economic cooperation.

Botha was quoted as telling South African military correspondents in Messina, "As far as I am concerned, there is no more talk of a regional conference -- not from our side. It is up to them to take the initiative. We're no longer interested in our neighboring states. We're going to go on with our own business and stabilize our situation, and we'll succeed."

The bellicose statements also come as the ruling National Party faces three important parliamentary by-elections next month against the increasingly powerful Conservative Party, which has accused the government of being soft on security.