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
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
To see only IPv4
Get-NetIPAddress –addressfamily IPv4
IP Configuration:
Use New-NetIPAddress cmdlet
New-NetIPAddress
Configure the sub net mask:
Use cmdlet Set-NetIPAddress
Set-NetIPAddress –interfacealias ‘Ethernet0’ –prefixlength 24
Configure default gateway:
Use cmdlet New-NetRoute.
New-NetRoute –Destinationprefix ‘0.0.0.0/0’ –InterfaceAlias ‘Ethernet0’ –NextHop 192.168.1.254
Configure DNS:
Use cmdlet Set-DNSClientServerAddress.
Set-DNSClientServerAddress –interfacealias ‘ethernet0’ –Serveraddress 192.168.1.1, 192.168.1.2
View IPConfig:
Use cmdlet Get-NetIPConfiguration
Get-NetIPConfiguration
On a graphical interface, the result will be as follows
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