h2. How to Configure an iSCSI Target for Discovery
{toc:type=list|minlevel=3|maxlevel=3}
These procedures show you how to make an iSCSI target available to an initiator host. The Discovery process presents an initiator with a list of available targets. The discovery method is the way in which the iSCSI targets can be found. The three discovery methods for iSCSI-iSER targets are:
* *Static discovery* \- A static target address is configured. Use this method if an iSCSI node has a small number of targets, or to restrict the targets that an initiator can access. See [How to Configure a Target for Static Discovery|#staticdiscovery].
* *Dynamic discovery using iSNS* \- Targets are discovered by interacting with one or more iSNS servers. Use this method for the iSCSI initiator to discover the target using as little configuration as possible. You must have at least one iSNS server on your network to use this method. See [How to Configure a Target for Dynamic Discovery Using iSNS|#DDiSNS].
{note:title=Warning}Do not configure an iSCSI target to be discovered by both static and dynamic discovery methods. Doing so can impede the performance of the iSCSI target device.{note}
* *SendTargets discovery* \- Configure the SendTargets option on the initiator. For best results when using iSER, configure the target with a target portal group to force connections to use the IB interface. For more information, see [How to Create a Target Portal Group].
Before you begin to configure an iSCSI target for discovery, you should have already completed the following tasks:
* [Enable the STMF Service|How to Enable the STMF Service]
* [Create SCSI Logical Units|How to Create SCSI Logical Units]
* [Make SCSI Logical Units Available|How to Make SCSI Logical Units Available]
* [Configure an iSCSI Initiator|How to Configure an iSCSI Initiator]
* [Configure an IB HCA for iSER|How to Configure an IB HCA for iSER] (iSER only)
* [Configure iSCSI Ports|How to Configure iSCSI Target Ports]
{note:title=Tip}In the following procedures, the itadm command is run on the target and the devfsadm command is run on the initiator.
{note}
{anchor:staticdiscovery}
h3. How to Configure a Target for Static Discovery
Use this method of discovery if an iSCSI node exposes a large number of targets, such as an iSCSI to Fibre Channel bridge. For this method, you must supply the iSCSI node IP address and port combination. The iSCSI initiator then uses the SendTargets feature to perform the device discovery.
This procedure shows you how to obtain the IP address of the iSCSI target, and use the {{itadm}} command to create an iSCSI target.
# Become superuser.
# Obtain the (inet) IP address of the target.
{code}
# ifconfig -a
{code}
{code}
ibd0: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 2044 index 3
inet 196.168.7.129 netmask ffffff00 broadcast 10.255.255.255
ipib 0:0:0:46:fe:80:0:0:0:0:0:0:0:2:c9:2:0:27:5b:59
{code}
# Create the iSCSI target.
{code}
# itadm create-target
{code}
# Verify the creation of the target.
{code}
# itadm list-target -v
{code}
# Create the iSCSI device links for the local system.
{code}
# devfsadm -i iscsi
{code}
{anchor:DDiSNS}
h3. How to Configure a Target for Dynamic Discovery Using iSNS
Use this method if you have at least one iSNS server on your network. This method enables the iSCSI initiator to discover targets with as little configuration as possible, while also providing state-change notification. State-change functionality notifies the iSCSI initiator when there are changes in the operational state of a target. For this method, you must supply the iSNS server address and port combination. The iSCSI initiator can then query the specified iSNS server to perform device discovery. The default port for an iSNS server is 3205.
# Log into the server as root and obtain the (inet) IP address of the iSNS server.
{code}
ibd0: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 2044 index 3
inet 196.168.7.129 netmask ffffff00 broadcast 10.255.255.255
ipib 0:0:0:46:fe:80:0:0:0:0:0:0:0:2:c9:2:0:27:5b:59
{code}
# Log into the target system as root and define the iSNS server with the target that will be registered. You must specify the IP address of the iSNS server and the port number separated by a colon (_IP_address:port_number_). In this example, the default port for an iSNS server is used.
{code}
# itadm modify-defaults --isns-server 10.0.0.129:3205
{code}
# Enable target registration.
{code}
# itadm modify-defaults --isns enable
{code}
# Verify the creation of the target.
{code}
# itadm list-target -v
{code}
# Create the iSCSI device links for the local system.
{code}
# devfsadm -i iscsi
{code}
h3. How to Configure a Target for Discovery Using SendTargets
Ensure that the connections to the target use iSER by configuring at least one target portal group that represents the IPoIB interfaces and bind those to the targets. Using SendTargets for iSER lets you avoid reverting to a sockets iSCSI configuration.
The following steps cause the target to accept connections only on the two IP addresses specified.
# Log in as root and obtain the (inet) IP address of the targets.
{code}
# ifconfig -a
{code}
{code}
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
e1000g0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
inet 192.168.0.1 netmask ffffff00 broadcast 172.20.239.255
ether 0:14:4f:d:ca:c4
ibd0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 2044 index 6
inet 10.8.1.108 netmask ffffff00 broadcast 10.8.3.255
ipib 0:0:0:4c:fe:80:0:0:0:0:0:0:0:3:ba:0:1:0:d8:1a
ibd1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 2044 index 7
inet 10.9.1.108 netmask ffffff00 broadcast 10.9.3.255
ipib 0:0:0:4d:fe:80:0:0:0:0:0:0:0:3:ba:0:1:0:d8:19
lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1
inet6 ::1/128
{code}
# Create two target portal groups called {{ibd0}} and {{ibd1}} for the two IP addresses.
{code}
# itadm create-tpg idb0 10.8.1.108
# itadm create-tpg idb1 10.9.1.108
{code}
# Create the SCSI target.
{code}
# itadm create-target -t ibd0,ibd1
Target iqn.1986-03.com.sun:02:c558ddcb-4eb2-cf6d-af1f-d7ebf98a3845 successfully created.
{code}
# Verify the creation of the target.
{code}
# itadm list-target -v
{code}
The target now accepts connections on the two IP addresses you specified.
h5. Where to Go Next
* [How to Configure an iSCSI Initiator]
{toc:type=list|minlevel=3|maxlevel=3}
These procedures show you how to make an iSCSI target available to an initiator host. The Discovery process presents an initiator with a list of available targets. The discovery method is the way in which the iSCSI targets can be found. The three discovery methods for iSCSI-iSER targets are:
* *Static discovery* \- A static target address is configured. Use this method if an iSCSI node has a small number of targets, or to restrict the targets that an initiator can access. See [How to Configure a Target for Static Discovery|#staticdiscovery].
* *Dynamic discovery using iSNS* \- Targets are discovered by interacting with one or more iSNS servers. Use this method for the iSCSI initiator to discover the target using as little configuration as possible. You must have at least one iSNS server on your network to use this method. See [How to Configure a Target for Dynamic Discovery Using iSNS|#DDiSNS].
{note:title=Warning}Do not configure an iSCSI target to be discovered by both static and dynamic discovery methods. Doing so can impede the performance of the iSCSI target device.{note}
* *SendTargets discovery* \- Configure the SendTargets option on the initiator. For best results when using iSER, configure the target with a target portal group to force connections to use the IB interface. For more information, see [How to Create a Target Portal Group].
Before you begin to configure an iSCSI target for discovery, you should have already completed the following tasks:
* [Enable the STMF Service|How to Enable the STMF Service]
* [Create SCSI Logical Units|How to Create SCSI Logical Units]
* [Make SCSI Logical Units Available|How to Make SCSI Logical Units Available]
* [Configure an iSCSI Initiator|How to Configure an iSCSI Initiator]
* [Configure an IB HCA for iSER|How to Configure an IB HCA for iSER] (iSER only)
* [Configure iSCSI Ports|How to Configure iSCSI Target Ports]
{note:title=Tip}In the following procedures, the itadm command is run on the target and the devfsadm command is run on the initiator.
{note}
{anchor:staticdiscovery}
h3. How to Configure a Target for Static Discovery
Use this method of discovery if an iSCSI node exposes a large number of targets, such as an iSCSI to Fibre Channel bridge. For this method, you must supply the iSCSI node IP address and port combination. The iSCSI initiator then uses the SendTargets feature to perform the device discovery.
This procedure shows you how to obtain the IP address of the iSCSI target, and use the {{itadm}} command to create an iSCSI target.
# Become superuser.
# Obtain the (inet) IP address of the target.
{code}
# ifconfig -a
{code}
{code}
ibd0: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 2044 index 3
inet 196.168.7.129 netmask ffffff00 broadcast 10.255.255.255
ipib 0:0:0:46:fe:80:0:0:0:0:0:0:0:2:c9:2:0:27:5b:59
{code}
# Create the iSCSI target.
{code}
# itadm create-target
{code}
# Verify the creation of the target.
{code}
# itadm list-target -v
{code}
# Create the iSCSI device links for the local system.
{code}
# devfsadm -i iscsi
{code}
{anchor:DDiSNS}
h3. How to Configure a Target for Dynamic Discovery Using iSNS
Use this method if you have at least one iSNS server on your network. This method enables the iSCSI initiator to discover targets with as little configuration as possible, while also providing state-change notification. State-change functionality notifies the iSCSI initiator when there are changes in the operational state of a target. For this method, you must supply the iSNS server address and port combination. The iSCSI initiator can then query the specified iSNS server to perform device discovery. The default port for an iSNS server is 3205.
# Log into the server as root and obtain the (inet) IP address of the iSNS server.
{code}
ibd0: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 2044 index 3
inet 196.168.7.129 netmask ffffff00 broadcast 10.255.255.255
ipib 0:0:0:46:fe:80:0:0:0:0:0:0:0:2:c9:2:0:27:5b:59
{code}
# Log into the target system as root and define the iSNS server with the target that will be registered. You must specify the IP address of the iSNS server and the port number separated by a colon (_IP_address:port_number_). In this example, the default port for an iSNS server is used.
{code}
# itadm modify-defaults --isns-server 10.0.0.129:3205
{code}
# Enable target registration.
{code}
# itadm modify-defaults --isns enable
{code}
# Verify the creation of the target.
{code}
# itadm list-target -v
{code}
# Create the iSCSI device links for the local system.
{code}
# devfsadm -i iscsi
{code}
h3. How to Configure a Target for Discovery Using SendTargets
Ensure that the connections to the target use iSER by configuring at least one target portal group that represents the IPoIB interfaces and bind those to the targets. Using SendTargets for iSER lets you avoid reverting to a sockets iSCSI configuration.
The following steps cause the target to accept connections only on the two IP addresses specified.
# Log in as root and obtain the (inet) IP address of the targets.
{code}
# ifconfig -a
{code}
{code}
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
e1000g0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
inet 192.168.0.1 netmask ffffff00 broadcast 172.20.239.255
ether 0:14:4f:d:ca:c4
ibd0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 2044 index 6
inet 10.8.1.108 netmask ffffff00 broadcast 10.8.3.255
ipib 0:0:0:4c:fe:80:0:0:0:0:0:0:0:3:ba:0:1:0:d8:1a
ibd1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 2044 index 7
inet 10.9.1.108 netmask ffffff00 broadcast 10.9.3.255
ipib 0:0:0:4d:fe:80:0:0:0:0:0:0:0:3:ba:0:1:0:d8:19
lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1
inet6 ::1/128
{code}
# Create two target portal groups called {{ibd0}} and {{ibd1}} for the two IP addresses.
{code}
# itadm create-tpg idb0 10.8.1.108
# itadm create-tpg idb1 10.9.1.108
{code}
# Create the SCSI target.
{code}
# itadm create-target -t ibd0,ibd1
Target iqn.1986-03.com.sun:02:c558ddcb-4eb2-cf6d-af1f-d7ebf98a3845 successfully created.
{code}
# Verify the creation of the target.
{code}
# itadm list-target -v
{code}
The target now accepts connections on the two IP addresses you specified.
h5. Where to Go Next
* [How to Configure an iSCSI Initiator]