October 03, 2013

Accessing xSeries IMM indirectly via SOCKS

If you need to connect to 192.168.70.25 IMM (Integrated Management Module) and you have no direct connection to this IP, but to one of the servers from the network where IMM is reachable.

1. Establish Reverse Proxy to one of the server from the network where IMM is reachable

$ ssh -D3008 -N user@18.1.35.107

2. Add IMM IP as virtual to your current network interface in use (e.g. wlan0)

# IP="192.168.70.25"
# ifconfig wlan0 add $IP
(seems is only optional) #echo "$IP     IMM-HOSTNAME" >> /etc/hosts

3. Establish port forwarding (via the proxy) from original source (IMM) to your virtual IP (which is set over wlan0 now)

# ncat -k -l $IP 80 --sh-exec "ncat -v --proxy-type socks4 --proxy 127.0.0.1:3008 $IP 80" &
# ncat -k -l $IP 3900 --sh-exec "ncat -v --proxy-type socks4 --proxy 127.0.0.1:3008 $IP 3900" &

# ps -ef|grep -w $IP |grep -v grep
root       454 31406  0 10:15 pts/12   00:00:00 ncat -k -l 192.168.70.25 3900 --sh-exec ncat -v --proxy-type socks4 --proxy 127.0.0.1:3008 192.168.70.25 3900
root     32758 31406  0 10:15 pts/12   00:00:00 ncat -k -l 192.168.70.25 80 --sh-exec ncat -v --proxy-type socks4 --proxy 127.0.0.1:3008 192.168.70.25 80

Now you can access IMM via your browser -> http://192.168.70.25/ ; Remote Control (KVM) also works fine.

In case of problems, troubleshoot tcpdump in order to determine necessary ports to be forwarded

# tcpdump -vvv -en -i wlan0 > wlan0.tcpdump

For other ports check http://www.redbooks.ibm.com/abstracts/tips0511.html

Rollback

# ps -ef|grep -w $IP |grep -v grep |awk '{print $2}' |xargs kill
# ifconfig wlan0 del $IP

Remove $IP from /etc/hosts