TFTP(Trival FTP) + 실습

2025. 1. 25. 22:29AWS Cloud School 8기

✅ TFTP(Trival FTP)

  • Trival: 사소한
  • 간단한 파일을 신뢰성 없이 일방적으로 전송할 때 사용
  • UDP
  • 포트: 69
  • tftp 관련 디렉터리: /var/lib/tftpboot

 

🧪 TFTP 실습

1️⃣ TFTP Server

1. VM 생성

  • hostname: tftp-server
  • Network: VMnet8
  • IP: 211.183.3.69
  • GW: 211.183.3.2

✔️ 기본 설정

더보기

1. firewalld 비활성화 & Selinux 제거

systemctl stop firewalld & systemctl disable --now firewalld & sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config

 

2. yum repo 추가

cat <<EOF > /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=https://vault.centos.org/7.9.2009/os/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=https://vault.centos.org/7.9.2009/updates/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=https://vault.centos.org/7.9.2009/extras/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=https://vault.centos.org/7.9.2009/centosplus/x86_64/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra
baseurl=https://vault.centos.org/7.9.2009/contrib/x86_64/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
EOF


4. reboot

reboot

 

2. TFTP 서버 패키지 설치

yum install -y tftp-server

 

 

3. TFTP 서버 활성화

systemctl restart tftp
systemctl enable tftp

 

 

4. TFTP 서버 설정 변경

  • server_args: TFTP 서버의 루트 디렉터리
  • disable = yes → disable = no 로 변경
  • 사실, 안바꿔줘도 되지만 문제가 발생할까봐
vi /etc/xinetd.d/tftp

 

5. TFTP 서버 재시작

systemctl restart tftp

 

 

6. TFTP 테스트 파일 생성

 echo 'tftp test file' > /var/lib/tftpboot/text.txt

 

 

 

2️⃣ TFTP Client

1. VM 생성

  • hostname: tftp-client
  • Network: VMnet8
  • IP: 211.183.3.70
  • GW: 211.183.3.2

✔️ 기본 설정

더보기

1. firewalld 비활성화 & Selinux 제거

systemctl stop firewalld & systemctl disable --now firewalld & sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config

 

2. yum repo 추가

cat <<EOF > /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=https://vault.centos.org/7.9.2009/os/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=https://vault.centos.org/7.9.2009/updates/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=https://vault.centos.org/7.9.2009/extras/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=https://vault.centos.org/7.9.2009/centosplus/x86_64/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra
baseurl=https://vault.centos.org/7.9.2009/contrib/x86_64/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
EOF


4. reboot

reboot

 

2. TFTP 클라이언트용 설치

yum install -y tftp

 

 

3. TFTP Server 접속

tftp 211.183.3.69
  • 접속시: 세션 연결 X (로그인하지 않음)

 

 

4. 파일 확인

  • dir 명령어가 없음!!!
  • 확인하는 방법: get 하고 [Tab] 버튼으로 파일들 확인 가능

 

 

5. 파일 다운로드

tftp > get text.txt

  • 성공적으로 받았다는 내용도 없음.. (신뢰성 정말 떨어진다..)

 

6. 파일 확인

ls ~
cat ~/text.txt

 

 

 

⚠️ TFTP는 신뢰성이 없기 때문에 꼭 파일의 내용까지 확인하는 것이 좋다.

  • TFTP 서버에서 방화벽을 활성화 한 후,
  • TFTP Client의 ttest.txt를 삭제하고 다시 get을 해보면
  • 파일을 받아오지만 내용을 보면 아무 내용도 없음을 확인할 수 있다.