[Linux] Configure iSCSI on Linux5 (both target and initiator)
************************************************************
********************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)的更多相关文章
- Linux FC/iSCSI存储设备管理系列(一):Linux系统设备驱动入门
Linux FC/iSCSI存储设备管理系列(一):Linux系统设备驱动入门 转载请在文首保留原文出处:EMC中文支持论坛 - https://community.emc.com/go/chines ...
- linux ./configure 的参数详解
转载自http://blog.csdn.net/zjt289198457/article/details/6918656 linux ./configure 的参数详解 ./configure 该 ...
- Linux 部署 iSCSI 客户端配置(Linux)
Linux 部署 iSCSI 客户端配置(Linux) 客户端环境 Client :RHEL8 IP : 192.168.121.11 一.测试与服务端的连通性 [root@Client-linux ...
- Linux 部署 iSCSI 服务端
Linux 部署 iSCSI 服务端 服务端实验环境 iSCSI-server :RHEL8 IP:192.168.121.10 一.服务端安装 target 服务和 targetcli 命令行工具 ...
- linux初学者-iscsi篇
linux初学者-iscsi篇 之前介绍过网络文件共享系统NFS和CIFS.在系统中,设备也是可以共享的,这就是iSCSI,它可以用来建立和管理IP存储设备.主机和客户机等之间的相互 ...
- Linux配置iSCSI存储
1.基础知识 1.1 存储相关 直接存储(DAS):例如本机上的磁盘,就是属于直接存储设备. 存储区域网络(SAN):来自网络内的其他存储设备提供的磁盘.Iscsi就是属于该方式. ...
- Linux 部署 iSCSI 客户端配置(Windows)
Linux 部署 iSCSI 客户端配置(Windows) 客户端环境 Client :Windows 7 ip :192.168.121.138 一.首先查看客户端本地所有的磁盘 查看路径:邮件计算 ...
- linux安装iscsi target,make时出错,解决方法
安装主要是按照这个网址的步骤来的:http://ixdba.blog.51cto.com/2895551/526452 执行到make步骤时,出错: root@host:~/iscsitarget-1 ...
- linux configure
Linux环境下的软件安装,并不是一件容易的事情;如果通过源代码编译后在安装,当然事情就更为复杂一些;现在安装各种软件的教程都非常普遍;但万变不离其中,对基础知识的扎实掌握,安装各种软件的问题就迎刃而 ...
随机推荐
- 关于layui富文本编辑器和form表单提交的问题
今天下午因为要做一个富文本编辑器上传文件给后台,所以看了一下layui的富文本编辑器,折腾了半天,终于把这玩意搞定了. 首先需要先创建layui的富文本编辑器 <textarea id=&quo ...
- mac电脑php+mysql+nginx+phpmyadmin环境搭建
英文原文:http://blog.frd.mn/install-nginx-php-fpm-mysql-and-phpmyadmin-on-os-x-mavericks-using-homebrew/ ...
- 记录一下最近的解决的坑爹bug
最近解决的bug长得都很别致啊,记录一下 一 :天气插件引用报403 项目里有一个天气插件引用一直报403 后来确定原因是headers里缺少referer源,无法访问资源的服务器,再后来又发现项目引 ...
- node中间层实现文件上传
一般情况下,前端的文件上传一般都是通过form表单的(<input type="file" />)来完成文件的上传,如果使用node中间层完成跨域,文件的上传就需要在n ...
- haproxy keepalived和nodejsv9的容器镜像所需文件
配合hub.docker.com 的dablyo/haproxy-keepalived-nodejsv9:190407 使用的 [root@haproxy ~]# cat haproxy.cfgglo ...
- 设置RHEL-7.0的运行级别
在RHEL7中修改默认运行级别与7以前版本的修改方式不同(7以前版本可以修改/etc/inittab中的“id:5:initdefault:”参数值来实现),RHEL7在/etc/inittab文件中 ...
- Active Record Query Interface 数据查询接口(界面) 看到第8节。
http://guides.rubyonrails.org/active_record_querying.html ✅How to find records using a variety of me ...
- Confluence 6 升级以后
7. 拷贝你的数据库驱动 如果你现在使用的是 Oracle 或者 MySQL 数据库的话,你讲要重新拷贝 jdbc 驱动的 jar 文件到你已经存在的 Confluence 安装目录中 conflue ...
- restore和recover的区别
restore 是还原物理文件 recover 是用日志恢复到一致 用了RMAN备份后就必须要用restore还原,然后才用recover恢复 restore——还原,与backup相对,从备份读出恢 ...
- maven打jar包 没有主属性清单
使用mvn clean package命令打包,java -jar 命令运行时,提示:“jar 包没有主属性清单”.修改pom文件后解决: <build> <plugins> ...