Factor out addition of localhost IPs to ancestor class

Change-Id: Ie6ddabcfedfb79a33286299396aa88be95235681