Refactor 'restore ip addresses'.