Sunday, 17 November 2013

Assigning a static ip through powershell

Some reasons i find one would want to set up a static ip through powershell is if they happen to be running server core.

Server core has no GUI (graphical interface) and thus everything is set either through CMD (command prompt) or through powershell.

Powershell is much more powerful than CMD as there are is much more integration.

Now lets begin,

First start by opening power shell.
If you are already in the CMD windows just type in powershell and hit enter.
you will automatically be switched to powershell.
If you are in the GUI of the OS then you will want to search for either CMD and follow the above steps of you will want to search for "powershell".

Now that we have powershell open, begin typing the following:

1. netsh interface ip set address name ="Ethernet" source=static addr=192.168.1.106 mask=255.255.255.0 gateway=192.168.1.254
(Clarification: name="Ethernet": this refers to the name that is assigned to your NIC (network interface card. source=static: this informs that you will be adding a static ip (permanent IP address that will not be changed or assigned throughout the network unless you do so) to the NIC. addr=192.168.1.106: this IP address must be an unassigned IP address as to avoid IP conflicts from your network that you would like to be statically assigned to your PC or Server. Mask=255.255.255.0: this is the subnet mask that is assigned thought your network and must be correctly assigned depending on the amount of users needed to access the network. gateway=192.168.1.254: The gateway is the IP address of the router that your network belongs to, this address serves as the access point between your PC and the World Wide Web.)

2.  Now to check that the IP address, subnet mask and gateway have been assigned type in:
     netsh interface ip show config (this command will show you what is assigned to your NIC).

No comments:

Post a Comment