본문 바로가기

잡부생활

네트워크 상태 확인(mtr)


예시) 

mtr -r -c 10 -T -P 80 www.naver.com

mtr -r -c 10 -T -P 80 52.79.111.111

-r : report, -c : count

-T옵션은 icmp echo대신 tcp syn패킷을 보내는 것이다. syn 패킷이 데이터를 포함하지 않기 때문에, 패킷사이즈는 무시된다. 

-P옵션은 port 넘버


mtr이 설치

(1) redhat계열(redhat, centos, amazon linux): 

yum install mtr

mtr --version 

0.85버전 이하라면 아래 명령어 실행.

wget ftp://fr2.rpmfind.net/linux/centos/7.2.1511/os/x86_64/Packages/mtr-0.85-7.el7.x86_64.rpm

rpm -Uvh mtr-0.85-7.el7.x86_64.rpm


(2) deiban계열(ubuntu, debian): 

apt-get install mtr

mtr --version

0.85버전 이하라면 아래 명령어 실행.

wget https://launchpad.net/ubuntu/+archive/primary/+files/mtr_0.85.orig.tar.gz

gzip -d mtr_0.85.orig.tar.gz

tar xvf mtr_0.85.orig.tar


(3) window계열: 

http://winmtr.net/download-winmtr/에 접속 후 tool 다운로드.


아래는 curl 명령어로, lookup시간 tcp connect 시간, 파일 전송 시작 시간, 첫 byte가 전송된 시간 등을 체크


curl -s -w '\nLookup time:\t%{time_namelookup}\nConnect time:\t%{time_connect}\nPreXfer time:\t%{time_pretransfer}\nStartXfer time:\t%{time_starttransfer}\n\nTotal time:\t%{time_total}\n' -o /dev/null <ip or dns name>


(실행 결과 값)

Lookup time: 0.029 // The time, in seconds, it took from the start until the name resolving was completed.

Connect time: 0.032 // The time, in seconds, it took from the start until the TCP connect to the remote host (or proxy) was completed.

PreXfer time: 0.032 // The time, in seconds, it took from the start until the file transfer was just about to begin. 

This includes all pre-transfer commands and negotiations that are specific to the particular protocol(s) involved.

StartXfer time: 0.042 // The time, in seconds, it took from the start until the first byte was just about to be transferred. 

This includes time_pretransfer and also the time the server needed to calculate the result.

Total time: 0.057 // The total time, in seconds, that the full operation lasted. The time will be displayed with millisecond resolution.