แก้ปัญหา SSH VSCode ขึ้น Could not establish connection to host domain

เคสนี้ผมเจอจากการใช้งานโปรแกรม VScode ใช้ Extension SSH เพื่อ Remote ไปสั่งงานเครื่อง server ที่ port 22

image

เวลาที่เราเข้าไปตั้งค่าที่ .ssh>config หน้าตาก็จะเป็นแบบนี้

Host example1.com
  HostName example1.com
  User root

Host example2.com
  HostName example2.com
  User root

แต่มันน่าประหลาดต้องที่ example2.com สามารถเข้าได้ แต่ example1.com เข้าไม่ได้แต่ถ้าใช้ putty ที่เป็น ssh อีกตัวจะเข้าได้ปกติ ก็เลยงงๆ แบบนี้

Could not establish connection

ลองแอดใน remote platform ก็ยังเหมือนเดิม

Could not establish connection to host

สรุปไปจบที่เปลี่ยนจาก HostName example2.com ไปแทนด้วยเลขไอพีของ server ปลายทางแทนแบบนี้

HostName 192.168.1.222

ก็เป็นอันใช้ได้.