Make iscsitarget listen on specific address

I set up iscsitarget on one of my Ubuntu Lucid boxes and it seemed to work. I let one of my VMware ESX hosts scan it, and it sure enough found my LUN, but via two paths.

Turned out that because the host running iscsitarget has two NICs, the ESX host sees two paths. Not exactly what I wanted, because one NIC sits on the internet, the other on the dedicated iSCSI network.

Unfortunately it is not possible to configure ietd to listen to a specific address by editing any of the configuration files (/etc/default/iscsitarget and /etc/ietd.conf), you have to hack the init script to be able to do this…

Edit /etc/init.d/iscsitarget and go to the function ietd_start(), then change this line:

start-stop-daemon --start --exec $DAEMON --quiet --oknodo

to:

start-stop-daemon --start --exec $DAEMON --quiet --oknodo -- --address 10.10.1.1

(or whatever IP you want to have it listen to).

4 comments

  1. The same can be accomplished by adding entries to your targets.allow in the form of “ALL 10.10.1.0/24”, for example. So ALL targets will only be discoverable on the 10.10.1.0/24 subnet and not on any others.

  2. In Debian Wheezy, you can acomplish this editing /etc/default/iscsitarget:

    ISCSITARGET_OPTIONS=”–address10.10.1.1 “

  3. @frock81 – I found a typo in your entry. It should be:

    ISCSITARGET_OPTIONS=”–address 10.10.1.1″

Leave a comment

Your email address will not be published. Required fields are marked *