簡體   English   中英

SSH 端口轉發 google 計算引擎

[英]Ssh port forwarding google compute engine

我正在嘗試使用 google 實例轉發流量,但沒有運氣。 這是場景:我目前有 2 個實例主服務器和 mini-server-1 我想從主服務器 ssh mini-server-1 並創建一個動態端口轉發,如下所示:

gcloud 計算 ssh "mini-server-1" --zone="us-central1-f" --ssh-flag="-D:5551" --ssh-flag="-N" --ssh-flag=" -n" &

我有這個錯誤:

綁定:無法分配請求的地址

我試過: ssh -N username@mini-server-1(all ips internal external, hostname) -D 5551 &<\/code>

當我運行 netstat 時,我可以看到端口是空閑的。 這是帶有來自主服務器的代理的 wget

wget google.com -e use_proxy=yes -e http_proxy=127.0.0.1:5551

連接到 127.0.0.1:5551... 已連接。
已發送代理請求,等待響應...

有人知道我怎么能做到這一點?

運行帶有debug標志的命令以幫助您找到更多信息:

gcloud compute ssh --ssh-flag=-vvv "mini-server-1" \
                   --zone="us-central1-f" \
                   --ssh-flag="-D:5551" \
                   --ssh-flag="-N" \
                   --ssh-flag="-n" &

就像我之前評論中提到的那樣,請使用https_proxy。

簡單得多的語法:

gcloud compute ssh my-vm-name --zone=europe-west1-b -- -NL 4000:localhost:4000

您可以根據需要傳遞任意多個選項:

-NL 8080:localhost:80 -NL 8443:localhost:443
gcloud compute  ssh --ssh-flag="-L 2222:localhost:8080"  --zone "us-central1-a" "your_instance_name"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM