rss
Search : in
By : Relevance Date Username
Statut : Not resolved

How to change IP address from command prompt

nareen123, on Tuesday July 8, 2008 10:44:01 AM
Hello,


Is there any way to change IP address of computer from Command prompt?

I use WinXP as OS and I would like to know if I can change IP from Command prompt


Please help me out.
Configuration: Windows XP
Internet Explorer 6.0
Reply to nareen123  Report this message to moderators Go to last message

1


  • 1
    This message seems useful, vote!
  • Ce message ne vous semble pas utile, votez !
  • Report this message to moderators
yashmaur, on Tuesday July 8, 2008 10:44:49 AM
Hello,

There's no way to effectively change it from a command prompt. You could use the ipconfig release and renew commands, but chances are you're just going to get your old IP address back, especially if you are behind a router or static IP.


Hope this will help you.
Reply to yashmaur

2


  • This message seems useful, vote!
  • Report this message to moderators
2xod.com, on Sunday July 20, 2008 10:51:02 PM
Of course you can change the IP from the command prompt.

The command is:
to change IP and default gateway:
netsh int ip set address "local area connection" static 192.168.0.101 255.255.255.0 192.168.0.254 1

to change DNS:
netsh int ip set dns "local area connection" static 192.168.0.254 primary

This is assuming 3 things.
1) The network adapter you're trying to change the IP for is "local area connection". It could also be "local area connection 2" or "wireless network connection". Look in your control panel for the correct name
2) The IP you want to set is 192.168.0.101, change this to whatever IP to want to use.
3) The default gateway and dns are the same IP. If you are using some kind of router they usually are. Change this to match your network config found with the command ipconfig /all

You will need to run both commands to change the IP.
Reply to 2xod.com

3


  • This message seems useful, vote!
  • Report this message to moderators
., on Monday July 21, 2008 01:58:00 PM
how to revert back? when i use your method my internet connection was lost.
Reply to .

4


  • This message seems useful, vote!
  • Report this message to moderators
2xod.com, on Monday July 21, 2008 10:26:29 PM
To change to static IP:
------------------------------------------------------------­----
This changes the IP address and Default Gateway:
netsh int ip set address "local area connection" static {192.168.0.101} 255.255.255.0 {192.168.0.254} 1

This changes DNS:
netsh int ip set dns "local area connection" static {192.168.0.254} primary
----------------------------------------------------------------
You will want to change the values between the curly braces, but do not use the curly braces when you run the command.
----------------------------------------------------------------
To change the interface back to DHCP (get IP automatically) use this command:
netsh int ip set address "local area connection" dhcp

DNS:
netsh int ip set dns "local area connection" dhcp
----------------------------------------------------------------


============================
I would recommend you view the help for this command, it will shed much more insight on what you're actually doing.
The netsh command allows you to change many things such the firewall configuration to the ip addresses.
You can get help for the netsh command by adding each word of the command and adding /?. For example:

=================================
C:\Documents and Settings\2xod>netsh /?

Usage: netsh [-a AliasFile] [-c Context] [-r RemoteMachine]
[Command | -f ScriptFile]

The following commands are available:

Commands in this context:
? - Displays a list of commands.
add - Adds a configuration entry to a list of entries.
bridge - Changes to the `netsh bridge' context.
delete - Deletes a configuration entry from a list of entries.
diag - Changes to the `netsh diag' context.
dump - Displays a configuration script.
exec - Runs a script file.
firewall - Changes to the `netsh firewall' context.
help - Displays a list of commands.
interface - Changes to the `netsh interface' context.
ras - Changes to the `netsh ras' context.
routing - Changes to the `netsh routing' context.
set - Updates configuration settings.
show - Displays information.
winsock - Changes to the `netsh winsock' context.

The following sub-contexts are available:
bridge diag firewall interface ras routing winsock

To view help for a command, type the command, followed by a space, and then
type ?.

=================================
C:\Documents and Settings\2xod>netsh int /?

The following commands are available:

Commands in this context:
? - Displays a list of commands.
add - Adds a configuration entry to a table.
delete - Deletes a configuration entry from a table.
dump - Displays a configuration script.
help - Displays a list of commands.
ip - Changes to the `netsh interface ip' context.
ipv6 - Changes to the `netsh interface ipv6' context.
portproxy - Changes to the `netsh interface portproxy' context.
reset - Resets information.
set - Sets configuration information.
show - Displays information.

The following sub-contexts are available:
ip ipv6 portproxy

To view help for a command, type the command, followed by a space, and then
type ?.

=================================
C:\Documents and Settings\2xod>netsh int ip /?

The following commands are available:

Commands in this context:
? - Displays a list of commands.
add - Adds a configuration entry to a table.
delete - Deletes a configuration entry from a table.
dump - Displays a configuration script.
help - Displays a list of commands.
reset - Resets TCP/IP and related components to a clean state.
set - Sets configuration information.
show - Displays information.

To view help for a command, type the command, followed by a space, and then type ?.

=================================
C:\Documents and Settings\2xod>netsh int ip set /?

The following commands are available:

Commands in this context:
set address - Sets the IP address or default gateway to the specified interface.
set dns - Sets DNS server mode and addresses.
set wins - Sets WINS server mode and addresses.

=================================
C:\Documents and Settings\2xod>netsh int ip set address /?

Usage: set address [name=]<string>
[[source=]dhcp |
[source=] static [addr=]IP address [mask=]IP subnet mask]
[[gateway=]<IP address>|none [gwmetric=]integer]

Parameters:

Tag Value
name - The name of the interface.
source - One of the following values:
dhcp: Sets DHCP as the source for configuring IP
addresses for the specific interface.
static: Sets the source for configuring IP addresses
to local static configuration.

gateway - One of the following values:
<IP address>: A specific default gateway for the
static IP address you are setting.
none: No default gateways are set.
gwmetric - The metric for the default gateway. This field should
not be set if gateway is set to 'none'.
The following options are used only if source is 'static':

addr - An IP address for the specified interface.
mask - The subnet mask for the specified IP address.

Remarks: Used to change the IP address configuration mode from either DHCP to
static mode or static mode to DHCP. Adds IP addresses on an
interface with static IP address or adds default gateways.

Examples:

set address name="Local Area Connection" source=dhcp
set address local static 10.0.0.9 255.0.0.0 10.0.0.1 1


C:\Documents and Settings\2xod>
=================================

If you ever mess up the configuration you can always modify the settings through the graphical interface of the control panel. From Start > Control Panel > Switch to Classic View, and open Network Connections


Before running these commands, look at your existing (working) IP configuration with the ipconfig command:
This will show you the Default Gateway and DNS entries to put in the commands above where the {braces} are.
================================
C:\Documents and Settings\2xod>ipconfig /all

Windows IP Configuration

Host Name . . . . . . . . . . . . : computar
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Unknown
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter Local Area Connection:

Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Intel(R) PRO/1000 XT Server Adapter
Physical Address. . . . . . . . . : 00-02-B3-B5-D6-J3
Dhcp Enabled. . . . . . . . . . . : No
IP Address. . . . . . . . . . . . : 192.168.0.101
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.2
DNS Servers . . . . . . . . . . . : 192.168.0.2

C:\Documents and Settings\2xod>
================================
Reply to 2xod.com

5


  • This message seems useful, vote!
  • Report this message to moderators
bharat.cse1, on Tuesday August 12, 2008 05:52:58 AM
how to set both the preferred and alternate dns using dos??
Reply to bharat.cse1

7


  • This message seems useful, vote!
  • Report this message to moderators
 thepenk, on Tuesday September 23, 2008 07:28:25 AM
You can add more than one DNS server with the commands:

netsh int ip set dns "local area connection" static 192.168.0.254 primary
netsh int ip add dns "local area connection" 192.168.1.254
Reply to thepenk

6


  • This message seems useful, vote!
  • Report this message to moderators
raj, on Saturday September 20, 2008 01:14:44 PM
please solve my problem
Reply to raj
Software found in the relevant downloads
Download Videora Ipod converter 3.07Videora Ipod converter - Videora iPod Converter is a free iPod video converter that converts video files, YouTube videos, movies and DVD's so you can...Category: Video editing
License: Freeware/gratuit
Download IrfanView 4.10IrfanView - IrfanView is a fast and compact image viewer/converter. It is trying to be simple for beginners and powerful for...Category: Slide show
License: Freeware/gratuit
Download VLC  0.8.6hVLC - VLC media player is a portable multimedia player for many video and audio formats (MPEG1, MPEG2, MPEG4, DivX, mp3, ogg, ...)...Category: Video players
License: Open Source
Download MediaCoder 0.6.1.4140MediaCoder - MediaCoder is a free universal batch media transcoder, which nicely integrates most popular audio/video codecs and tools...Category: Video editing
License: Open Source
More freeware about « How to change IP address from command prompt »