switchdiscover [-h| --help]

switchdiscover [-v| --version]

switchdiscover [noderange | --range ip_ranges] [-V] [-w][-r|-x|-z][-s scan_methods] [--setup] [-c community]


The switchdiscover command scans the subnets and discovers all the switches on the subnets. The command takes a list of subnets as input. The default subnets are the ones that the xCAT management node is on. It uses nmap command as default to discover the switches. However, you can specify other discovery methods such as lldp or snmp with -s flag. You can write the discovered switches into xCAT database with -w flag. This command supports may output formats such as xml(-x), raw(-r) and stanza(-z) in addition to the default format.

--setup flag is for switch-based switch discovery. It will find all the discovered switches on the subnets, then match them with predefined switches in the xCATDB. Next, it will set discovered switches with static ip address and hostname based on the predefined switch. It will also enable snmpv3 configuration. The details of the process are defined in the http://xcat-docs.readthedocs.io/en/latest/advanced/networks/switchdiscover/switches_discovery.html.

To view all the switches defined in the xCAT database use lsdef -w “nodetype=switch” command.

For lldp method, make sure that lldpd package is installed and lldpd is running on the xCAT management node. lldpd comes from xcat-dep package or you can get it from http://vincentbernat.github.io/lldpd/installation.html.

For snmp method, make sure that snmpwalk command is installed and snmp is enabled for switches. To install snmpwalk, “yum install net-snmp-utils” for redhat and sles, “apt-get install snmp” for Ubuntu. The switchdiscover command only check the switches with default community string, if user already configured switch with other commmunity string, need to pass in with -c option for switchdiscover command to be able to discover.



The switches which the user want to discover. If the user specify the noderange, switchdiscover will just return the switches in the node range. Which means it will help to add the new switches to the xCAT database without modifying the existed definitions. But the switches’ name specified in noderange should be defined in database in advance. The ips of the switches will be defined in /etc/hosts file. This command will fill the switch attributes for the switches defined.


Display usage message.


Specify one or more IP ranges. Each can be an ip address ( or an ip range ( If the range is huge, for example,, the switch discover may take a very long time to scan. So the range should be exactly specified.

For nmap and snmp scan method, it accepts multiple formats. For example:, 40-41.1-2.3-4.1-100.

If the range is not specified, the command scans all the subnets that the active network interfaces (eth0, eth1) are on where this command is issued.


Display Raw responses.


It is a comma separated list of methods for switch discovery. The possible switch scan methods are: lldp, nmap or snmp. The default is nmap.


Command Version.


Verbose output.


Writes output to xCAT database.


XML formatted output.


Stanza formatted output.


Process switch-based switch discovery. Update discovered switch’s ip address, hostname and enable snmpv3 configuration based on the predefined switch.


User defined community string for snmp scan.


0 The command completed successfully.

1 An error has occurred.


  1. To discover the switches on some subnets:
switchdiscover --range,,
  1. To do the switch discovery and save them to the xCAT database:
switchdiscover --range -w

It is recommended to run makehosts after the switches are saved in the DB.

  1. To use lldp method to discover the switches:
switchdiscover -s lldp
  1. To process switch-based switch discovery, the core switch has to be configured and top-of-rack (edge) switch has to be predefine into xCAT database with attribute switch and switchport to core switch:
switchdiscover --range -s snmp --setup