Deciding Between Hostname and IP Address

When you use Connection Expert to connect to a LAN (TCP/IP) instrument (that is not on your local subnet), you have the choice of defining the connection using a hostname or an IP address. Every LAN device must have an IP address. However, a device hostname is optional. The IP addressing may either be static (set up once), or dynamically assigned at boot time using Dynamic Host Configuration Protocol (DHCP).  

Before you get started configuring TCP/IP instruments over your local area network (LAN), you should talk with your IT team to find out whether your network uses DHCP or static IP addressing.  

Why Is This Important?

For a remote device, the actual connection address (the VISA address string) includes either the hostname or the IP address.

  • If your network uses DHCP, the network equipment typically tries to assign the same DHCP IP address for an instrument each time it is connected. Sometimes this is not possible, resulting in a new DHCP IP address. In this case, a hostname provides a method to maintain a constant VISA address so your test programs will work after the IP address changes dynamically.
  • If you use static IP addressing, the VISA address remains constant, because the IP address does not change.

When Should I Use the Device Hostname?

You may want to use a hostname when your network is set up to use DHCP to dynamically assign an IP address at the time each PC, instrument, or interface either starts up or restarts. This requires that your network have a DNS (domain name system) server to provide the DHCP service and map each hostname to an IP address.  

There are several types of hostname you can use:

  • Simple hostname (for example, myinstr) - If your instrument supports it, this is often the most stable hostname available, as it does not depend on the subnet configuration. However, it is only usable if the PC and instrument are connected to the same subnet.
  • mDNS hostname (for example, myinstr.local) - Newer instruments following the LXI standard version 1.3 or higher support this form of hostname. This hostname is stable and does not depend upon subnet configuration, but only works if both the PC and the instrument are on the same subnet.
  • Fully-qualified hostname (for example, myinstr.mycompany.com) - This form of hostname is available if your local subnet supports DNS (domain name system) services. This form of hostname allows broader access to the instrument across LAN subnets; however, the hostname works only if your PC and the instrument are connected to a subnet with that shared DNS service. If you want a more stable hostname and don’t need non-local access, you might want to consider one of the other hostname types (simple or mDNS hostname).

You should use the device IP address if your system uses static IP addressing rather than dynamically-assigned IP addressing using DHCP. In this case, your device will have a static IP address that does not change over time (or at startup). This is likely to be the case if you are using a private LAN for your test system.

When Should I Double-Check that a Hostname and IP Address Match?

In some cases, a network has some devices set up with a hostname and a dynamically-assigned IP address (DHCP), and other devices are assigned only a static IP address. In order to assure accuracy in the configuration, you should verify:

  • How devices are normally addressed on your network
  • The configuration method (static IP address or DHCP or hostname) for the specific device you are connecting to the network

Whenever possible, you should verify the connection for each device (instrument, gateway interface, or PC LAN server) to which you connect over the LAN. If the device is located physically near you, you may want to look at the actual device to verify the configuration. If the device is at a remote location, then you will want to use alternative methods to verify the configuration. Once you have verified the configuration:

  • If the device uses static IP addressing, enter the IP address in the Hostname or IP Address field when you add new Instruments/Interfaces.
  • If the device is set up to have a hostname and to receive a random IP address on each startup, then enter the hostname in the Hostname or IP Address field when you add new Instruments/Interfaces.