1. 터널링 사용하지 않는 경우
Host {{별명}}
HostName {{Public_IPv4_주소}}
User {{접속_사용자명}}
IdentityFile {{SSH_키_파일_경로}}
예시
Host test
HostName 12.345.67.89
User ubuntu
IdentityFile C:\\Users\\username\\.ssh\\key.pem
2. SSH 터널링(Bastion Host)
- 참고:
ForwardAgent
옵션은 원격 호스트에서도 로컬 호스트의 개인키를 사용할 수 있게 전달하는 옵션으로,
없어도 된다.
Host {{별명}}
HostName {{Private_IPv4_주소}}
User {{접속_사용자명}}
ForwardAgent yes
IdentityFile {{SSH_키_파일_경로}}
ProxyCommand ssh -W %h:%p {{Bastion_host_사용자명}}@{{Bastion_Host_Public_IPv4}} -p {{접속_포트번호}} -i "{{Bastion_Host_SSH_키_파일_경로}}"
예시
Host test02
HostName 12.3.456.789
User ubuntu
ForwardAgent yes
IdentityFile C:\\Users\\username\\.ssh\\key1.pem
ProxyCommand ssh -W %h:%p [email protected] -p 22 -i "C:\\Users\\username\\.ssh\\_bastion-keypair.pem"
참고
- config 파일의 ProxyCommand에서
ssh
명령어를 인식하지 못할 경우
- 환경변수 path에 ssh.exe 경로 등록
- 혹은
C:\\Windows\\System32\\OpenSSH\\ssh.exe -W %h:%p
처럼 ssh 실행파일 경로 직접 지정