{"id":19680,"date":"2017-08-25T06:01:24","date_gmt":"2017-08-24T22:01:24","guid":{"rendered":"https:\/\/2blog.ilc.edu.tw\/25793\/2017\/08\/25\/ubuntu-16-04-lts-%e5%ae%89%e8%a3%9d-iscsi-taregt-iscsitarget\/"},"modified":"2021-03-18T17:25:08","modified_gmt":"2021-03-18T09:25:08","slug":"ubuntu-16-04-lts-%e5%ae%89%e8%a3%9d-iscsi-taregt-iscsitarget","status":"publish","type":"post","link":"https:\/\/2blog.ilc.edu.tw\/25793\/2017\/08\/25\/ubuntu-16-04-lts-%e5%ae%89%e8%a3%9d-iscsi-taregt-iscsitarget\/","title":{"rendered":"Ubuntu 16.04 LTS \u5b89\u88dd iSCSI Taregt &#8211; iscsitarget"},"content":{"rendered":"<p>\u53c3\u8003\u7db2\u7ad9\uff1a<br \/><a href=\"https:\/\/www.server-world.info\/en\/note?os=Ubuntu_16.04&amp;p=iscsi&amp;f=2\" target=\"_blank\" rel=\"noopener noreferrer\">Ubuntu 16.04 LTS : iSCSI Taregt(iscsitarget) : Server World<\/a><br \/><a href=\"https:\/\/www.server-world.info\/en\/note?os=Ubuntu_16.04&amp;p=iscsi&amp;f=3\" target=\"_blank\" rel=\"noopener noreferrer\">Ubuntu 16.04 LTS : iSCSI Initiator(Ubuntu) : Server World<\/a><br \/><a href=\"https:\/\/www.server-world.info\/en\/note?os=Ubuntu_16.04&amp;p=iscsi\" target=\"_blank\" rel=\"noopener noreferrer\">Ubuntu 16.04 LTS : iSCSI Taregt(targetcli) : Server World<\/a><\/p>\n<p>1. \u5b89\u88dd iscsitarget \u5957\u4ef6<br \/># <span style=\"color: #ff0000\">apt-get -y install iscsitarget iscsitarget-dkms<\/span> <\/p>\n<p>2. \u5efa\u7acb\u76ee\u9304<br \/># <span style=\"color: #ff0000\">mkdir \/iscsi_disks<\/span><\/p>\n<p>3. \u5efa\u7acb\u5206\u4eab\u6a94\u6848<br \/># <span style=\"color: #ff0000\">dd if=\/dev\/zero of=\/iscsi_disks\/linux-disk.img count=0 bs=1 seek=10G<\/span><br \/><span style=\"color: #0000ff\">0+0 records in<\/span><br \/><span style=\"color: #0000ff\">0+0 records out<\/span><br \/><span style=\"color: #0000ff\">0 bytes copied, 0.000299606 s, 0.0 kB\/s<\/span>[@more@]<br \/>4. \u4fee\u6539 <span style=\"color: #0000ff\">\/etc\/default\/iscsitarget<\/span>\uff0c\u5c07 ISCSITARGET_ENABLE \u7684\u503c\u6539\u6210 true<br \/># <span style=\"color: #ff0000\">sed -i &#8216;s\/ISCSITARGET_ENABLE=false\/ISCSITARGET_ENABLE=true\/&#8217; \/etc\/default\/iscsitarget<\/span><\/p>\n<p>5. \u5efa\u7acb <span style=\"color: #0000ff\">\/etc\/iet\/ietd.conf<\/span> \u8a2d\u5b9a\u6a94<br \/># <span style=\"color: #ff0000\">vim \/etc\/iet\/ietd.conf<\/span><br \/><span style=\"color: #0000ff\">Target iqn.2017-04.tces.test:ubuntu1604<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 Lun 0 Path=\/iscsi_disks\/linux-disk.img,Type=fileio<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 initiator-address 192.168.1.0\/24<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 incominguser username password<\/span> <\/p>\n<p>6. \u91cd\u65b0\u555f\u52d5 iscsitarget \u670d\u52d9<br \/># <span style=\"color: #ff0000\">systemctl restart iscsitarget<\/span><\/p>\n<p>7. \u6aa2\u67e5\u662f\u5426\u6709\u6b63\u5e38\u555f\u52d5<br \/># <span style=\"color: #ff0000\">netstat -antulp | grep :3260<\/span><br \/><span style=\"color: #0000ff\">tcp\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 0 0.0.0.0:3260\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0.0.0.0:*\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 LISTEN\u00a0\u00a0\u00a0\u00a0\u00a0 25926\/ietd<\/span><br \/><span style=\"color: #0000ff\">tcp6\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 0 :::3260\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 :::*\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 LISTEN\u00a0\u00a0\u00a0\u00a0\u00a0 25926\/ietd<\/span><\/p>\n<p>8. \u9632\u706b\u7246\u8a2d\u5b9a<br \/><span style=\"color: #ff0000\"><span style=\"color: #000000\">#<\/span> <span style=\"color: #ff0000\"><\/span>iptables -A INPUT -s 192.168.1.0\/24 -m tcp -p tcp -m state &#8211;state NEW &#8211;dport 3260 -j ACCEPT<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u53c3\u8003\u7db2\u7ad9\uff1aUbuntu 16.04 LTS : iSCSI Taregt(iscsitarget) : Ser &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/2blog.ilc.edu.tw\/25793\/2017\/08\/25\/ubuntu-16-04-lts-%e5%ae%89%e8%a3%9d-iscsi-taregt-iscsitarget\/\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008Ubuntu 16.04 LTS \u5b89\u88dd iSCSI Taregt &#8211; iscsitarget\u3009<\/span><\/a><\/p>\n","protected":false},"author":55,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[187,119],"tags":[],"class_list":["post-19680","post","type-post","status-publish","format-standard","hentry","category-c-105646","category-c-78464"],"meta_key":{"_pingme":["1"],"_encloseme":["1"],"lt_post_id":["691046"]},"_links":{"self":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/19680"}],"collection":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/comments?post=19680"}],"version-history":[{"count":1,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/19680\/revisions"}],"predecessor-version":[{"id":21176,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/19680\/revisions\/21176"}],"wp:attachment":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/media?parent=19680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/categories?post=19680"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/tags?post=19680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}