************************************************************
********************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. orm 扩展

    """ORM小练习 如何在一个Python脚本或文件中 加载Django项目的配置和变量信息""" import os if __name_ ...

  2. arch安装以及配置记录

    设置ip和网关 ifconfig eth0 10.82.16.233 netmask 255.255.255.0 route add default gw 10.82.16.1 或者 ip addr ...

  3. Java 基础知识点小结

    小知识点 所有的程序,都要定义在类里面: 异常 定义方法时,使用 throws 可以用来捕获方法体内没有捕获的异常,然后以 SomeException 抛出异常 java是解释型语言.java虚拟机能 ...

  4. css3常用动效以及总结

    (迁移自旧博客2017 08 06) CSS3 文本效果: box-shadow:盒子阴影,可以给卡片添加提高美化效果.可广泛应用于内容展示页面. <div class="card&q ...

  5. loj #6.Guess Number

    原题链接:https://loj.ac/problem/6 Guess Number 内存限制:256 MiB 时间限制:1000 ms 题目类型:交互 题目描述 这是一个交互题的模板. 系统会随机生 ...

  6. 20165306 Exp6 信息搜集与漏洞扫描

    Exp6 信息搜集与漏洞扫描 一.实践内容概述 1.实践目标 掌握信息搜集的最基础技能与常用工具的使用方法. 2.实践内容 (1)各种搜索技巧的应用 搜索网址目录结构 搜索特定类型的文件 搜索E-Ma ...

  7. 剑指offer:顺时针打印矩阵

    问题描述 输入一个矩阵,按照从外向里以顺时针的顺序依次打印出每一个数字,例如,如果输入如下4 X 4矩阵: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 则依次打印出数 ...

  8. mysql基础篇(上篇)

    一.数据库 1.数据库介绍 2.RDBMS专业术语 3.MySQL数据库 4.常用数据库命令 1.数据库介绍 :什么是数据库 数据库就是按照数据结构来组织.存储和管理数据的仓库. 我们常常讲的数据库往 ...

  9. springboot后台控制重定向

    第一种方式: 1. 使用  @Controller  注解而不是  @RestController 2.方法上不要加  @ResponseBody  然后直接返回你要去的页面  比如 return & ...

  10. Qt中隐藏滚动条重新实现鼠标滚轮事件wheelEvent

    delta()已经被弃用了,QT5中用的是angleDelta(),计算的时候取angleDelta().y()值. #重载方法wheelEvent(self,event),即滚轮事件方法 #---- ...