原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://willis.blog.51cto.com/11907152/1855554

实验环境:RHEL7.0

                服务器端   server1.example.com  172.25.254.1

                客户端1       server2.example.com  172.25.254.2

                客户端2       server3.example.com  172.25.254.3


1. iSCSI概念

iSCSI(Internet SCSI)支持从客户端(发起端)通过IP向远程服务器上的SCSI存储设备(目标)发送SCSI命令。iSCSI限定名称用于确定发起端和目标,并采用 iqn.yyyy-mm.{reverse domain}:label的格式。默认情况下,网络通信是至iSCSI目标上的端口3260/tcp的明文。

iSCSI发起端:需要访问原始SAN存储的客户端。

iSCSI目标:从iSCSI服务器提供的远程硬盘磁盘,或“目标门户”

iSCSI目标门户:通过网络向发起端提供目标的服务器。

IQN:“iSCSI限定名称”。每个发起端和目标需要唯一名称进行标识,最好的做法是使用一个在Internet上可能独一无二的名称

2.iSCSI目标配置实验

  《1》服务器端配置

    2.1添加硬盘新硬盘,不用格式化分区,用于做远程磁盘。

我已经添加了一块磁盘vda

[root@server1 ~]# fdisk -l

Disk /dev/vda: 8589 MB, 8589934592 bytes, 16777216 sectors

分区不用格式化

[root@server1 ~]# fdisk /dev/vda

[root@server1 ~]# cat /proc/partitions

    2.2安装iSCSI目标软件包:

# yum install -y targetcli

启动服务:

# systemctl enable target; systemctl start target

     2.3 进入iSCSI目标交互式配置模式:

[root@server1 ~]# targetcli 

Warning: Could not load preferences file /root/.targetcli/prefs.bin.

targetcli shell version 2.1.fb34

Copyright 2011-2013 by Datera, Inc and others.

For help on commands, type 'help'.

/> ls

o- / ..................................................................... [...]

o- backstores .......................................................... [...]

| o- block .............................................. [Storage Objects: 0]

| o- fileio ............................................. [Storage Objects: 0]

| o- pscsi .............................................. [Storage Objects: 0]

| o- ramdisk ............................................ [Storage Objects: 0]

o- iscsi ........................................................ [Targets: 0]

o- loopback ..................................................... [Targets: 0]

/> /backstores/block create server:disk /dev/vda1

Created block storage object server:disk using /dev/vda1.

/> /iscsi create iqn.2016-09.com.example.com:storage1

Created target iqn.2016-09.com.example.com:storage1.

Created TPG 1.

/> /iscsi/iqn.2016-09.com.example.com:storage1/tpg1/luns create /backstores/block/server:disk 

/> /iscsi/iqn.2016-06.com.example:storage1/tpg1/acls create iqn.2016-06.com.example:key

Created Node ACL for iqn.2016-06.com.example:key

Created mapped LUN 0.

Created LUN 0.

/> /iscsi/iqn.2016-09.com.example.com:storage1/tpg1/portals create 172.25.254.1

Using default IP port 3260

Created network portal 172.25.254.1:3260.

/> exit

Global pref auto_save_on_exit=true

Last 10 configs saved in /etc/target/backup.

Configuration saved to /etc/target/saveconfig.json

[root@server1 ~]#

[root@server1 ~]# netstat -antple|grep 3260    ###查看端口

tcp        0      0 172.25.254.1:3260       0.0.0.0:*               LISTEN      0          35120

[root@server1 ~]# firewall-cmd --permanent --add-port=3260/tcp  ##添加防火墙策略

[root@server1 ~]# firewall-cmd --reload

《2》客户端1访问ISCSI存储

     2.1 安装iSCSI发起端软件包:

[root@server2 ~]# yum install iscsi-initiator-utils -y

    2.2 在/etc/iscsi/initiatorname.iscsi中设置发起端的IQN:

[root@server2 ~]# vim /etc/iscsi/initiatorname.iscsi

InitiatorName=iqn.2016-09.com.example:storage

    2.3 查找iSCSI服务器所提供的iSCSI目标(目标门户)

[root@server2 ~]# iscsiadm -m discovery -t st -p 172.25.254.1

172.25.254.1:3260,1 iqn.2016-09.com.example.com:key

    2.4 登录服务器上的一个或多个iscsi目标

[root@server2 ~]# systemctl restart iscsid

[root@server2 ~]# iscsiadm -m node -T iqn.2016-06.com.example:storage1 -p 172.25.254.1 -l

Logging in to [iface: default, target: iqn.2016-06.com.example:storage1, portal: 172.25.254.1,3260] (multiple)

Login to [iface: default, target: iqn.2016-06.com.example:storage1, portal: 172.25.254.1,3260] successful.

[root@server2 ~]# fdisk -l     ###查看,多了一块磁盘

Disk /dev/sdb: 4294 MB, 4294967296 bytes, 8388608 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 4194304 bytes

    2.5 挂载使用

[root@server2 ~]# fdisk  /dev/sdb

[root@server2 ~]# partprobe 

[root@server2 ~]# mkfs.xfs /dev/sdb1

[root@server2 ~]# mount /dev/sdb1 /mnt/

[root@server2 ~]# cd /mnt/

[root@server2 mnt]# df -h

Filesystem             Size  Used Avail Use% Mounted on

/dev/mapper/rhel-root  8.5G  3.0G  5.6G  35% /

devtmpfs               488M     0  488M   0% /dev

tmpfs                  498M   92K  497M   1% /dev/shm

tmpfs                  498M  7.0M  491M   2% /run

tmpfs                  498M     0  498M   0% /sys/fs/cgroup

/dev/sda1              497M  119M  379M  24% /boot

/dev/sdb1              4.0G   33M  4.0G   1% /mnt

[root@server2 mnt]# ls

file1  file10  file2  file3  file4  file5  file6  file7  file8  file9

[root@server2 mnt]# iscsiadm -m node -T iqn.2016-06.com.example:storage1 -p 172.25.254.1 -u   #登出iSCSI目标,以暂时断开连接。

Logging out of session [sid: 3, target: iqn.2016-06.com.example:storage1, portal: 172.25.254.1,3260]

Logout of [sid: 3, targ

[root@server2 mnt]# iscsiadm -m node -T iqn.2016-06.com.example:storage1 -p 172.25.254.1 -o delete      ##彻底断开连接

《3》客户端2访问ISCSI存储

[root@server3 ~]# yum install iscsi-initiator-utils.x86_64 -y

[root@server3 ~]# vim /etc/iscsi/initiatorname.iscsi 

InitiatorName=iqn.2016-06.com.example:key

[root@server3 ~]# iscsiadm -m discovery -t st -p 172.25.254.1

172.25.254.1:3260,1 iqn.2016-06.com.example:storage1

[root@server3 ~]# iscsiadm -m node -T iqn.2016-06.com.example:storage1 -p 172.25.254.1 -l

Logging in to [iface: default, target: iqn.2016-06.com.example:storage1, portal: 172.25.254.1,3260] (multiple)

Login to [iface: default, target: iqn.2016-06.com.example:storage1, portal: 172.25.254.1,3260] successful.

[root@server3 ~]# fdisk -l      ###得到的磁盘已经是被分区格式化好的,可直接挂载使用

Disk /dev/sdb: 4294 MB, 4294967296 bytes, 8388608 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 4194304 bytes

Disk label type: dos

Disk identifier: 0x231cc8fa

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            8192     8388607     4190208   83  Linux

[root@server3 ~]# mount /dev/sdb1   /mnt/

[root@server3 ~]# cd /mnt/

[root@server3 mnt]# ls   ###可以看到我们在客户大端1上创建的文件

file1  file10  file2  file3  file4  file5  file6  file7  file8  file9

转载于:https://blog.51cto.com/132408/1856046

iSCSI远程块存储配置实验相关推荐

  1. 远程FPGA虚拟实验平台用SystemVerilog HDL实现硬布线控制器

    远程FPGA虚拟实验平台用SystemVerilog HDL实现硬布线控制器 原理 参考材料 实验内容 源代码 参考材料 VirtalBoard 实验内容 RegFile模块 sALU模块 测试/保存 ...

  2. 南航计算机硬件实验,南航计硬实验四数据块移动实验报告.doc

    南航计硬实验四数据块移动实验报告 电工电子实验中心 课程名称: 计算机硬件技术基础实验 实验名称: 实验四 数据块移动 姓名: 学号: 评定成绩: 审阅教师: 实验时间: 2020.5.7 南京航空航 ...

  3. 使用LabVIEW 开发远程电子工程实验课

    使用LabVIEW 开发远程电子工程实验课 远距学习已经成为教育界必要且逐渐普及的教学方法.成长迅速的资讯与科技,也促使教育界必须持续升级教学技巧,以免学生的学习与专业知识落于人后.基于时间与空间的根 ...

  4. 远程FPGA虚拟实验平台用SystemVerilog HDL实现微程序控制器

    远程FPGA虚拟实验平台用SystemVerilog HDL实现微程序控制器 原理 参考材料 实验内容 源代码 参考材料 VirtalBoard uAR 实验内容 ROM模块 ROM的uprogram ...

  5. 远程FPGA虚拟实验平台用SystemVerilog HDL实现七段译码器

    在远程FPGA虚拟实验平台用SystemVerilog HDL实现七段译码器 源代码 VirtualBoard模块 SevenSegDecode模块 测试/保存/提交 源代码 在远程FPGA虚拟实验平 ...

  6. 在远程FPGA虚拟实验平台上验证七段译码器

    在远程FPGA虚拟实验平台上验证七段译码器 VirtualBoard模块代码 SevenSegDecode模块代码 在远程FPGA实验平台验证七段译码器 第一步:申请实验板 第二步:加载 FPGA 电 ...

  7. 阿里云存储配置实验详细过程(云计算)

    一.实验目的 1.了解公有云服务的配置和使用方法. 2.熟悉不同类型的云存储服务. 3.熟悉使用不同类型的云存储服务. 二.实验内容 第一部分:块存储服务. 第二部分:文件存储服务. 第三部分:使用对 ...

  8. 华为模拟器eNSP使用SSH远程管理防火墙实验

    实验要求:在R1上使用SSH远程管理防火墙FW1 Local-FW1: sys sysname FW1 un in en rsa local-key-pair create int g1/0/0 se ...

  9. VMware环境下如何使用iSCSI共享存储(配置实验笔记)

    前期准备: 网络配置: 测试环境需要嵌套,一定要注意物理网络的vSwtich 网络需要开启混杂模式: 详解为何在嵌套ESXi环境下要求开启Promiscuous Mode https://blog.c ...

  10. 计算机远程桌面连接实验报告,实验二 常见网络测试命令使用实验

    实验二常见网络测试命令使用实验: 实验项目名称:常见网络测试命令使用 实验项目性质:专业类 所属课程名称:计算机网络 试验计划学时:4学时9月18号 一.实验的目的 通过本实验的学习,使学生了解并掌握 ...

最新文章

  1. Webpack学习-工作原理(上)
  2. JQuery 选择器处理特殊字符
  3. 错误 SQL TOP子句中的行数必须是整数
  4. hihocoder 1107 : Shortest Proper Prefix
  5. 默认HotSpot最大直接内存大小
  6. 深入学习二叉树(四) 二叉排序树
  7. Flutter TextButton 详细使用配置、Flutter ButtonStyle样式概述实践
  8. Laravel核心解读--异常处理
  9. Mysql优化(出自官方文档) - 第五篇
  10. python循环结构高一信息技术_高中信息技术《循环结构1》优质课教学设计、教案...
  11. 百科不全书之Python进阶
  12. java加锁_JAVA最好的加锁方法是什么
  13. 相似度测试的软件,Plagiarism Checker X(文章相似度检测软件) V6.08 官方版
  14. ips细胞最新进展:利用iPS细胞成功培养出抑制宫颈癌繁殖的免疫杀伤T细胞,有望实现宫颈癌的免疫细胞疗法
  15. 全球及中国EOG放大器行业运营前景与发展动态研究报告2022版
  16. 纳米数据世界杯数据,世界杯分组,世界杯赛程,世界杯实时比分api接口
  17. 关于 CPU 推测执行漏洞,您需要知道这些
  18. java正则不能输入汉字_求一个正则表达式只输入字母或数字或汉字,要过滤特殊字符...
  19. day02 听写 vue
  20. SQL挂起,sql2000安装挂起,SQL2000安装挂起问题,sql

热门文章

  1. mysql中url的格式_MySQL JDBC URL中的格式以及参数介绍
  2. 点对点信道互连以太网实验_轩辕实验室┃SOTIF:汽车以太网容错能力测试(1)...
  3. 云小蜜知识库维护的流程和维护建议
  4. tomcat 严重: Could not contact localhost:8005. Tomcat may not be running.
  5. 基本概念学习--TaskList(任务列表)
  6. ES6的Set()方法实现数组去重
  7. VS2010 asp.net development server 无法展示svg图片
  8. Elasticsearch2.2.0数据操作
  9. 我不是来约架,我只是请他们说几句实话——QCon上海2015编程语言专题前瞻
  10. Linux下ICMP洪水***实例