Improve HOME_NET and EXTERNAL_NET variable generation.