I have installed open-iscsi, and have login to several targets. The device is mounted, and doing some IO.
But I want to disconnect the tcp connection of initiator and target, force iscsid to run recovery and reconnect.
How to do this?
I have used tcpkill to kill some tcp connection, and iscsid will run recovery and reconnect to target. But i don't know which tcp connection belongs to which target. So if i want to reconnect target1, I may kill the tcp connection of target2.
How to identify the tcp connections to targets?
Asked
Active
Viewed 2,199 times
0

pengdu
- 1,331
- 2
- 14
- 21
1 Answers
1
If your targets have different IP addresses, you can use netstat, and grep for port 3260 (iscsi).
$ netstat -nap | grep 3260
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 172.16.10.16:48471 172.16.10.201:3260 ESTABLISHED -
Then use tcpkill on the local port and destination IP:
$ sudo tcpkill -9 -i eth1 "port 48471 and host 172.16.10.201"
If your targets don't have different IP addresses, it looks like the best way is to increase the logging level of iscsid to 2 so that you can see this message that's logged when it makes a connection.
log_debug(1, "connected local port %s to %s:%s",
lserv, conn->host, serv);
There doesn't appear to be another way to get the initiator-side port out of iscsid.

Mike Andrews
- 3,045
- 18
- 28
-
Finally i have added a command in iscsiadm to get the src ip and src port of some connection. – pengdu Aug 28 '13 at 02:51