The BSD variants make it difficult to quickly determine your iSCSI initiator name or iqn but I’m told they are working on a solution. While sniffing packets is an effective method of discovery, it’s simply far to cumbersome in a busy IT shop. If you know of an easier way to display the initiator please add a comment below and I’ll post it. This post is a followup to my previous list of ways to display initiators on various platforms. I have not tested this with the other BSD variants but assume the packets would be the same.
1) Install Wireshark on the NetBSD server.
> pkg_add wireshark
2) Make sure iscsi is started on the NetBSD server.
3) Add your storage array (your target that will present the lun)
> iscsictl add_send_target -a 10.10.10.11
Added Send Target 1
4) Refresh your target list.
> iscsictl refresh_targets
5) List your targets.
> iscsictl list_targets
6) Launch Wireshark.
6a) In the Wireshark GUI, click Capture > Start to initiate packet sniffing.
8) Login to the target. In this case we’ll use target 2.
> iscsictl login -P 2
Created Session 2, Connection 1
9) List your iscsi session with your target (storage array).
> iscsictl list_sessions
Session 2: Target iqn.1992-08.com.netapp:sn.84167939
10) Stop the packet sniffing.
a) Click on Capture > Stop.
Note: click image to enlarge. The next two steps are depicted in this image.
b) In the upper left, in the Filter: field enter “iscsi.isid” without the quotes and on the right click Apply.
11) Select the first packet from your server. In the middle expand iSCSI (Login Command), and then expand Key/Value Pairs. The first entry should list the InitiatorName= value. That is your iSCSI initiator or host iqn. In this case it’s iqn.1994-04.org.netbsd:iscsi.nbsd611.lab.slice2.com.