Solaris 11 Express: bind an iSCSI target to an IP
Lately I wanted to bring the advantages of ZFS (on Solaris 11 Express) to a Linux box using iSCSI. After following the Oracle guide, I’ve noticed an unexpected behaviour when discovering the iSCSI targets (from a CentOS host):
[root@zimbra ~]# iscsiadm -m discovery -t sendtargets -p 192.168.64.10
192.168.64.10:3260,1 iqn.2011-01.org.cyberz:storage:mail
192.168.64.106:3260,1 iqn.2011-01.org.cyberz:storage:mail
<<<cut - tons of similar entries!>>>
[root@zimbra ~]#
That is, the iSCSI target was bound to all the available interfaces (including ip addresses of zones!).
To avoid this behavior it’s enough to create a “target portal group”, assign a specific interface to it and then bind targets to the tpg. Follows an example:
root@scytale:~# itadm create-tpg tpg-scytale 192.168.64.10:3260
root@scytale:~# itadm list-target
TARGET NAME STATE SESSIONS
iqn.2011-01.org.cyberz:storage:mail online 1
root@scytale:~# itadm modify-target -t tpg-scytale iqn.2011-01.org.cyberz:storage:mail
Target iqn.2011-01.org.cyberz:storage:mail successfully modified
root@scytale:~#