Basic IP Configuration

Spread the words

Basic IP Configuration

When you install a Windows server 2008 or 2012 in Core mode, Power shell is essential for administration. After the installation, the first task to do is to configure the network. Here’s how to do it with power shell:

Inventory network cards of the new server:

Use Get-Netadapter cmdlet.

Get-Netadapter

getnet

To see only the physical cards.

Get-Netadapter –physical

To see only the connected cards (useful when you have a server with multiple network interface)

Get-Netadapter –physical | where status –eq ‘up’

See IP address:

Use Get-NetIPAddress cmdlet.

Get-NetIPAddress

getnetip

To see only IPv4

Get-NetIPAddress –addressfamily IPv4

getIP

IP Configuration:

Use New-NetIPAddress cmdlet

New-NetIPAddress

NewIP

Configure the sub net mask:

Use cmdlet Set-NetIPAddress

Set-NetIPAddress –interfacealias ‘Ethernet0’ –prefixlength 24

mask

Configure default gateway:

Use cmdlet New-NetRoute.

New-NetRoute –Destinationprefix ‘0.0.0.0/0’ –InterfaceAlias ‘Ethernet0’ –NextHop 192.168.1.254

GW

Configure DNS:

Use cmdlet Set-DNSClientServerAddress.

Set-DNSClientServerAddress –interfacealias ‘ethernet0’ –Serveraddress 192.168.1.1, 192.168.1.2

DNS

View IPConfig:

Use cmdlet Get-NetIPConfiguration

Get-NetIPConfiguration

getnetipconf

On a graphical interface, the result will be as follows

guiipconfig

Summary :

You can use the following syntax to configure the IP on a server.

New-NetIPAddress –InterfaceAlias ‘Ethernet0’ –IPAddress 192.168.1.1 –PreFixLength 24 –DefaultGateway 192.168.1.254

For configure DNS

Set-DNSClientServerAddress –InterfaceAlias ‘Ethernet0’ –ServerAddress 192.168.1.1, 192.168.1.2

That’s All 😉

Leave a comment

Your email address will not be published.


*