Image
 
Latest Additions
 
EH-Net Login
Welcome Guest.






Lost Password?
No account yet? Register
Who's Online
We have 18 guests and 1 member online
EH-Net Donations

Enter Amount:
$

Google Ads
EH-Net News Feeds
Latest Additions
Book Recommendations





 
Advertisement

You are here: Home arrow Forum arrow Resourcesarrow Tutorialsarrow Netsh – Managing IP configuration for the Windows command line
Ethical Hacker Community Forums
December 03, 2008, 12:23:20 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: ChicagoCon 2-Day Ethical Hacking Conference with MS Blue Hats Oct 31 - Nov 1. Tickets Only $100! www.chicagocon.com/content/view/103/51/
 
   Home   Help Calendar Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Netsh – Managing IP configuration for the Windows command line  (Read 3561 times)
0 Members and 1 Guest are viewing this topic.
What90
Newbie
*
Offline Offline

Posts: 42


View Profile
« on: July 26, 2007, 08:21:22 AM »


Useful trick of the day

Netsh seems to be one of those built in Windows tools that have slipped under the radar. Works from Windows 2000 and up.

I got in to a conversation one of our Linux’s team. She was complaining that it sucked having to use the Windows GUI to set her IP details on her laptop.

When I told her that wasn’t true, she looked a bit freaked.

Open up a command prompt windows and type in Netsh interface ip dump
You’ll get this type of output if you have a static ip address:

# ----------------------------------
# Interface IP Configuration
# ----------------------------------
pushd interface ip


# Interface IP Configuration for "Earth"

set address name="Earth" source=static addr = 192.168.1.50 mask=255.255.255.0
set address name="Earth" gateway=192.168.1.1 gwmetric=1
set dns name="Earth" source= static addr = 192.168.1.50 register=PRIMARY


popd
# End of interface IP configuration


Now use this command to dump it to a text file
Netsh interface ip dump > c:\office.txt
You can edit this file to you heart’s content for multiple static and dhcp settings.

So you’ve created a bunch of different files for the office (office.txt), home (home.txt), wireless (wireless.txt) etc

Using the command: netsh -c "interface ip" -f C:\Working\office.txt
It imports the details back in to windows without having to open a single window.

I think I shattered some of those her illusions that Windows is only a GUI. Cheesy

Okay, so that is fairly useful and a darn sight faster than  going through windows.

For those who want to do this to remote machines:
netsh -c "interface ip" –r remotecomputername dump > c:\office.txt for a copy of it’s entire ip configuration to a local file.

Drop that in to a script, after using something like angryip for a complete network scan of ip addresses. You got a very detailed, documented & well mapped picture without much effort.

Now that’s very useful!

Netsh can do a lot of things so a little more reading:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/netsh.mspx?mfr=true

Logged

CISSP, GCIA, GCIH, MCSE:Security & Messaging, CCNA
slimjim100
EH-Net Columnist
Sr. Member
*****
Offline Offline

Posts: 365



View Profile WWW
« Reply #1 on: July 26, 2007, 08:37:00 AM »

I also like little known windows command "pathping" it's like traceroute and ping with more features.

Brian
Logged

CISSP, CCSE, CCNA, CCAI, Network+, Security+, JNCIA, & MCP
Negrita
Sr. Member
****
Offline Offline

Posts: 289



View Profile
« Reply #2 on: July 26, 2007, 04:11:19 PM »

I've known about both netsh and pathping for a long time now. I used to use them when I worked at an ISP.

Pathping is particularly painful as you have to wait ages to see the results. When I was working in real-time, I'd much rather use a tool like Ping Plotter.
Logged

CEH, CCSA NG/AI, NNCSS, MCP, MCSA 2003

There are 10 kinds of people, those that understand binary, and those that don't.
jimbob
Sr. Member
****
Offline Offline

Posts: 316



View Profile WWW
« Reply #3 on: July 27, 2007, 03:10:42 AM »

I never knew about netsh, but I'm more of a *nix man myself. Thanks for the info, I've got to admit that was one of my Windows bugbears too.

Another is the absence of a remote command line a la SSH. Does anyone have any suggesions how I can get a remote command prompt on my Windows boxes. Please don't say nc -e cmd.exe  Wink

Jim
Logged
What90
Newbie
*
Offline Offline

Posts: 42


View Profile
« Reply #4 on: July 27, 2007, 04:58:54 AM »

Jim,

You'll have to wait to Windows 2008 core for a true remote command line. Or so I'm told and I believe everything for the MS marketing machine :-)

The closest I could get you natively is a telnet session by turning on the telnet server service. 
Mind you, the amount of times I saw netcat on some systems, I though it WAS part of the OS   Wink
Logged

CISSP, GCIA, GCIH, MCSE:Security & Messaging, CCNA
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!
Page created in 0.047 seconds with 22 queries.
 
Sponsors

cwnp_moto__120x90.gif

Polls
During the most recent election, I:
 
Support EH-Net


Support EH-Net by
Buying all of your
Amazon items using
the search bar above.

cbtnuggets_logo_125.jpg
Try CBT Nuggets Free!
Recent Forum Topics
Vote For EH-Net

progenic.com
Click here to Vote!

Sadikhov.com
Top IT Cert Sites

binarica.com
Binarica Logo

Add to Technorati Favorites
technorati fave

 
         
Advertisement

© 2008 The Ethical Hacker Network
Joomla! is Free Software released under the GNU/GPL License.