1. 개요
집에서 사용하는 라즈베리파이의 특정 포트를 외부 도메인과 연결을 하여 SSL로 서비스 할 필요가 있었다.
이에 SSL 서비스를 위해 클라우드플레어랑 연동을 했고 우리집 IP는 유동적으로 변하기에 DDNS도 설정할 필요가 있어 그 과정을 작성해본다.
2. DDclient 설치
DDclient는 아래 URL에서 다운로드 받을 수 있다.
https://github.com/ddclient/ddclient
하지만 나는 아래와 같이 패키지 설치로 설치하였다.
$ apt-get install ddclinet
3. DDclient 설정
설정 파일은 /etc/ddclient.conf에 위치해 있고 파일 내용은 다음과 같다.
# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf
protocol=cloudflare
use=web, web=https://api.ipify.org/
login=클라우드플레어 ID
password=클라우드플레어 Global API Key
zone=도메인주소(예시:jjoon.net)
연결할 서브도메인 주소(예시:test.jjoon.net)
4. 공유기 포트포워딩 설정
라즈베리파이의 특정 포트를 80번 포트로 포트포워딩을 하도록 설정한다.
5. 정상동작 확인
DDclient는 아래와 같이 서비스로 돌아가는 것을 확인할 수 있으며 300초마다 IP를 갱신할것이다.
pi@raspberrypi:/etc $ sudo systemctl status ddclient.service
● ddclient.service - Update dynamic domain name service entries
Loaded: loaded (/lib/systemd/system/ddclient.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2023-02-03 00:14:28 KST; 20min ago
Docs: man:ddclient(8)
Process: 28053 ExecStart=/usr/sbin/ddclient -daemon $daemon_interval -syslog -pid /run/ddclient.pid (code=exited, status=0/SUCCESS)
Main PID: 28054 (ddclient - slee)
Tasks: 1 (limit: 779)
CPU: 1.251s
CGroup: /system.slice/ddclient.service
└─28054 ddclient - sleeping for 280 seconds
Feb 03 00:14:27 raspberrypi systemd[1]: Starting Update dynamic domain name service entries...
Feb 03 00:14:28 raspberrypi systemd[1]: Started Update dynamic domain name service entries.
Feb 03 00:29:34 raspberrypi ddclient[28422]: SUCCESS: ****.jjoon.net -- Updated Successfully to ***.***.***.***
pi@raspberrypi:/etc $
클라우드플레어 DNS 메뉴에서 서브 도메인이 현재 IP를 제대로 반영되고 있는지 확인하면 끝.