리눅스 포트, 방화벽 확인 - linugseu poteu, banghwabyeog hwag-in

This Is A Custom Widget

This Sliding Bar can be switched on or off in theme options, and can take any widget you throw at it or even fill it with your custom HTML Code. Its perfect for grabbing the attention of your viewers. Choose between 1, 2, 3 or 4 columns, set the background color, widget divider color, activate transparency, a top border or fully disable it on desktop and mobile.

This Is A Custom Widget

This Sliding Bar can be switched on or off in theme options, and can take any widget you throw at it or even fill it with your custom HTML Code. Its perfect for grabbing the attention of your viewers. Choose between 1, 2, 3 or 4 columns, set the background color, widget divider color, activate transparency, a top border or fully disable it on desktop and mobile.

안녕하세요. YeopBox의 상큼한놈 입니다.

프로그래머로써 일하다 보면 고객사나 타 회사에서 업무를 진행하는 경우가 생깁니다.

이때, 프로젝트를 진행하기 위하여 방문하기 전 방화벽 오픈을 요청하여 네트워크 담당자의 방화벽 오픈이 완료 됨을 확인 후 방문하게 됩니다.

하지만 네트워크 담당자 또한 사람인지라 방화벽 오픈이 진행되지 않은 경우가 종종 있는데요,

방화벽 오픈을 사전 확인하는 방법에 대하여 알아보겠습니다.

1. telnet이 설치되어 있는 경우

telnet이 설치되어 있는 경우 터미널에서 아래와 같이 telnet [ip주소] [포트] 로 확인 가능합니다.

▶︎ 방화벽이 정상적으로 오픈된 경우

리눅스 포트, 방화벽 확인 - linugseu poteu, banghwabyeog hwag-in

확인 후 ‘Alt+]’ 혹은 ‘Ctrl+C’를 통하여 telnet을 종료하실 수 있습니다.

▶︎ 방화벽 혹은 기타 네트워크 사유로 접속되지 않는 경우

리눅스 포트, 방화벽 확인 - linugseu poteu, banghwabyeog hwag-in

2. telnet이 설치되어 있지 않은 경우

telnet이 설치되어 있지 않은 경우 마음 편하게 설치를 한다면 좋겠지만, 고객사에 방문하는 입장으로 설치는 불가능에 가깝습니다.

이 경우 bash에서 제공하는 built-in 기능을 이용하여 대부분의 리눅스 서버에서 확인 하실 수 있습니다.

터미널에서 아래와 같이 echo > /dev/tcp/[ip주소]/[포트] 로 확인 가능합니다.

echo>/dev/tcp/127.0.0.1/3306

▶︎ 방화벽이 정상적으로 오픈된 경우

리눅스 포트, 방화벽 확인 - linugseu poteu, banghwabyeog hwag-in

▶︎ 방화벽 혹은 기타 네트워크 사유로 접속되지 않는 경우

리눅스 포트, 방화벽 확인 - linugseu poteu, banghwabyeog hwag-in

지금까지 리눅스에서 방화벽 오픈 확인 방법에 대하여 알아보았습니다.

2번째 방법의 경우 특정 상황에서 굉장히 요긴하게 사용됨으로 이런 방법이 있다 정도만 기억해 두시면 추후 실 상황에서 유용하게 이용할 수 있을 겁니다.

감사합니다.

1. 열려 있는 모든 포트 확인하기

$ netstat -nap

-n : host명으로 표시 안함

-a : 모든소켓 표시

-p : 프로세스ID와 프로그램명 표시

2. 열려 있는 포트 중 LISTENING 상태인 것만 확인하기

$ netstat -nap | grep LISTEN

3. 특정 호스트의 특정 포트가 열려 있는지 확인하기

방법 1.

$ nc -z 211.***.***.*** 9200

-z : port번호

- 연결 성공 시 (열려있음)

Connection to 211.***.***.*** 9200 port [tcp/wap-wsp] succeeded!

- 연결 실패 시 (닫혀있음)

아무 응답메세지 없음

방법 2.

$ telnet 211.42.150.220 9200

- 연결 성공 시 (열려있음)

Trying 211.42.150.220...

Connected to 211.42.150.220 (211.42.150.220).

Escape character is '^]'.

- 연결 실패 시 (닫혀있음)

Trying 211.42.150.220...

telnet: connect to address 211.42.150.220: Connection refused

telnet: Unable to connect to remote host: Connection refused

4. 특정 호스트의 지정 범위 포트가 열려 있는지 확인하기

$ nc -z 211.***.***.*** 19-5000

Connection to 211.***.***.*** 21 port [tcp/ftp] succeeded!

Connection to 211.***.***.*** 22 port [tcp/ssh] succeeded!

Connection to 211.***.***.*** 111 port [tcp/sunrpc] succeeded!

Connection to 211.***.***.*** 514 port [tcp/shell] succeeded!

Connection to 211.***.***.*** 641 port [tcp/repcmd] succeeded!

Connection to 211.***.***.*** 669 port [tcp/meregister] succeeded!

Connection to 211.***.***.*** 711 port [tcp/cisco-tdp] succeeded!

Connection to 211.***.***.*** 2049 port [tcp/nfs] succeeded!

Connection to 211.***.***.*** 3690 port [tcp/svn] succeeded!