President Obama is considering asking Senator John F. Kerry, Democrat of Massachusetts, to serve as his next defense secretary, part of an extensive rearrangement of his national security team that will include a permanent replacement for former CIA director David Petraeus.