{"id":566,"date":"2024-12-13T16:13:34","date_gmt":"2024-12-13T08:13:34","guid":{"rendered":"http:\/\/192.168.5.24\/?p=566"},"modified":"2025-05-20T17:15:49","modified_gmt":"2025-05-20T09:15:49","slug":"linux%e7%b3%bb%e7%bb%9f%e9%85%8d%e7%bd%aeip-san","status":"publish","type":"post","link":"https:\/\/bigvip.dpdns.org\/?p=566","title":{"rendered":"Linux\u7cfb\u7edf\u914d\u7f6eIP SAN"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u4e00\u3001\u4ecb\u7ecd<\/h2>\n\n\n\n<p>           SAN \uff08\u5b58\u50a8\u533a\u57df\u7f51\u7edc storage area network and SAN protocols ,\u7b80\u79f0SAN\uff09\uff0c\u5b83\u662f\u4e00\u79cd\u9ad8\u901f\u7f51\u7edc\u5b9e\u73b0\u8ba1\u7b97\u673a\u4e0e\u5b58\u50a8\u7cfb\u7edf\u4e4b\u95f4\u7684\u6570\u636e\u4f20\u8f93\u3002\u5e38\u89c1\u7684\u5206\u7c7b\u662fFC-SAN\u548cIP-SAN\u4e24\u79cd\u3002FC-SAN\u901a\u8fc7\u5149\u7ea4\u901a\u9053\u534f\u8bae\u8f6c\u53d1scsi\u534f\u8bae\uff1bIP-SAN\u901a\u8fc7TCP\u534f\u8bae\u8f6c\u53d1scsi\u534f\u8bae\uff0c\u4e5f\u5c31\u662fIP \u5730\u5740\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8c\u3001\u670d\u52a1\u7aef\u5b89\u88c5\u3001\u914d\u7f6e<\/h2>\n\n\n\n<p>\u5b89\u88c5\u670d\u52a1\u7aef\u8f6f\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> yum install scsi-target-utils -y<\/code><\/pre>\n\n\n\n<p>\u4fee\u6539\u914d\u7f6e\uff0c\u589e\u52a0\u5171\u4eab\u5757\u8bbe\u5907<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost tgt]# cat \/etc\/tgt\/targets.conf \n\n&lt;target iqn.2024-12.iscsi:data>\n<strong>#\u5171\u4eab\u5757\u8bbe\u5907<\/strong>\n  backing-store \/dev\/sdb\n<strong>#\u8bbe\u7f6e\u8bbf\u95ee\u7528\u6237\u540d\u5bc6\u7801<\/strong>\n        incominguser abc 123456\n&lt;\/target><\/code><\/pre>\n\n\n\n<p>\u8fd0\u884c\u670d\u52a1\u7aef<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl enable --now tgtd<\/code><\/pre>\n\n\n\n<p>\u67e5\u770b\u670d\u52a1\u7aef\u5171\u4eab\u72b6\u6001<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost tgt]# tgt-admin --show\nTarget 1: iqn.2024-12.iscsi:data\n    System information:\n        Driver: iscsi\n        State: ready\n    I_T nexus information:\n        I_T nexus: 2\n            Initiator: iqn.1994-05.com.redhat:ce17c9bac5eb alias: client\n            Connection: 0\n                IP Address: 192.168.168.143\n    LUN information:\n        LUN: 0\n            Type: controller\n            SCSI ID: IET     00010000\n            SCSI SN: beaf10\n            Size: 0 MB, Block size: 1\n            Online: Yes\n            Removable media: No\n            Prevent removal: No\n            Readonly: No\n            SWP: No\n            Thin-provisioning: No\n            Backing store type: null\n            Backing store path: None\n            Backing store flags: \n        LUN: 1\n            Type: disk\n            SCSI ID: IET     00010001\n            SCSI SN: beaf11\n            <strong>Size: 21475 MB, Block size: 512<\/strong>\n            Online: Yes\n            Removable media: No\n            Prevent removal: No\n            Readonly: No\n            SWP: No\n            Thin-provisioning: No\n            Backing store type: rdwr\n            <strong>Backing store path: \/dev\/sdb<\/strong>\n            Backing store flags: \n    Account information:\n      <strong>  abc<\/strong>\n    ACL information:\n        ALL<\/code><\/pre>\n\n\n\n<p>\u663e\u793a\u4ee5\u4e0a\u9ed1\u4f53\u7684\u5185\u5bb9\u8bf4\u660e\u670d\u52a1\u5668\u7aef\u5171\u4eab\u6b63\u5e38\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e09\u3001\u5ba2\u6237\u7aef\u7684\u5b89\u88c5\u914d\u7f6e<\/h2>\n\n\n\n<p>    \u5ba2\u6237\u7684\u8f6f\u4ef6\u5b89\u88c5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> yum install iscsi-initiator-utils<\/code><\/pre>\n\n\n\n<p>   \u5ba2\u6237\u7aef\u7684\u914d\u7f6e\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@client ~]# grep -Ev \"^&#91;&#91;:space:]]*(#|$)\" \/etc\/iscsi\/iscsid.conf \niscsid.startup = \/bin\/systemctl start iscsid.socket iscsiuio.socket\niscsid.safe_logout = Yes\nnode.startup = automatic\nnode.leading_login = No\n<strong>node.session.auth.username = abc\nnode.session.auth.password = 123456\ndiscovery.sendtargets.auth.username = abc\ndiscovery.sendtargets.auth.password = 123456<\/strong>\nnode.session.timeo.replacement_timeout = 120\nnode.conn&#91;0].timeo.login_timeout = 15\nnode.conn&#91;0].timeo.logout_timeout = 15\nnode.conn&#91;0].timeo.noop_out_interval = 5\nnode.conn&#91;0].timeo.noop_out_timeout = 5\nnode.session.err_timeo.abort_timeout = 15\nnode.session.err_timeo.lu_reset_timeout = 30\nnode.session.err_timeo.tgt_reset_timeout = 30\nnode.session.initial_login_retry_max = 8\nnode.session.cmds_max = 128\nnode.session.queue_depth = 32\nnode.session.xmit_thread_priority = -20\nnode.session.iscsi.InitialR2T = No\nnode.session.iscsi.ImmediateData = Yes\nnode.session.iscsi.FirstBurstLength = 262144\nnode.session.iscsi.MaxBurstLength = 16776192\nnode.conn&#91;0].iscsi.MaxRecvDataSegmentLength = 262144\nnode.conn&#91;0].iscsi.MaxXmitDataSegmentLength = 0\ndiscovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768\nnode.conn&#91;0].iscsi.HeaderDigest = None\nnode.session.nr_sessions = 1\nnode.session.iscsi.FastAbort = Yes\nnode.session.scan = auto<\/code><\/pre>\n\n\n\n<p>\u5ba2\u6237\u7aef\u8fde\u63a5\u670d\u52a1\u5668<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u670d\u52a1\u5668\u7aef\u63a2\u6d4b\uff1a\n&#91;root@client ~]# iscsiadm -m discovery -t sendtargets -p 192.168.168.142\n192.168.168.142:3260,1 iqn.2024-12.iscsi:data\n\n\u767b\u5f55\u670d\u52a1\u5668\n&#91;root@client ~]# iscsiadm -m node -l\nLogging in to &#91;iface: default, target: iqn.2024-12.iscsi:data, portal: 192.168.168.142,3260] (multiple)\nLogin to &#91;iface: default, target: iqn.2024-12.iscsi:data, portal: 192.168.168.142,3260] successful.\n\n\u767b\u5f55\u6210\u529f\u540e\u5373\u53ef\u628a\u670d\u52a1\u5668\u7684\u5171\u4eab\u5757\u8bbe\u5907\u8fde\u63a5\u5230\u672c\u673a\n&#91;root@client ~]# lsscsi \n&#91;1:0:0:0]    cd\/dvd  NECVMWar VMware IDE CDR10 1.00  \/dev\/sr0 \n&#91;2:0:0:0]    disk    VMware,  VMware Virtual S 1.0   \/dev\/sda \n&#91;20:0:0:0]   storage IET      Controller       0001  -        \n<strong>&#91;20:0:0:1]   disk    IET      VIRTUAL-DISK     0001  \/dev\/sdb <\/strong>\n\n\u67e5\u770b\u8fdb\u7a0b\u8be6\u7ec6\u4fe1\u606f\u9a8c\u8bc1\n\n&#91;root@client ~]# iscsiadm -m session -P 3\niSCSI Transport Class version 2.0-870\nversion 6.2.0.874-19\nTarget: iqn.2024-12.iscsi:data (non-flash)\n        Current Portal: 192.168.168.142:3260,1\n        Persistent Portal: 192.168.168.142:3260,1\n                **********\n                Interface:\n                **********\n                Iface Name: default\n                Iface Transport: tcp\n                Iface Initiatorname: iqn.1994-05.com.redhat:ce17c9bac5eb\n                Iface IPaddress: 192.168.168.143\n                Iface HWaddress: &lt;empty>\n                Iface Netdev: &lt;empty>\n                SID: 18\n                iSCSI Connection State: LOGGED IN\n                iSCSI Session State: LOGGED_IN\n                Internal iscsid Session State: NO CHANGE\n                *********\n                Timeouts:\n                *********\n                Recovery Timeout: 120\n                Target Reset Timeout: 30\n                LUN Reset Timeout: 30\n                Abort Timeout: 15\n                *****\n                CHAP:\n                *****\n               <strong> username: abc\n                password: ********<\/strong>\n                username_in: &lt;empty>\n                password_in: ********\n                ************************\n                Negotiated iSCSI params:\n                ************************\n                HeaderDigest: None\n                DataDigest: None\n                MaxRecvDataSegmentLength: 262144\n                MaxXmitDataSegmentLength: 8192\n                FirstBurstLength: 65536\n                MaxBurstLength: 262144\n                ImmediateData: Yes\n                InitialR2T: Yes\n                MaxOutstandingR2T: 1\n                ************************\n                Attached SCSI devices:\n                ************************\n                Host Number: 20 State: running\n                scsi20 Channel 00 Id 0 Lun: 0\n                scsi20 Channel 00 Id 0 <strong>Lun: 1<\/strong>\n                        <strong>Attached scsi disk sdb  <\/strong>        State: running\n\n\u5ba2\u6237\u7aef\u8bbe\u7f6e\u5f00\u673a\u81ea\u52a8\u8fde\u63a5\u670d\u52a1\u7aef\uff1a\nsystemctl enable --now iscsi<\/code><\/pre>\n\n\n\n<p>\u8fde\u63a5\u6210\u529f\u5373\u53ef\u628a\u5757\u8bbe\u5907\u8fdb\u884c\u5206\u533a\u683c\u5f0f\u5316\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u4e0d\u5206\u533a\u76f4\u63a5\u683c\u5f0f\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u6ce8\u610f\u4e8b\u9879\uff1a<\/h3>\n\n\n\n<p>      1\u3001 \u670d\u52a1\u7aef\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u5171\u4eab\u5757\u8bbe\u5907\u540d\u79f0\u5efa\u8bae\u4f7f\u7528\u6807\u51c6\u7684\u540d\u5b57\uff0c\u5982\uff1a<\/p>\n\n\n\n<p>target iqn.2024-12.iscsi:data  \u5982\u679c\u4e0d\u4f7f\u7528\u6807\u51c6\u7684iqn\u540d\u79f0\u7ecf\u5e38\u51fa\u73b0\u65e0\u6cd5\u5171\u4eab\u7684\u60c5\u51b5\u3002<\/p>\n\n\n\n<p>     2\u3001\u670d\u52a1\u7aef\u7684\u914d\u7f6e\u6587\u4ef6\u5bf9\u683c\u5f0f\u53ca\u6807\u70b9\u7b26\u53f7\u8981\u6c42\u5f88\u4e25\u683c\uff0c\u56e0\u6b64\u7ecf\u5e38\u51fa\u73b0\u65e0\u6cd5\u6392\u67e5\u7684\u6545\u969c\u3002<\/p>\n\n\n\n<p>    3\u3001\u65e5\u5fd7\u4e2d\u63d0\u793a\u4e00\u4e0b\u5185\u5bb9\u53ef\u4ee5\u5ffd\u7565\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"93\" src=\"http:\/\/192.168.5.24\/wp-content\/uploads\/2024\/12\/image-5-1024x93.png\" alt=\"\" class=\"wp-image-569\" srcset=\"https:\/\/bigvip.dpdns.org\/wp-content\/uploads\/2024\/12\/image-5-1024x93.png 1024w, https:\/\/bigvip.dpdns.org\/wp-content\/uploads\/2024\/12\/image-5-300x27.png 300w, https:\/\/bigvip.dpdns.org\/wp-content\/uploads\/2024\/12\/image-5-768x70.png 768w, https:\/\/bigvip.dpdns.org\/wp-content\/uploads\/2024\/12\/image-5-816x74.png 816w, https:\/\/bigvip.dpdns.org\/wp-content\/uploads\/2024\/12\/image-5.png 1118w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u9644\u52a0\u77e5\u8bc6\uff1a<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>IQN\u547d\u540d\u683c\u5f0f<\/strong>\n\niqn.yyyy-mm.naming-authority:unique name\n\u547d\u540d\u89c4\u5219\nyyyy-mm \u662f\u516c\u53f8\u57df\u540d\u6ce8\u518c\u7684\u5e74\u6708\nnaming-authority \u662f\u57df\u540d\u7684\u9006\u8f6c\u683c\u5f0f\uff0c\u4f8b\u5982\uff1a iqn.1998-01.com.qingmei.iscsi \u8fd9\u4e2a\u8bf4\u660eqingmei.com\u8fd9\u4e2a\u57df\u540d\uff0c\u662f2024-12\u6ce8\u518c\u7684\uff0ciscsi\u662f\u5b50\u57df\u540d\uff0c\u5373iscsi.qingmei.com\u7684\u9006\u8f6c\u683c\u5f0f\u3002\nunique name \u53ef\u4ee5\u662f\u4f60\u60f3\u7528\u7684\u4efb\u4f55\u540d\u5b57\uff0c\u4f8b\u5982\u4e3b\u673a\u540d\uff0c\u4f46\u5fc5\u987b\u786e\u4fdd\u5192\u53f7\u540e\u8fb9\u7684\u540d\u5b57\u662f\u552f\u4e00\u7684\uff0c\u4f8b\u5982:\niqn.2024-12.com.qingmei.iscsi:name1\niqn.2024-12.com.qingmei.iscsi:name2\niqn.2024-121.com.qingmei.iscsi:name99<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u4ecb\u7ecd SAN \uff08\u5b58\u50a8\u533a\u57df\u7f51\u7edc storage area network and SAN protocols [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"aside","meta":{"footnotes":""},"categories":[20,19],"tags":[87],"class_list":["post-566","post","type-post","status-publish","format-aside","hentry","category-linux","category-windows","tag-ip-san","post_format-post-format-aside"],"_links":{"self":[{"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts\/566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=566"}],"version-history":[{"count":9,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts\/566\/revisions"}],"predecessor-version":[{"id":1174,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts\/566\/revisions\/1174"}],"wp:attachment":[{"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}