cp -arp /etc/openvpn/server.conf /etc/openvpn/server.conf_ori
vi /etc/openvpn/server.conf
===
# 주석 ';' 해제 또는 추가 작성
client-config-dir /etc/openvpn/ccd
# 서버가 사용하는 사설 대역 확인
server 10.8.0.0 255.255.255.0
===
# 디렉터리 생성 및 권한 설정
mkdir -p /etc/openvpn/ccd && chmod 755 /etc/openvpn/ccd && cd /etc/openvpn/ccd
# client 인증서 CN 이름과 같은 파일을 하단에 생성 후 static ip 값 부여
echo 'ifconfig-push 10.8.0.2 10.8.0.3' > /etc/openvpn/ccd/CN_값
단, 윈도우 client의 경우 Subnetmask 값을 30비트로 변경해주어야 합니다.
vi /etc/openvpn/ccd/CN_값
===
server 10.8.0.0 255.255.255.252
ifconfig-push 10.8.0.5 10.8.0.6
===
30비트로 쪼개었으니 4개의 자원을 소모합니다.
위 작업 없이 static IP만 할당하게 되면 아래 에러가 발생합니다.
2025-01-07 10:00:01 There is a problem in your selection of --ifconfig endpoints [local=10.8.0.4, remote=10.8.0.5]. The local and remote VPN endpoints cannot use the first or last address within a given 255.255.255.252 subnet. This is a limitation of --dev tun when used with the TAP-WIN32 driver. Try 'openvpn --show-valid-subnets' option for more info.
2025-01-07 10:00:01 Exiting due to fatal error
openssl x509 -in /인증서경로/파일명.crt -text -noout | grep Subject:
===
Subject: CN = CN_값
===
첫 번째 값은 연결한 Client가 가지는 Static IP, 두 번째 값은 서버가 클라이언트와의 링크에서 사용하는 IP로 점대점 통신을 위한 IP 입니다.
OpenVPN은 TUN 인터페이스를 기반으로 가상 점대점(Point-to-Point) 네트워크를 설정하므로, 클라이언트와 서버 간의 논리적인 경로를 만들기 위해 항상 두 개의 IP를 사용합니다.
systemctl restart openvpn@server
ipp.txt 파일은 서버가 동적 IP 할당을 기록하여 다음 연결 시 동일한 IP를 할당하도록 돕는 역할을 합니다.
단, opvn 파일 내 선언된 부분이나 ipp.txt 파일보다도 ccd 설정이 우선순위를 가집니다.
vi /etc/openvpn/openvpn-status.log