ISCSI Initiator with Linux

From Lolly's Wiki
Revision as of 14:29, 18 October 2021 by Lollypop (talk | contribs) (Created page with " # cat /etc/netplan/00-installer-config.yaml # This is the network config written by 'subiquity' network: bonds: bond0: addresses: - 10.171.112.135/16...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
  1. cat /etc/netplan/00-installer-config.yaml
  2. This is the network config written by 'subiquity'

network:

 bonds:
   bond0:
     addresses:
     - 10.171.112.135/16
     gateway4: 10.171.101.1
     interfaces:
     - eno1
     - eno2
     nameservers:
       addresses:
       - 10.171.111.11
       - 10.171.111.12
       search:
       - aurdxp.amazonen-werke.com
     parameters:
       lacp-rate: slow
       mode: 802.3ad
       transmit-hash-policy: layer2
 ethernets:
   eno1: {}
   eno2: {}
   eno3: {}
   eno4: {}
   enp5s0f0: {}
   enp5s0f1: {}
   enp5s0f2: {}
   enp5s0f3: {}
 version: 2
  1. cat /etc/netplan/iscsi.yaml

network:

 ethernets:
   enp132s0f0:
     dhcp4: false
     dhcp6: false
     addresses:
       - 10.250.171.32/24
     set-name: iscsi0
     match:
       macaddress: a0:36:9f:c4:cd:1a
   enp132s0f1:
     dhcp4: false
     dhcp6: false
     addresses:
       - 10.251.171.32/24
     set-name: iscsi1
     match:
       macaddress: a0:36:9f:c4:cd:18
 version: 2
 renderer: networkd

netplan apply

  1. ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000

   link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
   inet 127.0.0.1/8 scope host lo
      valid_lft forever preferred_lft forever
   inet6 ::1/128 scope host
      valid_lft forever preferred_lft forever

2: eno1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP group default qlen 1000

   link/ether 32:2d:f2:d0:e2:3f brd ff:ff:ff:ff:ff:ff

3: eno2: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP group default qlen 1000

   link/ether 32:2d:f2:d0:e2:3f brd ff:ff:ff:ff:ff:ff

4: eno3: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000

   link/ether 24:6e:96:27:68:fa brd ff:ff:ff:ff:ff:ff

5: eno4: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000

   link/ether 24:6e:96:27:68:fb brd ff:ff:ff:ff:ff:ff

6: enp5s0f0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000

   link/ether a0:36:9f:b0:6a:f8 brd ff:ff:ff:ff:ff:ff

7: enp5s0f1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000

   link/ether a0:36:9f:b0:6a:f9 brd ff:ff:ff:ff:ff:ff

8: enp5s0f2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000

   link/ether a0:36:9f:b0:6a:fa brd ff:ff:ff:ff:ff:ff

9: enp5s0f3: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000

   link/ether a0:36:9f:b0:6a:fb brd ff:ff:ff:ff:ff:ff

10: iscsi1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000

   link/ether a0:36:9f:c4:cd:18 brd ff:ff:ff:ff:ff:ff
   inet 10.251.171.32/24 brd 10.251.171.255 scope global iscsi1
      valid_lft forever preferred_lft forever
   inet6 fe80::a236:9fff:fec4:cd18/64 scope link
      valid_lft forever preferred_lft forever

11: iscsi0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000

   link/ether a0:36:9f:c4:cd:1a brd ff:ff:ff:ff:ff:ff
   inet 10.250.171.32/24 brd 10.250.171.255 scope global iscsi0
      valid_lft forever preferred_lft forever
   inet6 fe80::a236:9fff:fec4:cd1a/64 scope link
      valid_lft forever preferred_lft forever

12: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000

   link/ether 32:2d:f2:d0:e2:3f brd ff:ff:ff:ff:ff:ff
   inet 10.171.112.135/16 brd 10.171.255.255 scope global bond0
      valid_lft forever preferred_lft forever
   inet6 fe80::302d:f2ff:fed0:e23f/64 scope link
      valid_lft forever preferred_lft forever

ping 10.250.171.1 -I iscsi0 ping 10.251.171.1 -I iscsi1


  1. cat /etc/iscsi/initiatorname.iscsi
    1. DO NOT EDIT OR REMOVE THIS FILE!
    2. If you remove this file, the iSCSI daemon will not start.
    3. If you change the InitiatorName, existing access control lists
    4. may reject this initiator. The InitiatorName must be unique
    5. for each iSCSI initiator. Do NOT duplicate iSCSI InitiatorNames.

InitiatorName=iqn.1993-08.org.debian:01:4efdaa48c143

iscsiadm -m iface -I iscsi0 -o new iscsiadm -m iface -I iscsi1 -o new

iscsiadm -m iface -I iscsi0 --op=update -n iface.net_ifacename -v iscsi0 iscsiadm -m iface -I iscsi1 --op=update -n iface.net_ifacename -v iscsi1

iscsiadm -m iface -I iscsi0 iscsiadm -m iface -I iscsi1

  1. iscsiadm -m discovery -t st -p 10.250.171.1

iscsiadm: cannot make connection to 10.250.171.1: No route to host iscsiadm: cannot make connection to 10.250.171.1: No route to host iscsiadm: cannot make connection to 10.250.171.1: No route to host iscsiadm: cannot make connection to 10.250.171.1: No route to host iscsiadm: cannot make connection to 10.250.171.1: No route to host iscsiadm: cannot make connection to 10.250.171.1: No route to host iscsiadm: connection login retries (reopen_max) 5 exceeded 10.250.171.1:3260,1 iqn.2006-08.com.huawei:oceanstor:210028dee5f846b5::20000:10.250.171.1

  1. iscsiadm -m discovery -t st -p 10.251.171.1

iscsiadm: cannot make connection to 10.251.171.1: No route to host iscsiadm: cannot make connection to 10.251.171.1: No route to host iscsiadm: cannot make connection to 10.251.171.1: No route to host iscsiadm: cannot make connection to 10.251.171.1: No route to host iscsiadm: cannot make connection to 10.251.171.1: No route to host iscsiadm: cannot make connection to 10.251.171.1: No route to host iscsiadm: connection login retries (reopen_max) 5 exceeded 10.251.171.1:3260,2 iqn.2006-08.com.huawei:oceanstor:210028dee5f846b5::20001:10.251.171.1



  1. iscsiadm -m node -T iqn.2006-08.com.huawei:oceanstor:210028dee5f846b5::20000:10.250.171.1 --login

Logging in to [iface: iscsi0, target: iqn.2006-08.com.huawei:oceanstor:210028dee5f846b5::20000:10.250.171.1, portal: 10.250.171.1,3260] (multiple) Login to [iface: iscsi0, target: iqn.2006-08.com.huawei:oceanstor:210028dee5f846b5::20000:10.250.171.1, portal: 10.250.171.1,3260] successful.

  1. iscsiadm -m node -T iqn.2006-08.com.huawei:oceanstor:210028dee5f846b5::20001:10.251.171.1 --login

Logging in to [iface: iscsi1, target: iqn.2006-08.com.huawei:oceanstor:210028dee5f846b5::20001:10.251.171.1, portal: 10.251.171.1,3260] (multiple) Login to [iface: iscsi1, target: iqn.2006-08.com.huawei:oceanstor:210028dee5f846b5::20001:10.251.171.1, portal: 10.251.171.1,3260] successful.

  1. iscsiadm -m session -P 1

Target: iqn.2006-08.com.huawei:oceanstor:210028dee5f846b5::20000:10.250.171.1 (non-flash)

       Current Portal: 10.250.171.1:3260,1
       Persistent Portal: 10.250.171.1:3260,1
               **********
               Interface:
               **********
               Iface Name: iscsi0
               Iface Transport: tcp
               Iface Initiatorname: iqn.1993-08.org.debian:01:4efdaa48c143
               Iface IPaddress: 10.250.171.32
               Iface HWaddress: <empty>
               Iface Netdev: iscsi0
               SID: 1
               iSCSI Connection State: LOGGED IN
               iSCSI Session State: LOGGED_IN
               Internal iscsid Session State: NO CHANGE

Target: iqn.2006-08.com.huawei:oceanstor:210028dee5f846b5::20001:10.251.171.1 (non-flash)

       Current Portal: 10.251.171.1:3260,2
       Persistent Portal: 10.251.171.1:3260,2
               **********
               Interface:
               **********
               Iface Name: iscsi1
               Iface Transport: tcp
               Iface Initiatorname: iqn.1993-08.org.debian:01:4efdaa48c143
               Iface IPaddress: 10.251.171.32
               Iface HWaddress: <empty>
               Iface Netdev: iscsi1
               SID: 2
               iSCSI Connection State: LOGGED IN
               iSCSI Session State: LOGGED_IN
               Internal iscsid Session State: NO CHANGE
  1. lsscsi

[0:2:0:0] disk DELL PERC H730 Mini 4.30 /dev/sda [11:0:0:0] cd/dvd HL-DT-ST DVD+-RW GTA0N A3C0 /dev/sr0 [12:0:0:1] disk HUAWEI XSG1 4305 /dev/sdb [13:0:0:1] disk HUAWEI XSG1 4305 /dev/sdc


# systemctl status iscsid.service
# systemctl restart iscsid.service
# systemctl status iscsid.service
# iscsiadm -m session
  1. iscsiadm -m node --op=update -n node.conn[0].startup -v automatic
  2. iscsiadm -m node --op=update -n node.startup -v automatic
  1. iscsiadm -m node -T iqn.2006-08.com.huawei:oceanstor:210028dee5f846b5::20000:10.250.171.1 | grep node.session.timeo.replacement_timeout

node.session.timeo.replacement_timeout = 120

  1. iscsiadm -m node -T iqn.2006-08.com.huawei:oceanstor:210028dee5f846b5::20001:10.251.171.1 | grep node.session.timeo.replacement_timeout

node.session.timeo.replacement_timeout = 120

  1. iscsiadm -m node -T iqn.2006-08.com.huawei:oceanstor:210028dee5f846b5::20000:10.250.171.1 -o update -n node.session.timeo.replacement_timeout -v 10
  2. iscsiadm -m node -T iqn.2006-08.com.huawei:oceanstor:210028dee5f846b5::20001:10.251.171.1 -o update -n node.session.timeo.replacement_timeout -v 10
  1. /lib/udev/scsi_id --whitelisted --device=/dev/sda

361866da075bdee001f9a2edf2705b9ba

  1. /lib/udev/scsi_id --whitelisted --device=/dev/sdb

3628dee5100f846b5243be07c00000004

  1. /lib/udev/scsi_id --whitelisted --device=/dev/sdc

3628dee5100f846b5243be07c00000004


  1. cat /etc/multipath.conf

defaults {

   user_friendly_names yes

} devices {

     device {
              vendor                  "HUAWEI"
              product                 "XSG1"
              path_grouping_policy    multibus
              path_checker            tur
              prio                    const
              path_selector           "round-robin 0"
              failback                immediate
              no_path_retry           15

} } blacklist {

# devnode "^sd[a]$"
# I highly recommend you blacklist by wwid instead of device name
# blacklist /dev/sda
wwid 361866da075bdee001f9a2edf2705b9ba

} multipaths {

multipath {
wwid 3628dee5100f846b5243be07c00000004
# alias here can be anything descriptive for your LUN
alias veeamrepo
}

}


  1. multipath -r
  2. multipath -ll

veeamrepo (3628dee5100f846b5243be07c00000004) dm-0 HUAWEI,XSG1 size=10T features='1 queue_if_no_path' hwhandler='1 alua' wp=rw `-+- policy='round-robin 0' prio=50 status=active

 |- 12:0:0:1 sdb 8:16 active ready running
 `- 13:0:0:1 sdc 8:32 active ready running
  1. ls -al /dev/mapper/veeamrepo

lrwxrwxrwx 1 root root 7 Okt 18 14:46 /dev/mapper/veeamrepo -> ../dm-0


  1. systemctl cat mnt-veeamrepo.mount
  2. /etc/systemd/system/mnt-veeamrepo.mount

[Unit] Before=remote-fs.target After=iscsi.service Requires=iscsi.service After=blockdev@dev-mapper-veeamrepo.target

[Mount] Where=/mnt/veeamrepo What=/dev/mapper/veeamrepo Type=xfs Options=defaults


Dokumente:

https://linux.dell.com/files/whitepapers/iSCSI_Multipathing_in_Ubuntu_Server.pdfhttps://www.suse.com/support/kb/doc/?id=000019648https://ubuntu.com/server/docs/service-iscsi