• Windows 2012 Core Survival Guide – Default Gateway Settings

    Learn about my 2012 Core Survival Guide here.

    Default Gateway Settings

    Often when troubleshooting IPv4 configuration you may find a misconfigured default gateway.  Issue that may arise from a misconfigured gateway are:

    • Ping responses not traversing the router
    • IPv4 communication only working with clients on same network segment
    • Server not receiving a DHCP address

    Viewing the Default Gateway

    Like with most of the IPv4 settings IPConfig can be used to view the configuration.  If you wish to change the default gateway settings you will have to know the “interfaceindex” to modify it.  We use Get-NetIPconfiguration to view both the interface index and the IPv4DefaultGateway value.

    PowerShell Command:

    Get-NetIPConfiguration

    The command will show in a list format each network interfaces IP configuration.  In order to get this in a table format the PowerShell command gets a little confusing.

     

    If you wish to view this information in a table format you can use the following command.  I must admit, I had help with this command.

    PowerShell Command:

    Get-NetIPConfiguration | Format-table interfaceindex,interfacealias,ipv4address, @{ label=”DefaultGateway”; Expression={ $_.IPv4DefaultGateway.NextHop }}, @{ label=”DnsServers”; Expression={ $_.DnsServer.ServerAddresses}} -autosize

    In the output below can you see where we are misconfigured?

     

    That right we should only have a single default gateway! To view the same default gateway using get-netroute use the following command.

     PowerShell Command:

     Get-NetRoute -DestinationPrefix "0.0.0.0/0" | Format-table -autosize

     In the screen shot below the default gateway is under the "NextHop" column the network interface it is configured on is under the ifIndex column.  We should only have a single default gateway!

    Removing the Default Gateway

    First you must locate the correct default gateway you wish to remove using the commands above.  You then need to know the ifIndex and the NextHop of the default gateway you wish to remove.  Below I show you how to use them in the PowerShell command.

    PowerShell Command:

    Remove-NetRoute -ifindex 12 -NextHop "192.168.0.3"

    In the screen shot below the default gateway is removed. 

     Setting the Default Gateway

    The easiest way to set the default gateway is to first make sure any pervious settings have been removed, shown above.

    It is best practice to configure the IP Address, Subnet Mask and Default Gateway all at the same time.  I show you how to do this in Managing basic IPv4 configuration information.

    When there is no default gateway configure you can use the command below to set it.

    PowerShell Command

    New-NetRoute -interfaceindex 15 -NextHop "192.168.0.1" -destinationprefix "0.0.0.0/0"

    In the output below I configured Interfaceindex 15.  I began with no default gateway set. Set the default gateway for interfaceindex 15 to 192.168.0.1 and then confirmed the setting was correct. 

    I hope you found this useful.  Please leave me a comment

    Bruce

  • 2012 Core Survival Guide

    I like many of you keep notes to remember all the command line tools. In the past I would develop an OneNote document to keep my notes in. This time I am going to share my 2012 Core Survival Guide with you. I am doing this because my customers are planning to deploy Windows 2012 Server with the core interface.  I need to be ready to support them when the time arises.  I hope you can benefit from this guide too.

    In order to stay focused here, this is the scenario I am using:

    You are a server administrator with a Windows Server 2012 deployed with only the core interface. You cannot Remote Desktop, Remote PowerShell, or ping the box. You still have access to the console by walking up to it.

    So I plan to come up with a list of tasks needed to get the server back in production.

    As I develop this survival guide I am going to make some assumptions:

    • If you have remote access to the box you would use a GUI to manager it
    • Tasks should be easy to type in or copy - 1 line commands
    • I plan to use PowerShell whenever possible
    • This is because it is the way of the future
    • You do not have to be a programmer
    • You do not have to know PowerShell
    • Each task should be easy to change for your environment
    • For example if I use IP address 192.0.0.10 you can change it to your IP address
    • There may be other ways to complete the tasks. Please share your ideas in the comments
    • This guide is not intended to teach you PowerShell. Although you might learn some of it.
    • The intent is to develop easy to follow examples
    • I am only testing these command on Windows Server 2012
    • Level 1 ops teams should be able to use the guide with little instruction

    So far this is my list of tasks for the 2012 Core Survival Guide. I plan to blog about these over the next weeks and months. I hope to knock out several of these a week. As I blog them I will update the links below.

    If you feel that I might have missed a task that fits the scenario please leave me a comment and I will see what I can do to add it to the list.

    Bruce

  • Windows 2012 Core Survival Guide – DNS Suffix List

    DNS Suffix List

    Learn about my 2012 Core Survival Guide here.

    I often find in large enterprises that the DNS Suffix list is inconsistent, contains out dated domains, or is incomplete for the environment.  The DNS Suffix list is what allows us to use computer names instead of fully qualified domain names (FQDN).  This is a key part of TCP/IP name resolution.  In this blog I will cover how to view, set, and remove DNS Suffix lists.

    Viewing the DNS Suffix Search List

    To view the DNS suffix search list use the Get-DNSClientGlobalSettings cmdlet

    PowerShell Command:

    Get-DNSClientGlobalSetting

    In the output below we show the DNS Global client settings for the computer. It show us that our DNS Suffix list has 4 domains in it.   

     

    Since two of the domains above (OldDomain, SoldCompany) are no longer needed I will show you below how to set it correctly.  Your DNS suffix list should list the domain used most often first, followed by the next most use domains.   This will help reduce unnecessary DNS traffic.

    Setting the DNS Suffix Search List

    I change the DNS suffix search order list by using the Set-DnsClinetGlobalSettings cmdlet.

    PowerShell Command:

    Set-DnsClientGlobalSetting -SuffixSearchList @("contoso.com", "AD.contoso.com")

    In the output below I changed the DNS suffix list to be Contoso.com and AD.contoso.com.  The nice thing about this cmdlet is you do not remove the old setting in order to give it a new setting.

     

    Removing the DNS Suffix Search List

    Removing the DNS Suffix list is nothing more than a special case of setting it.  In this case I set it using NULL.

    PowerShell Command:

    Set-DnsClientGlobalSetting -SuffixSearchList @("$Null")

    In the output below I removed the dns suffix list of "contoso.com, ad.contoso.com". 

     

    I hope you found this useful.  Please leave me a comment

    Bruce

  • Windows 2012 Core Survival Guide – DNS Server Setting

    Learn about my 2012 Core Survival Guide here.

    DNS Server Setting

    Name resolution is critical to any server configuration.  DNS is required to function correctly to locate Active Directory domain controllers, Exchange Servers, and just about every service located on your network.  It is common for every server to be configured with two DNS servers.  The common errors I run into are misconfigured DHCP scope, DNS Servers are removed from service, or a manual typo in the configuration.  This blog will help you correct the last two mentioned where you need to reconfigure the settings at the server.

    Viewing the DNS server

    I use the same command to view the DNS server's settings as I did for the Default gateway.  I also show you a third way to view this configuration information.

    PowerShell Command:

    Get-NetIPConfiguration

    The command will show in a list format each network interfaces IP configuration.  Can you spot the IPv4 DNS configuration error?

     

    If you wish to view this information in a table format you can use the following command

    PowerShell Command:

    Get-NetIPConfiguration | format-table interfaceindex, interfacealias,Ipv4address, @{ Label="DefaultGateway"; Expression={ $_.IPv4DefaultGateway.NextHop } }, @{ Label="DnsServers"; Expression={ $_.DnsServer.ServerAddresses } } -autosize

     

     You can also use get-dnsclientserveraddress to view the Dns Server Address of an interface

    PowerShell Command:

    Get-dnsclientserveraddress -addressfamily IPv4

     

    By now you should have noticed that there are no IPv4 DNS server address assigned to each network interface.

    Setting the DNS Server Address

    I set the DNS server address using the set-dnsclientserveraddress cmdlet.  You do not need to remove any previous settings.  In the example below we are going to set the DNS server address with two new DNS server IP address (192.168.0.10 and 192.168.0.11)

    PowerShell Command:

    Set-DNSClientServerAddress -interfaceindex 15 -ServerAddress ("192.168.0.10","192.168.0.1")

    In the example output below I show you the current settings.  I run the Set-DNSClientServerAddress cmdlet to set the DNS Server Address. Then I show you the results.

     

    Removing the DNS Server Address

    You can remove the DNS server address by using the cmdlet below:

    PowerShell Command:

    Set-DNSClientServerAddress -interfaceindex 15 -ResetServerAddress

    In the example output below I show you the current settings.  I run the cmdlet to remove the DNS Server Address. Then I confirm the results.

     

    I hope you found this useful.  Please leave me a comment

    Bruce

     

     

  • Windows 2012 Core Survival Guide - Managing basic IPv4 configuration information

     

    Learn about my 2012 Core Survival Guide here.

    Basic IPv4 Address configuration

    Windows Server 2012 Core still has IPCONFIG.EXE that can be used to view the IP configuration. Modern servers typically come with several network interface ports.  This causes IPCONFIG.EXE to scroll off the screen when viewing its output.  Consider piping the output if IPCONFIG.EXE to a file and view it with Notepad.exe.  This is the typical command I use:

    IPConfig /all >IPConfigOutput.txt

    Notepad IPConfigOutput.txt

    The screen shot below is what you would expect to see using the above commands.

     

     

    Viewing basic IPv4 configuration information with Get-NetIPAddress

    If you wish to modify your IPv4 configuration you will need to know the “InterfaceIndex” of the NIC.  PowerShell is going to be the tool of choice to determine this.  I use the following PowerShell command to determine the “InterfaceIndex”

    PowerShell Command:

    Get-NetIPAddress -AddressFamily IPv4 | format-table interfaceindex, interfacealias, ipaddress, PrefixLength -autosize

    This command will display in a table format the IPv4 address for all of the Network Interface ports installed in the server.  As you can see below all three NICs have link local address (169.254.y.z).  This may indicates that NICs are configured for DHCP and this server cannot locate a DHCP server.  (See Determining if an IPv4 address is DHCP or Static to verify NIC setting)

     

    In the above screen shot PrefixLengh is the CIDR-type subnet mask.  This equals the number of bits used for the Subnet Mask.  For example:

    • 24 is a subnet of 255.255.255.0
    • 16 is a subnet of 255.255.0.0
    • 8 is a subnet of 255.0.0.0

    Modifying basic IPv4 configuration information

    As you can see from the output above we have 3 NIC in this box and the loopback adaptor.  Now that you know the “InterfaceIndex” we can modify one of the NIC in the this server.

    I have found that when working with Core it is a best practice to configure the IP Address, Subnet Mask and Default Gateway all at the same time.  Below I am going to modify the NIC with “InterfaceIndex  14”.  I am going to give it an IPv4 address of 192.168.0.10 with a Subnet mask of 255.255.255.0 and a default gateway of 192.168.0.1. 

    PowerShell Command:

    New-NetIPAddress -interfaceindex 14 -IPAddress 192.168.0.10 -Prefixlength 24 -defaultgateway 192.168.0.1

    Below you can see I started with a link local address of 169.254.65.227 with a CIDR-type subnet mask of 16.  We change it to 192.1680.10 with a CIDR-type subnet mask of 25.  I will cover how to see the default gateway in an upcoming blog.  For now you will have to believe me that I set it.

     

     If the IPv4 address has already been set or you run the same command again you might see this error below.

     

    Removing basic IPv4 configuration information

    Removing all of the basic settings is a bit tricky.   You must use the same parameters that would be used to configure the interface.  If you leave off defaultgateway it does not remove it from the configuration.

    PowerShell Command

    Remove-NetIPAddress -interfaceindex 14 -IPAddress 192.168.0.10 -defaultgateway 192.168.0.1

    In the screen shot below we show the current setting, removing the setting and the results of the removal.

     

    The removal of the default gateway has some challenges.  If not correctly removed, it can prevent you from correctly configuring the basic IPv4 configuration.  I plan to blog about this in my upcoming blogs.  I will include complete instruction and troubleshooting steps for removing the default gateway.

    Modifying an misconfigured IPv4 Address

    If your IPv4 address has been set, but misconfigured, you can modify it by first removing the old IPv4 address and adding it back.

    Now it is time for you to get into your lab and play with this.  You don’t want your first experience with configuring basic IPv4 configuration to happen with the CIO standing over your shoulder watching you.

    I hope you found this useful.  Please leave me a comment

    Thanks,

    Bruce