Added dynamic gateway IP discovery