iSCSI become popular latest year and to setup targets and initiator on Linux take less than 5-10 minutes. Initiator also supported in many OS including Windows.
Scenario:
- Our iSCSI Targets server has IP 192.168.0.10
- Our iSCSI Initiator server has IP 192.168.0.100
- Our domain name is internal.example.com and OS is CentOS 5
- Create block device on Targets server (eg. /dev/sda5)
- Create new iSCSI target (eg. tid=1)
- Associate block devices to target on lun (eg. lun=1)
- Export target to Initiator server
- Discover and use it
iSCSI Targets
- Use fdisk or other tools to create a partition or a block device, /dev/sda5 in our example
- Install scsi-target-utils
- Make sure tgtd configured at boot up: chkconfig tgtd on
- Create a new target, iSCSI target naming is "iqn.
. . :
# tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.2008-11.com.example.internal:disk1 - Export a block device to target
# tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/sda5 - Export target to destination 192.168.0.100
# tgtadm --lld iscsi --op bind --mode target --tid 1 -I 192.168.0.100
- Install iscsi-initiator-utils
- Start the initiator service
# service iscsi start; chkconfig iscsi on - Discover available targets
# iscsiadm -m discovery -t sendtargets -p 192.168.0.10:3260
Command will give you output
192.168.0.10:3260,1 iqn.2008-11.com.example.internal:disk1 - Login to targets
# iscsiadm -m node -T iqn.2008-11.com.example.internal:disk1 -p 192.168.0.10:3260 -l - Now you should see your block device by using fdisk -l, propebly /dev/sdc or something like that.
- On iSCSI Targets, put all tgtadm commands to /etc/rc.local. Otherwise all disapears after a reboot.
- Security: use Two-way authentication CHAP. Configure it from Targets.
- Security: use VLAN or/and VPN to isolate and encrypt the data
- Logout a target with
# iscsiadm -m node -T iqn.2008-11.com.example.internal:disk1 -p 192.168.0.10:3260 -u - If you want to mount iSCSI device from fstab, make sure you put _netdev in option field.
No comments:
Post a Comment