*UPDATED* ifconfig for windows 2.1

ifconfig is a tool inspired by the unix ifconfig command. it let’s you change the ip address, dns server and gateway from the command line. ifconfig2.11.zip (27,79 KB)

i recently added some new features to (and did a redesign using a far more elegant approach to the WMI managed API)

New Features

  • You can set multiple ip addresses, dns servers and gateways
  • A new trace option shows all the WMI return codes for diagnostics
  • You can now dump you current config to a file
  • IP address and netmask can now be set independently

Examples

get available network interfaces

ifconfig /s

get interface info (short)

ifconfig /eth n

get interface info (long)

ifconfig /eth n /s

set IP Address and Subnet Mask

ifconfig /eth n /ip 192.168.0.100 /mask 255.255.255.0

set multiple ip addresses

ifconfig /eth n /ip 192.168.0.100,192.168.0.101 /mask 255.255.255.0,255.255.255.0

set dns server

ifconfig /eth n /dns 192.168.0.5

set multiple dns servers

ifconfig /eth n /dns 192.168.0.5,192.168.0.6

set gateways (the first gateway gets a metric of 1, the second 2….)

ifconfig /eth n /gw 192.168.0.1,192.168.0.2

set dhcp (dns and ip address)

ifconfig /eth n /dhcp

set dhcp (dns or ip)

ifconfig /eth n /dhcpip or dhcpdns

dump the current tcp/ip configuration to a text file. you’ll get the current config in ifconfig syntax. so just dump to a .cmd file – ready for reuse

ifconfig /eth n /dump home.cmd

the /t switch gives you more info about WMI return codes and the /doc switch brings you to this page.

TIP : sometimes ifconfig is a little slow on the first use after reboot. this disturbs my “hey, i got a cool command line utility to change the ip address” moments :) I just ngen it now to create a native image. is a little bit faster. maybe you want that, too. just type:

ngen ifconfig.exe

feedback is welcome.

 

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a comment