728x90
반응형

Route53 Hybrid DNS

1. VPC 생성

- cloud: 10.0.0.0/16

- onprem: 192.168.0.0/16

- subnets, route tables, nat gateways 생성

2. 인스턴스 생성

cloud-app-server

- sg: ssh anywhere, icmp 192.168.0.0/16

onprem-app-server

- sg: ssh 192.168.0.0/16, icmp 10.0.0.0/16

onprem-vpn-server

- sg: ssh anywhere, dns (udp) 192.168.0.0/16, icmp 192.168.0.0/16

3. VPN 설정

1) Virtual private gateway (cloud-vgw)

2) Customer gateways (onprem-cgw) - onprem-vpn-server의 public IP address (Specify the IP address for your customer gateway device's external interface.)

3) VGW - attach to VPC: cloud-vpc

4) Site-to-Site VPN connections (cloud-onprem-vpn-connection)

- Routing options: Static

- Static IP prefixes: 192.168.0.0/16 (onprem-vpn range)

5) download VPN connections configurations - Platform: Openswan

4. SSH 접속

brew install putty
putty

Auth - Credentials - keypair.pem 경로

Session - Saved Sessions

IP: onprem-vpn-server's public IP

login as: ec2-user

ssh -i "ap-south-1-keypair.pem" ec2-user@35.x.x.x
 % sudo su
sh-3.2# ssh -i "ap-south-1-keypair.pem" ec2-user@35.154.187.78
The authenticity of host '35.x.x.x (35.x.x.x)' can't be established.
ED25519 key fingerprint is SHA256:qOx9yHXTxD6xaC9BfiT/Y5/82Ml/mVZzr5hNXnw9FQ8.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '35.x.x.x' (ED25519) to the list of known hosts.
   ,     #_
   ~\_  ####_        Amazon Linux 2023
  ~~  \_#####\
  ~~     \###|
  ~~       \#/ ___   https://aws.amazon.com/linux/amazon-linux-2023
   ~~       V~' '->
    ~~~         /
      ~~._.   _/
         _/ _/
       _/m/'
[ec2-user@ip-192-168-0-220 ~]$
sudo yum install libreswan
sudo vi /etc/sysctl.conf

1) Open /etc/sysctl.conf and ensure that its values match the following:
   net.ipv4.ip_forward = 1
   net.ipv4.conf.default.rp_filter = 0
   net.ipv4.conf.default.accept_source_route = 0

2) Apply the changes in step 1 by executing the command 'sysctl -p'

sudo sysctl -p

3) Open /etc/ipsec.conf and look for the line below. Ensure that the # in front of the line has been removed, then save and exit the file.
    #include /etc/ipsec.d/*.conf

이미 제거된 상태로 저장됨

cat /etc/ipsec.conf

4) Create a new file at /etc/ipsec.d/aws.conf if doesn't already exist, and then open it. Append the following configuration to the end in the file:
 #leftsubnet= is the local network behind your openswan server, and you will need to replace the <LOCAL NETWORK> below with this value (don't include the brackets). If you have multiple subnets, you can use 0.0.0.0/0 instead.
 #rightsubnet= is the remote network on the other side of your VPN tunnel that you wish to have connectivity with, and you will need to replace <REMOTE NETWORK> with this value (don't include brackets).

conn Tunnel1
authby=secret
auto=start
left=%defaultroute
leftid=35.x.x.x
right=13.x.x.x
type=tunnel
ikelifetime=8h
keylife=1h
phase2alg=aes128-sha1;modp1024
ike=aes128-sha1;modp1024
auth=esp
keyingtries=%forever
keyexchange=ike
leftsubnet=<LOCAL NETWORK>
rightsubnet=<REMOTE NETWORK>
dpddelay=10
dpdtimeout=30
dpdaction=restart_by_peer

sudo vi /etc/ipsec.d/aws.conf
conn Tunnel1
        authby=secret
        auto=start
        left=%defaultroute
        leftid=35.x.x.x
        right=13.x.x.x
        type=tunnel
        ikelifetime=8h
        keylife=1h
        phase2alg=aes256-sha1;modp2048
        ike=aes256-sha1;modp2048
        keyingtries=%forever
        keyexchange=ike
        leftsubnet=192.168.0.0/16
        rightsubnet=10.0.0.0/16
        dpddelay=10
        dpdtimeout=30
        dpdaction=restart_by_peer

5) Create a new file at /etc/ipsec.d/aws.secrets if it doesn't already exist, and append this line to the file (be mindful of the spacing!):
35.x.x.x 13.x.x.x: PSK "TOC3RK--------------------IUtns"

sudo vi /etc/ipsec.d/aws.secrets

Tunnel 1 구성 완료

sudo systemctl start ipsec.service
sudo systemctl status ipsec.service

5. Route Tables 설정 (propagation)

cloud-vpc-private-rt > Route propagation > Propagation: Enable

또는 Routes 편집 (cloud-vgw)

cloud-vpc-public-rt도 동일하게 설정

6. VPN 서버의 목적지 비활성화

Instances: onprem-vpn-server > Actions - Networking - Change Source / destination check > check Stop > Save

Route tables: cloud-vpc-public-rt > 10.0.0.0/16 instance (onprem-vpn-server)

7. Cloud Instance 접속

cloud-app-server public IP

ssh -i "ap-south-1-keypair.pem" ec2-user@3.x.x.x

 

ping (onprem-app-server)

 

From Cloud EC2 instance - Ping to on-premises App server private IP

Cloud EC2 -> VGW -> VPN Tunnel 1 -> VPN server -> App server

 

728x90
728x90
728x90
반응형

virtual private network는 공용 인터넷을 통해 가상의 사설 네트워크를 구성해서 프라이빗 통신을 제공함

AWS에서 제공하는 관리형 VPN 서비스: site-to-site VPN, 클라이언트 VPN

Site-to-Site VPN

Site-to-Site VPN은 서로 다른 지리적 위치에 있는 두 네트워크 간에 안전한 연결을 생성한다. 이는 주로 기업 환경에서 사용되며, 두 사이트의 네트워크가 마치 같은 로컬 네트워크 내에 있는 것처럼 통신할 수 있게 해준다.

예를 들어, 본사의 네트워크와 지사의 네트워크를 연결하여 자원을 공유할 수 있다. Site-to-Site VPN은 일반적으로 라우터나 게이트웨이 장치에 구성되며, 모든 트래픽은 이 장치들을 통해 자동으로 암호화되어 전송된다.

클라이언트 VPN (Remote Access VPN)

클라이언트 VPN, 또는 Remote Access VPN은 개별 사용자가 원격 위치에서 기업 네트워크에 안전하게 접속할 수 있게 해주는 기술이다. 사용자는 VPN 클라이언트 소프트웨어를 사용하여 인터넷을 통해 기업의 VPN 서버에 연결하고, 인증 후 네트워크 리소스에 접근할 수 있다. (e.g., 재택 근무나 출장 중인 직원들이 회사의 시스템이나 데이터베이스에 안전하게 접속해야 할 때)

차이점

  • 적용 범위: Site-to-Site VPN - 전체 네트워크 간의 연결, 클라이언트 VPN - 개별 사용자가 네트워크에 원격 접속 시 사용
  • 구성: Site-to-Site VPN은 네트워크 경계에 위치한 장비에 구성되는 반면, 클라이언트 VPN은 사용자의 장치에 VPN 클라이언트 소프트웨어를 설치하여 사용한다.
  • 사용 사례: Site-to-Site VPN은 기업의 다른 위치에 있는 사무실들을 연결하는 데 주로 사용되고, 클라이언트 VPN은 개별 사용자가 어디에서든 안전하게 회사 네트워크에 접속해야 할 때 사용된다.

VPN 유형 모두 데이터의 보안과 프라이버시를 보장하는 중요한 도구이며, 사용 사례에 따라 적절한 유형을 선택하여 사용할 있다.

 

VPN, Virtual Private Cloud: 독립된 가상의 클라우드 네트워크 AWS 클라우드 내 논리적으로 독립된 섹션을 제공하여, 사용자가 정의한 가상 네트워크상에서 다양한 AWS 리소스를 실행할 수 있게 지원 인스턴스와 서브넷 레벨에서 인바운드/아웃바운드 필터링을 수행할 수 있도록 보안 그룹과 네트워크 ACL을 제공해서 보안을 강화할 수 있음

사용자 생성 VPC에서 AWS 퍼블릭 서비스나 다른 VPC로 통신이 필요할 경우 일반적으로 외부 인터넷 구간인 퍼블릭 네트워크를 통해 통신이 이루어짐 → 격리된 프라이빗 서브넷에 자원이 생성되어야 함 (금융 서비스처럼 강력한 보안 요건을 만족하기 위해)

VPC 엔드포인트: AWS 퍼블릭 서비스나 직접적으로 생성한 AWS 서비스에 대해 외부 인터넷 구간을 통한 접근이 아닌 직접적으로 접근할 수 있는 프라이빗 액세스 기능

엔드포인트: AWS 퍼블릭 서비스 대상에 대한 프라이빗 연결

  • 게이트웨이 엔드포인트: AWS 퍼블릭 서비스 중 S3와 DynamoDB에 대한 연결
  • 인터페이스 엔드포인트: 위 대상 외에 나머지 AWS 퍼블릭 서비스에 대한 연결 엔드포인트 서비스: 사용자가 지정한 서비스 대상에 대한 프라이빗 연결

 

728x90
728x90

+ Recent posts