almost 8 years ago
The follow will simply describe how to use ssh tunnels and what needs to notice something when connecting to Esxi server.
Esxi client 連線的port為443與902,故需在本機端上與白名單IP建立tunnel,再使其連線到目的端(Esxi Server)。
- 以下介紹將假設 Esxi Server IP為 10.0.0.1,白名單機器IP為140.113.0.1。
- 需注視事項為,因VMware vsphere 是不能以127.0.0.1 或 localhost當作連線主機,故需要修改hosts做dns對應,只要不是"127.0.0.1 或 localhost" 即可。
- 如本機端上443或902已成為listening port,可能無法使用以下方法,請關閉其執行程式(通常會被本機端的VMware workstation 占用)。
-
白名單機器必須安裝sshd,也就是ssh的服務端。
- (因白名單機器可以是任何平台,在這不細說sshd。只舉例ubuntu 12.04 lts安裝方式)
ubuntu 12.04 lts sudo apt-get install openssh-server sudo /etc/init.d/ssh start
- (因白名單機器可以是任何平台,在這不細說sshd。只舉例ubuntu 12.04 lts安裝方式)
-
Use putty or Use command line
-
Putty
輸入主機與port
輸入兩個tunnel並add
最後open,輸入您的帳號密碼即可建立tunnel -
Command line(windows 需要安裝程式,內建並沒支援,這裡使用的是cygwin,請自行參考其他教學)
Usage: ssh -L [localhost port]:(server IP or domain):remote port(server port) -p [white server port] -l [username] # ssh -L 443:10.0.0.1:443 -L 902:10.0.0.1:902 140.113.0.1 -l username //port不打,預設22 # password: (type your passwd)
-
Putty
-
更改hosts
C:\Windows\System32\drivers\etc\hosts
-
這檔案是用來管理static dns其對應的IP,可能會有權限等等的問題導致無法更動,可以嘗試再複製一樣的檔案更動完後覆蓋上去。
-
這檔案是用來管理static dns其對應的IP,可能會有權限等等的問題導致無法更動,可以嘗試再複製一樣的檔案更動完後覆蓋上去。
-
使用VMware vsphere 連線
輸入剛剛對印的domain,以及您的帳號密碼即可
- Reference http://freddebostrom.wordpress.com/2009/04/10/ssh-tunnel-from-the-command-line/ http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2051575 http://www.emsperformance.net/2012/09/09/controlling-vmware-esxi-server-from-vsphere-client-via-ssh-tunnel/
-
Article update information
- 2014/8/26 finished
- 2014/8/13 Begin writing this Article.