How to change my TCP/IP settings using Ruby

Is there a way to change my TCP/IP settings using Ruby scripts. For
example I want a quick way to setup from DHCP to fixed IPs. My Windows
is 2000.
Kind Regards
Roberto Nogueira

Roberto Nogueira

Windows 2000 comes with the netsh command line tool, which will allow
you to
do this easily:

Set a static IP:
netsh interface ip set address name=“Local Area Connection”
source=static
addr=192.168.0.10 mask=255.255.255.0 gateway=192.168.0.1 gwmetric=1

Set an interface for DHCP:
netsh interface ip set address name=“Local Area Connection” source=dhcp

While this link is for XP, the syntax for 2000 should be the same:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-
us/netsh.mspx?mfr=true

If you need to do this from a Ruby script, you can shell out for the
above.
I’m not aware of any libraries for this.

HTH,

Felix

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs