GREENSBORO, N.C. — President Obama is weighing a “proportional” response to Russia’s efforts to interfere with this fall’s election campaign through hacking, the White House announced Tuesday.

“The president has talked before about the significant capabilities that the U.S. government has to both defend our systems in the United States but also carry out offensive operations in other countries,” Josh Earnest, the White House press secretary, told reporters traveling with Mr. Obama on Air Force One to Greensboro, where he was holding a town hall-style meeting with students and campaigning for Hillary Clinton.

“There are a range of responses that are available to the president, and he will consider a response that is proportional,” Mr. Earnest said.

Whatever the president opts to do would probably not be announced in advance and may never be acknowledged or disclosed if it is carried out, Mr. Earnest said.