Tất cả tài liệu

VPN Site-to-Site

    Cấu hình VPN Site-to-Site với Vyos 1.5
    Cấu hình VPN Site-to-Site với Vyos 1.5
    Updated on 05 May 2025

    Bài viết này hướng dẫn build Vyos để đấu nối VPN_S2S với dịch vụ VPN Site-to-Site của FPT Smart Cloud.

    Cần đảm bảo các điều kiện sau:

    • VPNAAS trên trang Portal
    • Vyos 1.5 đã được download và boot image trên cloud với tên: Vyos 1.5
    • Public IP, giảm độ phức tạp thì gắn trực tiếp vào VM, không dùng Floating IP
    • 1 VM Pfsense để phục vụ debug( Optional )

    Bước 1: Build Vyos1.5 for Cloud

    • Trên Horizon ta tiến hành tạo VM từ image với các thông số keypair của user và network provider {`IP PUBLIC`} bất kì.

    Bước 2: Cấu hình cho VPN Site-to-Site

    Truy cập và tạo VPN Site To Site trên trang https://console.fptcloud.com/

    - Tạo IPSec policy: file - Tạo IKE policy: file - Tạo Customer Gateway:

    • Remote private network: dãy Lan Subnet cần peering của Vyos

    • Remote IP public: IP public của Vyos file - Tạo VPN Connection:

    Với thông số "Pre-shared key" cần lưu lại để điền vào Vyos: file

    Bước 3: Cấu hình cho Vyos

    - Đăng nhập ssh vào Vyos theo key đã tạo trên

    - Đăng nhập ssh theo địa chỉ IP: {`IP PUBLIC`} với user là: "vyos" . Minh họa: ssh vyos@{`IP PUBLIC`}

    Chạy các lệnh sau( thay các tham số vào):

    configure
    set interfaces ethernet eth0 address '{`IP Public Vyos`}'
    set interfaces ethernet eth1 vif 111 address '{`IP LAN Vyos`}/24'
    set protocols static route 0.0.0.0/0 next-hop {`IP-Remote`}
    set vpn ipsec authentication psk RIGHT id '{`IP Public Vyos`}'
    set vpn ipsec authentication psk RIGHT id {`IP-Remote`}
    set vpn ipsec authentication psk RIGHT secret ' {`Pre-Share-Key`}'
    set vpn ipsec esp-group ESP-GROUP mode 'tunnel'
    set vpn ipsec esp-group ESP-GROUP proposal 1 encryption 'aes256'
    set vpn ipsec esp-group ESP-GROUP proposal 1 hash 'sha256'
    set vpn ipsec ike-group IKE-GROUP key-exchange 'ikev2'
    set vpn ipsec ike-group IKE-GROUP proposal 1 dh-group '14'
    set vpn ipsec ike-group IKE-GROUP proposal 1 encryption 'aes256'
    set vpn ipsec ike-group IKE-GROUP proposal 1 hash 'sha256'
    set vpn ipsec interface 'eth0'
    set vpn ipsec site-to-site peer RIGHT authentication mode 'pre-shared-secret'
    set vpn ipsec site-to-site peer RIGHT connection-type 'initiate'
    set vpn ipsec site-to-site peer RIGHT default-esp-group 'ESP-GROUP'
    set vpn ipsec site-to-site peer RIGHT ike-group 'IKE-GROUP'
    set vpn ipsec site-to-site peer RIGHT local-address '{`IP Public Vyos`}'
    set vpn ipsec site-to-site peer RIGHT remote-address {`IP-Remote`}
    set vpn ipsec site-to-site peer RIGHT tunnel 0 local prefix '{`Sunet LAN Vyos`}/24'
    set vpn ipsec site-to-site peer RIGHT tunnel 0 remote prefix '{`Sunet LAN Remote`}/24'

    Save and commit

    commit
    save