
일반적인 맥락:
여러 개의 LXD 컨테이너가 있고 상단에 HAPROXY가 있어 주어진 URL과 관련된 좋은 컨테이너로 트래픽을 리디렉션하는 서버가 있습니다.
뾰족한 컨테이너는 gitlab입니다.
메인 서버
포트 22가 열려 있습니다.
server# iptables -L -n |grep 22
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
server# netstat -plnt | grep 22
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2536/sshd
tcp6 0 0 :::22 :::* LISTEN 2536/sshd
Gitlab 서버 구성
gitlab# cat /etc/hosts
127.0.0.1 gitlab.pub-domain.com gitlab
127.0.0.1 localhost
127.0.1.1 s-302-gitlab # machine name
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
gitlab# cat /etc/resolv.conf
search pub-domain.com
search priv-domain.ovh
nameserver 8.8.8.8
# netstat -tulpn | grep 22
tcp 0 0 127.0.0.1:9229 0.0.0.0:* LISTEN 583/gitlab-workhors
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 5094/sshd
tcp6 0 0 :::22 :::* LISTEN 5094/ssh
모든 것을 핑해 보세요
gitlab 컨테이너에서 실행되어 작동합니다.
gitlab# # ssh -T https://[email protected]
https://[email protected]'s password:
gitlab# ssh -T https://[email protected]
https://[email protected]'s password:
이제 다른 머신(간단하게 하기 위해 서버라고 가정)으로 이동하여 ping을 실행합니다.
server# ping pub-domain.com
PING pub-domain.com (31.7.xx.yy) 56(84) bytes of data.
64 bytes from 31.7.xx.yy (31.7.xx.yy): icmp_seq=1 ttl=64 time=0.588 ms
--- pub-domain.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
server# ping gitlab.pub-domain.com
PING pub-domain.com (31.7.xx.yy) 56(84) bytes of data.
64 bytes from 31.7.xx.yy (31.7.xx.yy): icmp_seq=1 ttl=64 time=0.588 ms
--- pub-domain.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
SSH
server# ssh git@s-302-gitlab
ssh: connect to host s-302-gitlab port 22: Connection refused
server# ssh -T https://[email protected]
ssh: connect to host gitlab.pub-domain.com port 22: Connection refused
server# ssh -T [email protected]
The authenticity of host '192.168.3.200 (192.168.3.200)' can't be established.
ECDSA key fingerprint is SHA256:Pe2vY/8GyG3o6ZkDErTN8Ko+k9veJA9S4wnHvQXSYJk.
Are you sure you want to continue connecting (yes/no)?
왜 도메인/URL이 아닌 IP로만 연결할 수 있는지 아시나요?
댓글에 응답하기
# dig +short s-302-gitlab
# dig +short gitlab.pub-domain.com
pub-domain.com.
31.7.xx.yy
감사해요,