FreeBSD iSCSI Initiator Installation and Configuration †
Q. How do I install and configure iSCSI initiator service under FreeBSD server? †A. FreeBSD 7.x has full support for iSCSI. Older version such as FreeBSD 6.3 FreeBSD iscsi_initiator driver †The iscsi_initiator implements the kernel side of the Internet SCSI (iSCSI) Compile driver †Please note that FreeBSD 7.x has this driver compiled by default. You can skip # cd /usr/src/sys/i386/conf # cp GENERIC ISCSIKERNEL # vi ISCSIKERNEL
device iscsi_initiator
# cd /usr/src # make buildkernel KERNCONF=ISCSIKERNEL
# make installkernel KERNCONF=ISCSIKERNEL
# reboot Install iSCSI Initiator driver under FreeBSD †You need FreeBSD kernel driver for the iSCSI protocol. You need to use driver # kldload -v iscsi_initiator.ko
Loaded iscsi_initiator.ko, id=6
# vi /boot/loader.conf # Beginning of the iSCSI block added by Vivek iscsi_initiator_load="YES" # End of the block added by Vivek Save and close the file. FreeBSD iscontrol command to login / negotiator / control for an iSCSI initiator session †Now, you need to use iscontrol command. First, do a discovery session and exit: # iscontrol -d targetaddress=iSCSI-SERVER-IP-ADDRESS initiatorname=nxl # iscontrol -v -d targetaddress=192.168.1.100 initiatorname=nxl
# vi /etc/iscsi.conf
officeiscsi { authmethod = CHAP chapIName = YOUR-ISCSI-USERNAME chapSecret = YOUR-ISCSI-PASSWORD initiatorname = nxl TargetName = iqn.XYZZZZZZZZZZZZZ # whatever "iscontrol -v -d " gives you TargetAddress = 192.168.1.100:3260,1 # your iscsi server IP } Save and close the file.
* officeiscsi { : Start config for iSCSI. * authmethod : Set authentication method to chap * chapIName : Your username * chapSecret : Your password * initiatorname : if not specified, defaults to iqn.2005-01.il.ac.huji.cs:<hostname> * TargetName : is the name by which the target is known, not to be confused with target address, either obtained via the target administrator, or from a discovery session. * TargetAddress : is of the form domainname[:port][,portal-group-tag] to quote the RFC: The domainname can be specified as either a DNS host name, a dotted-decimal IPv4 address, or a bracketed IPv6 address as specified in [RFC2732]. * } : End of config Start an iSCSI session †The following command will read options from /etc/iscsi.conf, use the targetaddress found in the block nicknamed myiscsi, # iscontrol -c /etc/iscsi.conf -n officeiscsi
# dmesg Format iSCSI volume †Now run sysinstall command to format just discovered iSCSI device name at /dev location: # sysinstall
# mkdir /iscsi # mount /dev/da1s1 /iscsi
/dev/ad1s1 /iscsi ufs rw 3 3 |