This is a quick and dirty setup, being that it I would not recommend using this in a high production environment or for an extended period of time if you do. In my head, this is just something to do a stop gap on your storage needs.
Also, I highly recommend separating your iSCSI traffic from by different VLANs, as well as using a dedicated iSCSI initiator card instead of the Windows/Linux iSCSI initiator. But this is just my two cents, and its your network.
Verify that your iSCSI network card is present in the system and that you know what device it is, in my example here it is NIC 3, eth2.
[root@CentOS03 ~]# ifconfig -a
eth1 Link encap:Ethernet HWaddr 00:50:56:98:2A:95
inet addr:172.17.1.67 Bcast:172.17.1.255 Mask:255.255.255.0
inet6 addr: 2601:9:1400:11c:250:56ff:fe98:2a95/64 Scope:Global
inet6 addr: fe80::250:56ff:fe98:2a95/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:79145 errors:0 dropped:0 overruns:0 frame:0
TX packets:5167 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:18240397 (17.3 MiB) TX bytes:756186 (738.4 KiB)
eth2 Link encap:Ethernet HWaddr 00:50:56:98:50:F1
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Next we want to set an IP for it, and if it is possible I like my iSCSI NIC to match my servers last octet. My servers IP is 172.17.1.67 so for iSCSI on the separate subnet I will be using 192.168.1.67, just for consistency.
[root@CentOS03 ~]# cp /etc/sysconfig/network-scripts/ifcfg-eth1 /etc/sysconfig/network-scripts/ifcfg-eth2
Disk /dev/sdb: 107.4 GB, 107374182400 bytesvim /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
HWADDR=00:50:56:98:50:F1
TYPE=Ethernet
ONBOOT=yes
IPADDR=192.168.1.67
NETMASK=255.255.255.0
NM_CONTROLLED=yes
BOOTPROTO=none
~
~
~
~
~
As you can see above, I just copied the eth1 config for eth2. There is no issues with my shortcuts here, just make sure you rename the parts in orange to match your settings, and remove the gateway.
And turn on the second NIC.
[root@CentOS03 ~]# service network restart
Shutting down interface eth1: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth1: [ OK ]
Bringing up interface eth2: [ OK ]
If you do not see eth2 come active, your config has an issue. Try removing the UUID line as well as verify your settings.
Next verify the storage is present, I still like to use fdisk -l shows all the disks in the system, and that is a lower case L
[root@CentOS03 ~]# fdisk -l
My drive is showing as /dev/sdb, so note yours for use in a few moments.
Disk /dev/sdb: 107.4 GB, 107374182400 bytes
Now is when we start the magic, we install the TGT Project tools via YUM.
[root@CentOS03 ~]# yum install scsi-target-utils
This will take about a minute, and you will have to approve all the dependance packages. My video shows more detail, but the files are in the same location. You want to edit the targets.conf for your device. There are a lot of options available in the configuration, but I was going for a quick functional, not secure.
[root@CentOS02 terminfo]# cd /etc/tgt/
[root@CentOS02 tgt]# ls
targets.conf
[root@CentOS02 tgt]# vim targets.conf
Give the target an iSCSI ID, and a target ID and then the path to the storage. direct-store is full access to the unformatted disk.
<target iqn.2008-09.com.velcrohurts:centos02.target1>
direct-store /dev/sdb
</target>
The server that I wanted it mapped to is a Windows Server 2008 R2. So I have a second NIC installed, on the same subnet.
I fired up the iSCI initiator and put my IP in the Target field in the Target tab and it connected.
Your milage may vary.