Configure NSX-T Manager Network from Command Line

0

Today I will be posting a quick tip that I hope may help others who have done the same thing that I did – buzz quickly through deploying an NSX-T Manager appliance without correctly setting DNS, NTP, or search order during the OVA deployment process. Rather than redeploying the appliance, which you may be tempted to do since this is an easy thing, you can easily fix this from the command line with a few simple commands. Even though redeploying is easy, it is not as time-effective as simply fixing the network issues from the command line. Let’s take a look at this quick tip – Configure NSX-T Manager Network Settings from Command Line

Configure NSX-T Manager Network Settings from Command Line

This is probably old hat to the hardened NSX-T admins out there who have already had quite a bit of lab time with the solution, however, it took me a little bit of digging to figure out the nuances of the NSX-T command line and which commands to use. First things first, there are two different command lines to realize when you login to console or SSH session of your NSX-T manager appliance. Let me say this, I did have an IP on the appliance as I believe you won’t be able to move forward without having an IP address during the OVA deployment, but you can move forward without the DNS settings, etc.

However, if you want to change your NSX-T Manager appliance IP address, it appears that you can do that with the classical ifconfig command. You should be able to use the following syntax for IP address and gateway configuration.

ifconfig eth0 <ip address> netmask <subnet mask>
route add -net 0.0.0.0/0 gw 10.10.10.1
Set-NSX-T-Manager-IP-address-with-ifconfig Configure NSX-T Manager Network from Command Line
Set NSX-T Manager IP address with ifconfig

To set the DNS, NTP, and domain search list settings we have to change the command line to the nsxcli command line. Simply type “nsxcli” to get to the nsxcli prompt.

Changing-to-the-nsxcli-prompt-in-NSX-T Configure NSX-T Manager Network from Command Line
Changing to the nsxcli prompt in NSX-T

The first thing we will do is set the DNS server values from the NSX-T Manager command line. To do that you use the following commands:

get name-servers
set name-servers <dns server 1>
set name-servers <dns server 2>
get name-servers
Setting-DNS-servers-in-NSX-T-Manager-command-line Configure NSX-T Manager Network from Command Line
Setting DNS servers in NSX-T Manager command line

Setting the domain search list is just as easy. For that we use the following commands:

set search-domains 
set search-domains 
get search-domains
Setting-the-DNS-search-domain-list Configure NSX-T Manager Network from Command Line
Setting the DNS search domain list

To set the NTP server value, we have another command from the nsxcli command line tool.

get ntp-server
set ntp-server us.pool.ntp.org
get ntp-server
Setting-NTP-server-value-for-the-NSX-T-Manager Configure NSX-T Manager Network from Command Line
Setting NTP server value for the NSX-T Manager

Now we should be able to test the name resolution via a simple ping command. Now I can ping a single host name that exists in the local network and it is correctly using the domain search list defined.

Verifying-the-DNS-lookup-is-now-working-properly-in-NSX-T-Manager-command-line Configure NSX-T Manager Network from Command Line
Verifying the DNS lookup is now working properly in NSX-T Manager command line

Wrapping Up

The NSX-T command line is powerful and contains a wealth of tools that allow configuring, managing, and troubleshooting the NSX-T environment. As shown in this simple demonstration of how to Configure NSX-T Manager Network Settings from Command Line, the command line saves the day.