From: piir@... (Todd Gardner) Date: 2004-06-30T06:42:54+09:00 Subject: Re: get same info as ipconfig? djberg96@hotmail.com (Daniel Berger) wrote in message news:<6e613a32.0406281247.52deb55e@posting.google.com>... > piir@earthlink.net (Todd Gardner) wrote in message news:<9b849915.0406280231.d91f103@posting.google.com>... > > Hello Everyone, > > > > Is there a cross platform command to get the same info that ipconfig > > [w2k] or ifconfig[POSIX] returns directly in Ruby? > > > > Thanks, > > > > Todd > > I see Sam mentioned sys-host (one of my packages), but it's not very > useful at the moment. However, I plan to rewrite the Windows portion > to use OLE + WMI. You can get the info you need on Windows like this: > > require "win32ole" > > ole = WIN32OLE.connect("winmgmts://") > > # Avoid non-working adapters by setting 'IPEnabled' to true > query = "select * from Win32_NetworkAdapterConfiguration where > IPEnabled = True" > > ole.ExecQuery(query).each{ |nic| > p nic.IpAddress > p nic.IpSubnet > p nic.DefaultIPGateway > } > > Regards, > > Dan Hell Dan, When I run the above code on w2k I get this. ============================= ["192.168.1.115"] ["255.255.255.0"] ["192.168.1.1"] And then a modal dialog pops up and takes focus. [dialog] Run time error! Program: C:\ruby\bin\\rubyw.exe This application requested the run time to terminate in an unusual way. Please contact the application support team for more information." ============================ Might you have any idea how I can determine what my WAN IP address is? It is not in ipconfig. My Linksys router does show it to me at... http://192.168.1.1/Status.htm LAN: (MAC Address: 00-04-5A-EF-5C-9F) IP Address: 192.168.1.1 Subnet Mask: 255.255.255.0 DHCP server: Enabled WAN: (MAC Address: 00-04-5A-EF-5C-A0) IP Address: 68.164.157.203 DNS: 207.69.188.186 207.69.188.185 0.0.0. I have DSl and the IP address earthlink DSL gives me changes quite frequently. Every few days. Thanks, Todd