hi all,
i’m in the early stages of developing a cross-platform utility to
allow end users of an in-house application to diagnose ‘application’
issues. one aspect i’m trying to account for is network problems and
this is where i’m running into some issues…
i know how to find ip address information and display routing tables
on windows and various flavors of unix. i can display the ip address
easily enough using pure ruby but i’m really struggling finding a
super clean way to determine the default route based upon current ip
address. basically i’m thinking of:
- getting host’s ip address
- getting subnet mask
- creating array of all default routes
- iterating thru array of default routes to find default route for
current ip and returning that value
i would love to hear if i’m taking the way-wrong road to get to where
i want to go. any help is greatly appreciated.
thanks!
brian