Rh436-iscsi server configuration (rhel5.5)

Source: Internet
Author: User
Iscsi server configuration OS Version: [root @ ex333server ~] # Lsb_release-aLSBVersion: core-3.1-amd64: core-3.1-ia32: core-3.1-noarch: graphics-3.1-amd64: graphics-3.1-ia32: graphics-3.1-noarchDistribut

Iscsi Server Configuration

Operating system version:

[Root @ ex333server ~] # Lsb_release-
LSB Version: core-3.1-amd64: core-3.1-ia32: core-3.1-noarch: graphics-3.1-amd64: graphics-3.1-ia32: graphics-3.1-noarch:
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Release: 5.5

Create the following two logical volumes for sharing:
[Root @ ex333server ~] # Lvs
/Dev/cdrom: open failed: No medium found
Lv vg Attr LSize Origin Snap % Move Log Copy % Convert
Lv_iscsi_244 vg_iscsi-wi-a-4.00 M
Lv_iscsi_demo vg_iscsi-wi-a-4.00 M


Installation package:
Yum install scsi-target-utils

Start the service:
/Etc/init. d/tgtd restart
Chkconfig tgtd on


1. Configure the iscsi server using commands:
Create a target:
Tgtadm -- lld iscsi -- op new -- mode target -- tid = 1 -- targetname iqn.2012-05.com. example. ex333server: rdisks. demo

Bind the shared device to the target:
Tgtadm -- lld iscsi -- op new -- mode = logicalunit -- tid = 1 -- lun = 1 -- backing-store/dev/vg_iscsi/lv_iscsi_demo

Set the CIDR blocks that can be accessed and shared:
Tgtadm -- lld iscsi -- op bind -- mode = target -- tid = 1 -- initiator-address = 192.168.221.0/24

View shared devices locally:
Tgtadm -- lld iscsi -- op show -- mode target

Check Results:
[Root @ ex333server init. d] # tgtadm -- lld iscsi -- op show -- mode target
Target 1: iqn.2012-05.com. example. ex333server: rdisks. demo
System information:
Driver: iscsi
State: ready
I _T nexus information:
LUN information:
LUN: 0
Type: controller
Scsi id: IET 00010000
Scsi sn: beaf10
Size: 0 MB
Online: Yes
Removable media: No
Backing store type: rdwr
Backing store path: None
LUN: 1
Type: disk
Scsi id: IET 00010001
Scsi sn: beaf11
Size: 4 MB
Online: Yes
Removable media: No
Backing store type: rdwr
Backing store path:/dev/vg_iscsi/lv_iscsi_demo
Account information:
ACL information:
192.168.221.0/24
[Root @ ex333server init. d] # service tgtd restart
Stopping SCSI target daemon: Stopping target framework daemon
[OK]
Starting SCSI target daemon: Starting target framework daemon

[Root @ ex333server init. d] # tgtadm -- lld iscsi -- op show -- mode target
[Root @ ex333server init. d] #

The iscsi share created using the command disappears after the system or service is restarted.


2. Create an iscsi share through the configuration file:
Vim/etc/tgt/targets. conf

Backing-store/dev/vg_iscsi/lv_iscsi_demo
Initiator-address 192.168.221.0/24


Backing-store/dev/vg_iscsi/lv_iscsi_244
Initiator-address 192.168.221.244

[Root @ ex333server tgt] # service tgtd restart
Stopping SCSI target daemon: Stopping target framework daemon
[OK]
Starting SCSI target daemon: Starting target framework daemon

[Root @ ex333server tgt] # tgtadm -- lld iscsi -- op show -- mode target
Target 1: iqn.2012-05.com. example: ex333server. demo
System information:
Driver: iscsi
State: ready
I _T nexus information:
LUN information:
LUN: 0
Type: controller
Scsi id: IET 00010000
Scsi sn: beaf10
Size: 0 MB
Online: Yes
Removable media: No
Backing store type: rdwr
Backing store path: None
LUN: 1
Type: disk
Scsi id: IET 00010001
Scsi sn: beaf11
Size: 4 MB
Online: Yes
Removable media: No
Backing store type: rdwr
Backing store path:/dev/vg_iscsi/lv_iscsi_demo
Account information:
ACL information:
192.168.221.0/24
Target 2: iqn.2012-05.com. example: ex333server.tar get244
System information:
Driver: iscsi
State: ready
I _T nexus information:
LUN information:
LUN: 0
Type: controller
Scsi id: IET 00020000
Scsi sn: beaf20
Size: 0 MB
Online: Yes
Removable media: No
Backing store type: rdwr
Backing store path: None
LUN: 1
Type: disk
Scsi id: IET 00020001
Scsi sn: beaf21
Size: 4 MB
Online: Yes
Removable media: No
Backing store type: rdwr
Backing store path:/dev/vg_iscsi/lv_iscsi_244
Account information:
ACL information:
192.168.221.244
[Root @ ex333server tgt] #


Find a 244 Vm and test it on the client:
[Root @ localhost rules. d] # ifconfig bond0
Bond0 Link encap: Ethernet HWaddr 00: 0C: 29: F7: 5A: 00
Inet addr: 192.168.221.244 Bcast: 192.168.221.255 Mask: 255.255.255.0
Inet6 addr: fe80: 20c: 29ff: fef7: 5a00/64 Scope: Link
Up broadcast running master multicast mtu: 1500 Metric: 1
RX packets: 11680 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 6070 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 0
RX bytes: 6193467 (5.9 MiB) TX bytes: 901920 (880.7 KiB)

Yum install iscsi-initiator-utils.x86_64
Service iscsi restart
Chkconfig iscsi on

[Root @ localhost init. d] # iscsiadm -- mode discovery -- type sendtargets -- portal 192.168.221.254
192.168.221.254: 3260,1 iqn.2012-05.com. example: ex333server. demo
192.168.221.254: 3260,1 iqn.2012-05.com. example: ex333server.tar get244

[Root @ localhost init. d] # iscsiadm -- mode node -- targetname iqn.2012-05.com. example: ex333server.tar get244 -- portal 192.168.221.254: 3260 -- login
Logging in to [iface: default, target: iqn.2012-05.com. example: ex333server.tar get244, portal: 192.168.221.254, 3260]
Login to [iface: default, target: iqn.2012-05.com. example: ex333server.tar get244, portal: 192.168.221.254, 3260]: successful


[Root @ localhost init. d] # fdisk-l

Disk/dev/sda: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065*512 = 8225280 bytes

Device Boot Start End Blocks Id System
/Dev/sda1*1 25 200781 83 Linux
/Dev/sda2 26 1330 10482412 + 83 Linux
/Dev/sda3 1331 1591 2096482 + 82 Linux swap/Solaris

Disk/dev/sdb: 4 MB, 4194304 bytes
1 heads, 8 sectors/track, 1024 cylinders
Units = cylinders of 8*512 = 4096 bytes

Disk/dev/sdb doesn' t contain a valid partition table

We can see that the 4 m sdb has been mounted to the local device.

TIPS:
No matter whether the iscsi client or the server end is used, the service is not started after packaging. You need to start the related services before use;
Several long commands can be found directly in man (man tgtd, man iscsiadm );
The specific name of the package cannot be remembered. You can use the yum search scsi function.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.