************************************************************
********************Target********************************
************************************************************

[root@node3 ~]# yum list installed | grep scsi
iscsi-initiator-utils.x86_64 6.2.0.872-16.el5 installed ★initiator Only, Target rpm needed
[root@node3 ~]# yum install scsi-target-utils ★install Target
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package scsi-target-utils.x86_64 0:1.0.14-2.el5 set to be updated
--> Processing Dependency: libibverbs.so.1(IBVERBS_1.1)(64bit) for package: scsi-target-utils
--> Processing Dependency: librdmacm.so.1(RDMACM_1.0)(64bit) for package: scsi-target-utils
--> Processing Dependency: perl(Config::General) for package: scsi-target-utils
--> Processing Dependency: libibverbs.so.1()(64bit) for package: scsi-target-utils
--> Processing Dependency: librdmacm.so.1()(64bit) for package: scsi-target-utils
--> Running transaction check
---> Package libibverbs.x86_64 0:1.1.6-3.el5 set to be updated
--> Processing Dependency: openib >= 1.0 for package: libibverbs
---> Package librdmacm.x86_64 0:1.0.15-2.el5 set to be updated
---> Package perl-Config-General.noarch 0:2.40-1.el5 set to be updated
--> Running transaction check
---> Package openib.noarch 0:1.5.4.1-4.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================================================================================
Package Arch Version Repository Size
================================================================================================================================================================================================================
Installing:
scsi-target-utils x86_64 1.0.14-2.el5 base 172 k
Installing for dependencies:
libibverbs x86_64 1.1.6-3.el5 base 46 k
librdmacm x86_64 1.0.15-2.el5 base 28 k
openib noarch 1.5.4.1-4.el5 base 23 k
perl-Config-General noarch 2.40-1.el5 base 68 k

Transaction Summary
================================================================================================================================================================================================================
Install 5 Package(s)
Upgrade 0 Package(s)

Total download size: 337 k
Is this ok [y/N]: y
Downloading Packages:
(1/5): openib-1.5.4.1-4.el5.noarch.rpm | 23 kB 00:00
(2/5): librdmacm-1.0.15-2.el5.x86_64.rpm | 28 kB 00:00
(3/5): libibverbs-1.1.6-3.el5.x86_64.rpm | 46 kB 00:00
(4/5): perl-Config-General-2.40-1.el5.noarch.rpm | 68 kB 00:00
(5/5): scsi-target-utils-1.0.14-2.el5.x86_64.rpm | 172 kB 00:00
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 151 kB/s | 337 kB 00:02
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : perl-Config-General 1/5
Installing : openib 2/5
Installing : libibverbs 3/5
Installing : librdmacm 4/5
Installing : scsi-target-utils 5/5

Installed:
scsi-target-utils.x86_64 0:1.0.14-2.el5

Dependency Installed:
libibverbs.x86_64 0:1.1.6-3.el5 librdmacm.x86_64 0:1.0.15-2.el5 openib.noarch 0:1.5.4.1-4.el5 perl-Config-General.noarch 0:2.40-1.el5

Complete! ★
[root@node3 ~]# yum list installed | grep scsi
iscsi-initiator-utils.x86_64 6.2.0.872-16.el5 installed
scsi-target-utils.x86_64 1.0.14-2.el5 installed ★Target rpm is installed
[root@node3 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
#127.0.0.1 localhost.localdomain localhost
#::1 localhost6.localdomain6 localhost6

127.0.0.1 node3 localhost
#172.16.20.34 node2 localhost

192.168.56.105 node2 ★initiator
192.168.56.104 node3 ★Target

[root@node3 ~]# ping node2 ★ping to initiator ,No problem
PING node2 (192.168.56.105) 56(84) bytes of data.
64 bytes from node2 (192.168.56.105): icmp_seq=1 ttl=64 time=2.43 ms
64 bytes from node2 (192.168.56.105): icmp_seq=2 ttl=64 time=1.06 ms

--- node2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 1.064/1.748/2.432/0.684 ms
[root@node3 ~]# fdisk -l ★Check Disk info

Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 3916 31350847+ 8e Linux LVM

Disk /dev/sdb: 2147 MB, 2147483648 bytes ★Test Disk, No disk partition
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

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

Disk /dev/dm-0: 25.8 GB, 25836912640 bytes
255 heads, 63 sectors/track, 3141 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 6241 MB, 6241124352 bytes
255 heads, 63 sectors/track, 758 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-1 doesn't contain a valid partition table
[root@node3 ~]# fdisk /dev/sdb ★Create disk partition
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n ★
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1 ★
First cylinder (1-261, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-261, default 261):
Using default value 261

Command (m for help): w ★
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@node3 ~]# partprobe /dev/sdb ★
[root@node3 ~]# fdisk -l ★

Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 3916 31350847+ 8e Linux LVM

Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 261 2096451 83 Linux ★Done

Disk /dev/dm-0: 25.8 GB, 25836912640 bytes
255 heads, 63 sectors/track, 3141 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 6241 MB, 6241124352 bytes
255 heads, 63 sectors/track, 758 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-1 doesn't contain a valid partition table

[root@node3 ~]# more /etc/tgt/targets.conf ★
# This is a sample config file for tgt-admin.
# By default, tgt-admin looks for its config file in /etc/tgt/targets.conf
#
# The "#" symbol disables the processing of a line.

# This one includes other config files:

#include /etc/tgt/temp/*.conf

# Set the driver. If not specified, defaults to "iscsi".

default-driver iscsi

....
[root@node3 ~]# vi /etc/tgt/targets.conf ★rectify configuration file , between tag <target..</target>
[root@node3 ~]# more /etc/tgt/targets.conf
<target qn.2001-04.com.jp-lin03-sdb:tgtd> ★
backing-store /dev/sdb1 ★
initiator-address 192.168.56.105 ★
</target> ★

# This is a sample config file for tgt-admin.
# By default, tgt-admin looks for its config file in /etc/tgt/targets.conf
#
# The "#" symbol disables the processing of a line.

# This one includes other config files:

#include /etc/tgt/temp/*.conf

# Set the driver. If not specified, defaults to "iscsi".

default-driver iscsi

....

[root@node3 ~]# service tgtd start ★start tgtd service
Starting SCSI target daemon: Starting target framework daemon

[root@node3 ~]# chkconfig tgtd on ★bring tgtd service up automatically next time when the OS starts
[root@node3 ~]# chkconfig --list tgtd ★
tgtd 0:off 1:off 2:on 3:on 4:on 5:on 6:off ★OK
[root@node3 ~]# netstat -tulnp | grep tgtd ★find the Port number of iscsi target
tcp 0 0 0.0.0.0:3260 0.0.0.0:* LISTEN 4141/tgtd
[root@node3 ~]# iptables -L ★
Chain INPUT (policy ACCEPT)
target prot opt source destination
RH-Firewall-1-INPUT all -- anywhere anywhere

Chain FORWARD (policy ACCEPT)
target prot opt source destination
RH-Firewall-1-INPUT all -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain RH-Firewall-1-INPUT (2 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT icmp -- anywhere anywhere icmp any
ACCEPT esp -- anywhere anywhere
ACCEPT ah -- anywhere anywhere
ACCEPT udp -- anywhere 224.0.0.251 udp dpt:mdns
ACCEPT udp -- anywhere anywhere udp dpt:ipp
ACCEPT tcp -- anywhere anywhere tcp dpt:ipp
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ftp
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:nfs
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:telnet
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited

.... ★Add Firewall port rules from GUI(tcp and udp on port 3260)
[root@node3 ~]# iptables -L ★
Chain INPUT (policy ACCEPT)
target prot opt source destination
RH-Firewall-1-INPUT all -- anywhere anywhere

Chain FORWARD (policy ACCEPT)
target prot opt source destination
RH-Firewall-1-INPUT all -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain RH-Firewall-1-INPUT (2 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT icmp -- anywhere anywhere icmp any
ACCEPT esp -- anywhere anywhere
ACCEPT ah -- anywhere anywhere
ACCEPT udp -- anywhere 224.0.0.251 udp dpt:mdns
ACCEPT udp -- anywhere anywhere udp dpt:ipp
ACCEPT tcp -- anywhere anywhere tcp dpt:ipp
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ftp
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:nfs
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:telnet
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:iscsi-target ★
ACCEPT udp -- anywhere anywhere state NEW udp dpt:iscsi-target ★
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited

[root@node3 ~]# tgt-admin -s ★Check Target service
Target 1: qn.2001-04.com.jp-lin03-sdb:tgtd
System information:
Driver: iscsi
State: ready ★OK
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 2147 MB, Block size: 512
Online: Yes
Removable media: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/sdb1 ★OK
Backing store flags:
Account information:
ACL information:
192.168.56.105

************************************************************
********************Initiator****************************
************************************************************
[root@node2 ~]# yum list installed | grep scsi ★
iscsi-initiator-utils.x86_64 6.2.0.872-16.el5 installed ★
[root@node2 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
#127.0.0.1 localhost.localdomain localhost
#::1 localhost6.localdomain6 localhost6

127.0.0.1 node2 localhost

192.168.56.105 node2
192.168.56.104 node3

[root@node2 ~]# cat /etc/iscsi/initiatorname.iscsi
#InitiatorName=iqn.1994-05.com.redhat:ca542ec6f39b
#InitiatorName=iqn.2001-04.com.example:node2 ★
[root@node2 ~]# vi /etc/iscsi/initiatorname.iscsi ★rectify configuration file
[root@node2 ~]# cat /etc/iscsi/initiatorname.iscsi
#InitiatorName=iqn.1994-05.com.redhat:ca542ec6f39b
InitiatorName=iqn.2001-04.com.example:node2 ★
[root@node2 ~]# /etc/init.d/iscsi restart ★restart
iscsiadm: No matching sessions found
Stopping iSCSI daemon:
iscsid は停止しています [ OK ]
Starting iSCSI daemon: [ OK ]
[ OK ]
iSCSI ターゲットを設定中: Logging in to [iface: default, target: qn.2001-04.com.jp-lin03-sdb:tgtd, portal: 192.168.56.104,3260] (multiple)
Login to [iface: default, target: qn.2001-04.com.jp-lin03-sdb:tgtd, portal: 192.168.56.104,3260] successful.
[ OK ]
[root@node2 ~]# fdisk -l ★

Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 3916 31350847+ 8e Linux LVM

Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

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

Disk /dev/dm-0: 46.2 GB, 46238007296 bytes
255 heads, 63 sectors/track, 5621 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 6241 MB, 6241124352 bytes
255 heads, 63 sectors/track, 758 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-1 doesn't contain a valid partition table

Disk /dev/sdc: 2146 MB, 2146765824 bytes ★Worked
67 heads, 62 sectors/track, 1009 cylinders
Units = cylinders of 4154 * 512 = 2126848 bytes

Disk /dev/sdc doesn't contain a valid partition table
[root@node2 ~]#

[Linux] Configure iSCSI on Linux5 (both target and initiator)的更多相关文章

  1. Linux FC/iSCSI存储设备管理系列(一):Linux系统设备驱动入门

    Linux FC/iSCSI存储设备管理系列(一):Linux系统设备驱动入门 转载请在文首保留原文出处:EMC中文支持论坛 - https://community.emc.com/go/chines ...

  2. linux ./configure 的参数详解

    转载自http://blog.csdn.net/zjt289198457/article/details/6918656 linux ./configure 的参数详解   ./configure 该 ...

  3. Linux 部署 iSCSI 客户端配置(Linux)

    Linux 部署 iSCSI 客户端配置(Linux) 客户端环境 Client :RHEL8 IP : 192.168.121.11 一.测试与服务端的连通性 [root@Client-linux ...

  4. Linux 部署 iSCSI 服务端

    Linux 部署 iSCSI 服务端 服务端实验环境 iSCSI-server :RHEL8 IP:192.168.121.10 一.服务端安装 target 服务和 targetcli 命令行工具 ...

  5. linux初学者-iscsi篇

     linux初学者-iscsi篇         之前介绍过网络文件共享系统NFS和CIFS.在系统中,设备也是可以共享的,这就是iSCSI,它可以用来建立和管理IP存储设备.主机和客户机等之间的相互 ...

  6. Linux配置iSCSI存储

    1.基础知识 1.1 存储相关     直接存储(DAS):例如本机上的磁盘,就是属于直接存储设备.     存储区域网络(SAN):来自网络内的其他存储设备提供的磁盘.Iscsi就是属于该方式.   ...

  7. Linux 部署 iSCSI 客户端配置(Windows)

    Linux 部署 iSCSI 客户端配置(Windows) 客户端环境 Client :Windows 7 ip :192.168.121.138 一.首先查看客户端本地所有的磁盘 查看路径:邮件计算 ...

  8. linux安装iscsi target,make时出错,解决方法

    安装主要是按照这个网址的步骤来的:http://ixdba.blog.51cto.com/2895551/526452 执行到make步骤时,出错: root@host:~/iscsitarget-1 ...

  9. linux configure

    Linux环境下的软件安装,并不是一件容易的事情;如果通过源代码编译后在安装,当然事情就更为复杂一些;现在安装各种软件的教程都非常普遍;但万变不离其中,对基础知识的扎实掌握,安装各种软件的问题就迎刃而 ...

随机推荐

  1. Android5.0新特性之——控件移动动画(初级)

    最近开发,UI大牛们设计了好多很炫酷吊炸天的动画,不由得重新学习了一下5.0的ObjectAnimator动画. ObjectAnimator动画的原理,通过反射控件的setXXX方法,改变控件的实际 ...

  2. 单元测试系列之十:Sonar 常用代码规则整理(二)

    摘要:帮助公司部署了一套sonar平台,经过一段时间运行,发现有一些问题出现频率很高,因此有必要将这些问题进行整理总结和分析,避免再次出现类似问题. 作者原创技术文章,转载请注明出处 ======== ...

  3. FJOI2019 划水记

    Day0 月考的余温尚未褪去,一周后期中考也将来临.一群被哄来打FJOI的水军,在期中大考必过前一百的死命令之下,仍然不怕死的花三天时间水同步赛.试机的路上乖乖排成两排,居然还有那么一丝春游的悠闲之感 ...

  4. python from entry to abandon4

    python from entry to abandon系列的收官之作    本篇博客将会介绍<简明Python教程>的最后四章内容.并在最后附上对于本书的个人评价和下阶段自学Python ...

  5. 【Git】Git使用记录: 基于git ignore文件将remote上的文件untrack

    话不多说直接上步骤: git bash直接干到你的code. 直接敲命令: git rm -r --cached . rm是remove 命令 -r将允许递归删除 -cached只会从索引中删除文件. ...

  6. 5、Docker容器网络

    使用Linux进行IP层网络管理的指     http://linux-ip.net/html/ # yum install iproute http://linux-ip.net/html/tool ...

  7. [IoC容器Unity]第四回:使用范例

    1.引言 前面几个章节介绍了Unity的基本使用,主要分为程序和配置文件两种方法的使用,可以参考一下链接, [IoC容器Unity]第一回:Unity预览 [IoC容器Unity]第二回:Lifeti ...

  8. IOS高级开发之多线程(五)NSOperation 2

    接着看NSOperation.NSOperationQueue线程间的通信: 应用场景:比如我们经常把一些耗时的操作比如下载图片放在子线程,那么当这个完成之后,我们就需要回到主线程,这个时候就需要用到 ...

  9. Layui使用心得(1)---- 数据表格

    前端的框架我了解的不是太多,现在在用Layui的框架开发.之后准备转向Vue和React 这一系列博客主要讲一些我使用的Layui的常用组件的心得,官方的网站讲解已经很详细了,这里我只是结合我的实际使 ...

  10. JDK内置工具使用