@xdev-asia/xdev-knowledge-mcp 1.0.53 → 1.0.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. package/content/blog/ai/con-duong-tro-thanh-ai-solution-architect.md +826 -0
  2. package/content/pages/ve-toi.md +62 -0
  3. package/content/series/devsecops/vyos-tu-co-ban-den-nang-cao/chapters/01-vyos-tu-co-ban-den-nang-cao/lessons/01-bai-1-gioi-thieu-vyos-va-cai-dat.md +324 -0
  4. package/content/series/devsecops/vyos-tu-co-ban-den-nang-cao/chapters/01-vyos-tu-co-ban-den-nang-cao/lessons/02-bai-2-cau-hinh-interface-va-ip-co-ban.md +324 -0
  5. package/content/series/devsecops/vyos-tu-co-ban-den-nang-cao/chapters/01-vyos-tu-co-ban-den-nang-cao/lessons/03-bai-3-nat-source-nat-destination-nat-va-masquerade.md +321 -0
  6. package/content/series/devsecops/vyos-tu-co-ban-den-nang-cao/chapters/01-vyos-tu-co-ban-den-nang-cao/lessons/04-bai-4-firewall-co-ban-rules-chains-va-groups.md +386 -0
  7. package/content/series/devsecops/vyos-tu-co-ban-den-nang-cao/chapters/01-vyos-tu-co-ban-den-nang-cao/lessons/05-bai-5-zone-based-firewall.md +451 -0
  8. package/content/series/devsecops/vyos-tu-co-ban-den-nang-cao/chapters/01-vyos-tu-co-ban-den-nang-cao/lessons/06-bai-6-dhcp-server-dns-forwarding-va-ntp.md +105 -0
  9. package/content/series/devsecops/vyos-tu-co-ban-den-nang-cao/chapters/01-vyos-tu-co-ban-den-nang-cao/lessons/07-bai-7-vlans-bonding-va-bridge.md +94 -0
  10. package/content/series/devsecops/vyos-tu-co-ban-den-nang-cao/chapters/01-vyos-tu-co-ban-den-nang-cao/lessons/08-bai-8-static-routing-va-policy-based-routing.md +83 -0
  11. package/content/series/devsecops/vyos-tu-co-ban-den-nang-cao/chapters/01-vyos-tu-co-ban-den-nang-cao/lessons/09-bai-9-dynamic-routing-ospf.md +79 -0
  12. package/content/series/devsecops/vyos-tu-co-ban-den-nang-cao/chapters/01-vyos-tu-co-ban-den-nang-cao/lessons/10-bai-10-dynamic-routing-bgp.md +82 -0
  13. package/content/series/devsecops/vyos-tu-co-ban-den-nang-cao/chapters/01-vyos-tu-co-ban-den-nang-cao/lessons/11-bai-11-vpn-wireguard-va-openvpn.md +85 -0
  14. package/content/series/devsecops/vyos-tu-co-ban-den-nang-cao/chapters/01-vyos-tu-co-ban-den-nang-cao/lessons/12-bai-12-vpn-ipsec-site-to-site.md +87 -0
  15. package/content/series/devsecops/vyos-tu-co-ban-den-nang-cao/chapters/01-vyos-tu-co-ban-den-nang-cao/lessons/13-bai-13-high-availability-vrrp-va-conntrack-sync.md +61 -0
  16. package/content/series/devsecops/vyos-tu-co-ban-den-nang-cao/chapters/01-vyos-tu-co-ban-den-nang-cao/lessons/14-bai-14-wan-load-balancing-qos-va-monitoring.md +62 -0
  17. package/content/series/devsecops/vyos-tu-co-ban-den-nang-cao/chapters/01-vyos-tu-co-ban-den-nang-cao/lessons/15-bai-15-containers-automation-va-production-best-practices.md +80 -0
  18. package/content/series/devsecops/vyos-tu-co-ban-den-nang-cao/index.md +410 -0
  19. package/package.json +1 -1
  20. package/content/pages/gioi-thieu.md +0 -23
@@ -0,0 +1,83 @@
1
+ ---
2
+ id: 019d65ef-d36f-773e-bf0a-9e36c62f858f
3
+ title: 'Bài 8: Static Routing và Policy-Based Routing'
4
+ slug: bai-8-static-routing-va-policy-based-routing
5
+ description: >-
6
+ Cấu hình định tuyến tĩnh (Static Routing) và Policy-Based Routing trên VyOS, ví dụ thực tế, lab và tổng kết.
7
+ duration_minutes: 150
8
+ is_free: true
9
+ video_url: null
10
+ sort_order: 8
11
+ section_title: "VyOS từ Cơ bản đến Nâng cao"
12
+ course:
13
+ id: 019d65ef-d36f-773e-bf0a-9e2efc5e19df
14
+ title: VyOS từ Cơ bản đến Nâng Cao
15
+ slug: vyos-tu-co-ban-den-nang-cao
16
+ ---
17
+ <h2>Giới thiệu về Static Routing và Policy-Based Routing trên VyOS</h2>
18
+ <p>Bài học này hướng dẫn cấu hình <strong>Static Routing</strong> (định tuyến tĩnh) và <strong>Policy-Based Routing</strong> (định tuyến theo chính sách) trên VyOS 1.4.x/1.5 rolling release. Đây là các kỹ thuật quan trọng để kiểm soát đường đi của gói tin trong mạng.</p>
19
+
20
+ <h3>1. Định tuyến tĩnh (Static Routing)</h3>
21
+ <p>Static route cho phép chỉ định đường đi cố định cho các mạng đích.</p>
22
+ <pre><code class="language-bash">set protocols static route 10.10.20.0/24 next-hop 192.168.10.2
23
+ set protocols static route 0.0.0.0/0 next-hop 192.168.10.254
24
+ set protocols static route 192.168.30.0/24 blackhole
25
+ </code></pre>
26
+ <ul>
27
+ <li><strong>Failover route với interface health:</strong></li>
28
+ </ul>
29
+ <pre><code class="language-bash">set protocols static route 0.0.0.0/0 next-hop 192.168.10.254
30
+ set protocols static route 0.0.0.0/0 next-hop 192.168.20.254 distance 10
31
+ set protocols static route 0.0.0.0/0 next-hop 192.168.20.254 check-gateway ping
32
+ </code></pre>
33
+
34
+ <h3>2. Policy-Based Routing (PBR)</h3>
35
+ <p>PBR cho phép định tuyến dựa trên nguồn, đích, giao thức hoặc cổng.</p>
36
+ <pre><code class="language-bash">set policy route PBR-OUT rule 10 source address 192.168.10.0/24
37
+ set policy route PBR-OUT rule 10 set table 100
38
+ set interfaces ethernet eth0 policy route PBR-OUT
39
+ set protocols static table 100 route 0.0.0.0/0 next-hop 203.0.113.1
40
+ </code></pre>
41
+ <ul>
42
+ <li><strong>Routing nhiều uplink theo nguồn:</strong></li>
43
+ </ul>
44
+ <pre><code class="language-bash">set policy route MULTI-WAN rule 20 source address 192.168.20.0/24
45
+ set policy route MULTI-WAN rule 20 set table 200
46
+ set protocols static table 200 route 0.0.0.0/0 next-hop 198.51.100.1
47
+ </code></pre>
48
+
49
+ <h3>3. VRF (Virtual Routing and Forwarding) cơ bản</h3>
50
+ <pre><code class="language-bash">set vrf name VRF1 table 10
51
+ set interfaces ethernet eth2 vrf VRF1
52
+ set protocols static table 10 route 0.0.0.0/0 next-hop 10.10.10.2
53
+ </code></pre>
54
+
55
+ <h3>4. Ví dụ thực tế & sơ đồ mạng</h3>
56
+ <pre><code>+-------------------+ +-------------------+
57
+ | VyOS Router |------| ISP1 |
58
+ | 192.168.10.1/24 | | 203.0.113.1 |
59
+ | 192.168.20.1/24 | +------------------+
60
+ +-------------------+ +------------------+
61
+ | |
62
+ LAN, WAN1, WAN2 Internet
63
+ </code></pre>
64
+
65
+ <h3>5. Lab thực hành: Static Routing & PBR</h3>
66
+ <ol>
67
+ <li>Đăng nhập VyOS, xác định các interface và uplink.</li>
68
+ <li>Cấu hình static route, PBR, VRF như trên.</li>
69
+ <li>Commit và save cấu hình:</li>
70
+ </ol>
71
+ <pre><code class="language-bash">commit
72
+ save
73
+ </code></pre>
74
+ <ol start="4">
75
+ <li>Kiểm tra định tuyến:</li>
76
+ </ol>
77
+ <pre><code class="language-bash">show ip route
78
+ show policy route
79
+ show vrf
80
+ </code></pre>
81
+
82
+ <h3>6. Tổng kết</h3>
83
+ <p>Bạn đã biết cách cấu hình định tuyến tĩnh, policy-based routing và VRF trên VyOS, ứng dụng vào các kịch bản đa uplink, phân đoạn mạng và kiểm soát đường đi gói tin.</p>
@@ -0,0 +1,79 @@
1
+ ---
2
+ id: 019d65ef-d36f-773e-bf0a-9e37dfd74e6b
3
+ title: 'Bài 9: Dynamic Routing — OSPF'
4
+ slug: bai-9-dynamic-routing-ospf
5
+ description: >-
6
+ Cấu hình định tuyến động OSPF trên VyOS, lý thuyết, ví dụ thực tế, lab và tổng kết.
7
+ duration_minutes: 170
8
+ is_free: true
9
+ video_url: null
10
+ sort_order: 9
11
+ section_title: "VyOS từ Cơ bản đến Nâng cao"
12
+ course:
13
+ id: 019d65ef-d36f-773e-bf0a-9e2efc5e19df
14
+ title: VyOS từ Cơ bản đến Nâng cao
15
+ slug: vyos-tu-co-ban-den-nang-cao
16
+ ---
17
+ <h2>Giới thiệu về OSPF trên VyOS</h2>
18
+ <p>Bài học này hướng dẫn cấu hình <strong>OSPF</strong> (Open Shortest Path First) trên VyOS 1.4.x/1.5 rolling release. OSPF là giao thức định tuyến động phổ biến trong các hệ thống mạng doanh nghiệp.</p>
19
+
20
+ <h3>1. Kiến thức cơ bản về OSPF</h3>
21
+ <ul>
22
+ <li><strong>Area</strong>: Vùng logic để chia nhỏ mạng OSPF.</li>
23
+ <li><strong>LSA</strong>: Link State Advertisement, các loại LSA (Type 1, 2, 3...)</li>
24
+ <li><strong>Cost</strong>: Trọng số đường đi, ảnh hưởng đến lựa chọn đường.</li>
25
+ <li><strong>SPF</strong>: Thuật toán Dijkstra tính đường đi ngắn nhất.</li>
26
+ </ul>
27
+
28
+ <h3>2. Cấu hình OSPF cơ bản</h3>
29
+ <pre><code class="language-bash">set protocols ospf area 0 network 192.168.10.0/24
30
+ set protocols ospf area 0 network 192.168.20.0/24
31
+ set protocols ospf area 1 network 10.10.10.0/24
32
+ set protocols ospf parameters router-id 1.1.1.1
33
+ set protocols ospf passive-interface eth2
34
+ set protocols ospf redistribute connected
35
+ set protocols ospf redistribute static
36
+ </code></pre>
37
+ <ul>
38
+ <li><strong>OSPF Unnumbered & ECMP:</strong></li>
39
+ </ul>
40
+ <pre><code class="language-bash">set protocols ospf interface eth3 network-type point-to-point
41
+ set protocols ospf parameters ecmp-limit 4
42
+ </code></pre>
43
+
44
+ <h3>3. OSPF Authentication</h3>
45
+ <pre><code class="language-bash">set protocols ospf area 0 authentication md5
46
+ set protocols ospf area 0 authentication-key-id 1 md5-key "VyOSSecret"
47
+ </code></pre>
48
+
49
+ <h3>4. Kiểm tra trạng thái OSPF</h3>
50
+ <pre><code class="language-bash">show ip ospf neighbor
51
+ show ip ospf route
52
+ show ip ospf database
53
+ </code></pre>
54
+
55
+ <h3>5. Sơ đồ mạng ví dụ</h3>
56
+ <pre><code>+---------+ +---------+ +---------+
57
+ | VyOS 1 |-----| VyOS 2 |-----| VyOS 3 |
58
+ | Area 0 | | Area 0 | | Area 1 |
59
+ +---------+ +---------+ +---------+
60
+ </code></pre>
61
+
62
+ <h3>6. Lab thực hành: OSPF Multi-Area</h3>
63
+ <ol>
64
+ <li>Cấu hình OSPF trên 3 router VyOS như sơ đồ.</li>
65
+ <li>Thiết lập area, router-id, network, authentication.</li>
66
+ <li>Commit và save cấu hình:</li>
67
+ </ol>
68
+ <pre><code class="language-bash">commit
69
+ save
70
+ </code></pre>
71
+ <ol start="4">
72
+ <li>Kiểm tra trạng thái OSPF, neighbor, route.</li>
73
+ </ol>
74
+ <pre><code class="language-bash">show ip ospf neighbor
75
+ show ip ospf route
76
+ </code></pre>
77
+
78
+ <h3>7. Tổng kết</h3>
79
+ <p>Bạn đã biết cách cấu hình OSPF trên VyOS, ứng dụng vào các hệ thống mạng doanh nghiệp với nhiều area, authentication và kiểm soát định tuyến động.</p>
@@ -0,0 +1,82 @@
1
+ ---
2
+ id: 019d65ef-d36f-773e-bf0a-9e387917d59e
3
+ title: 'Bài 10: Dynamic Routing — BGP'
4
+ slug: bai-10-dynamic-routing-bgp
5
+ description: >-
6
+ Cấu hình định tuyến động BGP trên VyOS, lý thuyết, ví dụ thực tế, lab và tổng kết.
7
+ duration_minutes: 180
8
+ is_free: true
9
+ video_url: null
10
+ sort_order: 10
11
+ section_title: "VyOS từ Cơ bản đến Nâng cao"
12
+ course:
13
+ id: 019d65ef-d36f-773e-bf0a-9e2efc5e19df
14
+ title: VyOS từ Cơ bản đến Nâng cao
15
+ slug: vyos-tu-co-ban-den-nang-cao
16
+ ---
17
+ <h2>Giới thiệu về BGP trên VyOS</h2>
18
+ <p>Bài học này hướng dẫn cấu hình <strong>BGP</strong> (Border Gateway Protocol) trên VyOS 1.4.x/1.5 rolling release. BGP là giao thức định tuyến động tiêu chuẩn cho các hệ thống mạng lớn, ISP và kết nối đa nhà cung cấp.</p>
19
+
20
+ <h3>1. Kiến thức cơ bản về BGP</h3>
21
+ <ul>
22
+ <li><strong>AS (Autonomous System)</strong>: Hệ thống tự trị.</li>
23
+ <li><strong>iBGP vs eBGP</strong>: iBGP (nội bộ), eBGP (liên kết ngoài).</li>
24
+ <li><strong>Path Selection</strong>: Quy tắc chọn đường đi tốt nhất.</li>
25
+ </ul>
26
+
27
+ <h3>2. Cấu hình BGP cơ bản</h3>
28
+ <pre><code class="language-bash">set protocols bgp 65001 parameters router-id 1.1.1.1
29
+ set protocols bgp 65001 neighbor 2.2.2.2 remote-as 65002
30
+ set protocols bgp 65001 neighbor 2.2.2.2 address-family ipv4-unicast
31
+ set protocols bgp 65001 network 192.168.10.0/24
32
+ set protocols bgp 65001 network 10.10.10.0/24
33
+ </code></pre>
34
+ <ul>
35
+ <li><strong>Route-map, prefix-list, AS-path:</strong></li>
36
+ </ul>
37
+ <pre><code class="language-bash">set policy prefix-list PL-OUT rule 10 action permit prefix 192.168.10.0/24
38
+ set policy route-map RM-OUT rule 10 action permit
39
+ set policy route-map RM-OUT rule 10 match ip address prefix-list PL-OUT
40
+ set protocols bgp 65001 neighbor 2.2.2.2 route-map export RM-OUT
41
+ set protocols bgp 65001 neighbor 2.2.2.2 as-path-prepend '65001 65001'
42
+ </code></pre>
43
+
44
+ <h3>3. BGP Communities, Route Reflector, IPv6</h3>
45
+ <pre><code class="language-bash">set protocols bgp 65001 neighbor 3.3.3.3 remote-as 65001
46
+ set protocols bgp 65001 neighbor 3.3.3.3 route-reflector-client
47
+ set protocols bgp 65001 neighbor 2.2.2.2 address-family ipv6-unicast
48
+ set protocols bgp 65001 neighbor 2.2.2.2 extended-nexthop
49
+ set protocols bgp 65001 neighbor 2.2.2.2 soft-reconfiguration inbound
50
+ </code></pre>
51
+
52
+ <h3>4. Kiểm tra trạng thái BGP</h3>
53
+ <pre><code class="language-bash">show ip bgp summary
54
+ show ip bgp
55
+ show ip bgp neighbors
56
+ </code></pre>
57
+
58
+ <h3>5. Sơ đồ mạng ví dụ</h3>
59
+ <pre><code>+---------+ +---------+
60
+ | VyOS 1 |-----| VyOS 2 |
61
+ | AS65001| | AS65002|
62
+ +---------+ +---------+
63
+ </code></pre>
64
+
65
+ <h3>6. Lab thực hành: BGP Peering 2 AS</h3>
66
+ <ol>
67
+ <li>Cấu hình BGP trên 2 VyOS với AS khác nhau.</li>
68
+ <li>Thiết lập neighbor, route-map, prefix-list, as-path-prepend.</li>
69
+ <li>Commit và save cấu hình:</li>
70
+ </ol>
71
+ <pre><code class="language-bash">commit
72
+ save
73
+ </code></pre>
74
+ <ol start="4">
75
+ <li>Kiểm tra trạng thái BGP, routes.</li>
76
+ </ol>
77
+ <pre><code class="language-bash">show ip bgp summary
78
+ show ip bgp
79
+ </code></pre>
80
+
81
+ <h3>7. Tổng kết</h3>
82
+ <p>Bạn đã biết cách cấu hình BGP trên VyOS, ứng dụng vào các hệ thống mạng lớn, đa nhà cung cấp, kiểm soát chính sách định tuyến động.</p>
@@ -0,0 +1,85 @@
1
+ ---
2
+ id: 019d65ef-d36f-773e-bf0a-9e3982d5a422
3
+ title: 'Bài 11: VPN — WireGuard và OpenVPN'
4
+ slug: bai-11-vpn-wireguard-va-openvpn
5
+ description: >-
6
+ Hướng dẫn cấu hình VPN trên VyOS với WireGuard và OpenVPN, so sánh hiệu năng, bảo mật, thực hành site-to-site và remote access, routing và firewall cho VPN.
7
+ duration_minutes: 170
8
+ is_free: true
9
+ video_url: null
10
+ sort_order: 11
11
+ section_title: "VyOS từ Cơ bản đến Nâng cao"
12
+ course:
13
+ id: 019d65ef-d36f-773e-bf0a-9e2efc5e19df
14
+ title: VyOS từ Cơ bản đến Nâng Cao
15
+ slug: vyos-tu-co-ban-den-nang-cao
16
+ ---
17
+ <h2>Giới thiệu VPN trên VyOS: WireGuard và OpenVPN</h2>
18
+ <p>VPN (Virtual Private Network) là giải pháp bảo mật kết nối giữa các site hoặc truy cập từ xa. VyOS hỗ trợ nhiều loại VPN hiện đại như WireGuard, OpenVPN và IPsec. Bài này tập trung vào WireGuard và OpenVPN, hai giải pháp phổ biến với ưu điểm về hiệu năng, bảo mật và cấu hình linh hoạt.</p>
19
+ <h3>WireGuard: Site-to-Site VPN</h3>
20
+ <p><strong>WireGuard</strong> là giao thức VPN hiện đại, đơn giản, hiệu năng cao. Để cấu hình site-to-site giữa hai VyOS:</p>
21
+ <pre><code class="language-bash"># Tạo key pair trên mỗi VyOS
22
+ run generate wireguard key
23
+ # Lấy public key: run generate wireguard pubkey key &lt;private-key&gt;
24
+
25
+ # Cấu hình WireGuard interface
26
+ set interfaces wireguard wg0 address '10.10.10.1/24'
27
+ set interfaces wireguard wg0 port '51820'
28
+ set interfaces wireguard wg0 private-key '&lt;private-key&gt;'
29
+
30
+ # Thêm peer
31
+ set interfaces wireguard wg0 peer &lt;peer-public-key&gt; allowed-ips '10.10.10.2/32'
32
+ set interfaces wireguard wg0 peer &lt;peer-public-key&gt; endpoint 'WAN_IP_PEER:51820'
33
+ </code></pre>
34
+ <p>Thực hiện tương tự ở site bên kia, đổi địa chỉ IP và key.</p>
35
+ <h3>WireGuard: Remote Access VPN</h3>
36
+ <p>Cho phép client (laptop, điện thoại) truy cập mạng nội bộ qua WireGuard:</p>
37
+ <pre><code class="language-bash">set interfaces wireguard wg0 address '10.10.20.1/24'
38
+ set interfaces wireguard wg0 port '51820'
39
+ set interfaces wireguard wg0 private-key '&lt;server-private-key&gt;'
40
+ set interfaces wireguard wg0 peer &lt;client-public-key&gt; allowed-ips '10.10.20.2/32'
41
+ </code></pre>
42
+ <p>Client cấu hình tương ứng với public key của server.</p>
43
+ <h3>OpenVPN: Site-to-Site với Pre-Shared Key</h3>
44
+ <pre><code class="language-bash">set interfaces openvpn vtun0 mode site-to-site
45
+ set interfaces openvpn vtun0 local-address '10.20.20.1'
46
+ set interfaces openvpn vtun0 remote-address '10.20.20.2'
47
+ set interfaces openvpn vtun0 shared-secret-key-file '/config/auth/ovpn.key'
48
+ set interfaces openvpn vtun0 local-port '1194'
49
+ set interfaces openvpn vtun0 remote-host '&lt;peer-wan-ip&gt;'
50
+ </code></pre>
51
+ <h3>OpenVPN: Remote Access với Certificates</h3>
52
+ <pre><code class="language-bash">set interfaces openvpn vtun1 mode server
53
+ set interfaces openvpn vtun1 server subnet '10.30.30.0/24'
54
+ set interfaces openvpn vtun1 tls ca-cert-file '/config/auth/ca.crt'
55
+ set interfaces openvpn vtun1 tls cert-file '/config/auth/server.crt'
56
+ set interfaces openvpn vtun1 tls key-file '/config/auth/server.key'
57
+ set interfaces openvpn vtun1 client-cert-required
58
+ </code></pre>
59
+ <h3>So sánh WireGuard, OpenVPN và IPsec</h3>
60
+ <ul>
61
+ <li><strong>WireGuard</strong>: Hiệu năng cao, cấu hình đơn giản, mã nguồn nhỏ, hỗ trợ tốt trên VyOS 1.4/1.5.</li>
62
+ <li><strong>OpenVPN</strong>: Linh hoạt, nhiều chế độ, hỗ trợ certificate, nhưng hiệu năng thấp hơn WireGuard.</li>
63
+ <li><strong>IPsec</strong>: Chuẩn công nghiệp, tích hợp sâu, cấu hình phức tạp hơn.</li>
64
+ </ul>
65
+ <h3>Routing và Firewall cho VPN</h3>
66
+ <p>Sau khi thiết lập tunnel, cần định tuyến traffic và mở firewall:</p>
67
+ <pre><code class="language-bash">set protocols static route 192.168.2.0/24 next-hop 10.10.10.2
68
+ set firewall name VPN-IN default-action accept
69
+ set interfaces wireguard wg0 firewall in name VPN-IN
70
+ </code></pre>
71
+ <h3>Lab thực hành: WireGuard Site-to-Site giữa 2 VyOS</h3>
72
+ <ol>
73
+ <li>Trên mỗi VyOS, tạo key pair và trao đổi public key.</li>
74
+ <li>Cấu hình interface wg0 với địa chỉ riêng, port, private key.</li>
75
+ <li>Thêm peer với public key và endpoint của site bên kia.</li>
76
+ <li>Định tuyến mạng nội bộ qua tunnel.</li>
77
+ <li>Kiểm tra kết nối: <code>show interfaces wireguard</code>, <code>ping</code> qua tunnel.</li>
78
+ </ol>
79
+ <pre><code class="language-bash"># Kiểm tra trạng thái WireGuard
80
+ show interfaces wireguard
81
+ # Kiểm tra routing
82
+ show ip route
83
+ </code></pre>
84
+ <h3>Tổng kết</h3>
85
+ <p>Bài này giúp bạn nắm vững cấu hình VPN với WireGuard và OpenVPN trên VyOS, so sánh ưu nhược điểm, thực hành site-to-site và remote access, routing và firewall cho VPN. Hãy thực hành lab để hiểu sâu hơn về vận hành thực tế.</p>
@@ -0,0 +1,87 @@
1
+ ---
2
+ id: 019d65ef-d36f-773e-bf0a-9e3a653e2f50
3
+ title: 'Bài 12: VPN — IPsec Site-to-Site'
4
+ slug: bai-12-vpn-ipsec-site-to-site
5
+ description: >-
6
+ Hướng dẫn cấu hình IPsec site-to-site trên VyOS, phân biệt policy-based và route-based, tích hợp với Cisco/Palo Alto, lab thực hành với BGP overlay, kiểm tra và khắc phục sự cố.
7
+ duration_minutes: 180
8
+ is_free: true
9
+ video_url: null
10
+ sort_order: 12
11
+ section_title: "VyOS từ Cơ bản đến Nâng cao"
12
+ course:
13
+ id: 019d65ef-d36f-773e-bf0a-9e2efc5e19df
14
+ title: VyOS từ Cơ bản đến Nâng Cao
15
+ slug: vyos-tu-co-ban-den-nang-cao
16
+ ---
17
+ <h2>Giới thiệu IPsec VPN trên VyOS</h2>
18
+ <p><strong>IPsec</strong> là chuẩn công nghiệp cho VPN bảo mật giữa các site. VyOS hỗ trợ đầy đủ IPsec với IKEv2, ESP, NAT-T, VTI. Bài này hướng dẫn cấu hình site-to-site, phân biệt policy-based và route-based, tích hợp với thiết bị khác và thực hành lab với BGP overlay.</p>
19
+ <h3>Kiến thức nền tảng IPsec</h3>
20
+ <ul>
21
+ <li><strong>IKEv2</strong>: Giao thức thương lượng key, bảo mật hơn IKEv1.</li>
22
+ <li><strong>ESP</strong>: Encapsulating Security Payload, mã hóa dữ liệu.</li>
23
+ <li><strong>SA</strong>: Security Association, thông số bảo mật cho mỗi kết nối.</li>
24
+ <li><strong>Proposal</strong>: Tập hợp thuật toán mã hóa, xác thực.</li>
25
+ <li><strong>DH Group</strong>: Diffie-Hellman group, xác định độ mạnh key exchange.</li>
26
+ </ul>
27
+ <h3>Policy-based vs Route-based (VTI) VPN</h3>
28
+ <ul>
29
+ <li><strong>Policy-based</strong>: Định nghĩa traffic nào sẽ được mã hóa dựa trên policy.</li>
30
+ <li><strong>Route-based (VTI)</strong>: Tạo interface ảo (vti) để routing linh hoạt, hỗ trợ dynamic routing như BGP.</li>
31
+ </ul>
32
+ <h3>Cấu hình IPsec Site-to-Site giữa 2 VyOS</h3>
33
+ <pre><code class="language-bash"># Tạo proposal
34
+ set vpn ipsec esp-group ESP-GROUP proposal 1 encryption aes256
35
+ set vpn ipsec esp-group ESP-GROUP proposal 1 hash sha256
36
+ set vpn ipsec ike-group IKE-GROUP proposal 1 encryption aes256
37
+ set vpn ipsec ike-group IKE-GROUP proposal 1 dh-group 14
38
+ set vpn ipsec ike-group IKE-GROUP proposal 1 hash sha256
39
+
40
+ # Peer
41
+ set vpn ipsec site-to-site peer &lt;peer-wan-ip&gt; authentication mode pre-shared-secret
42
+ set vpn ipsec site-to-site peer &lt;peer-wan-ip&gt; authentication pre-shared-secret '&lt;secret&gt;'
43
+ set vpn ipsec site-to-site peer &lt;peer-wan-ip&gt; ike-group IKE-GROUP
44
+ set vpn ipsec site-to-site peer &lt;peer-wan-ip&gt; esp-group ESP-GROUP
45
+ set vpn ipsec site-to-site peer &lt;peer-wan-ip&gt; local-address '&lt;local-wan-ip&gt;'
46
+ set vpn ipsec site-to-site peer &lt;peer-wan-ip&gt; tunnel 1 local prefix '192.168.1.0/24'
47
+ set vpn ipsec site-to-site peer &lt;peer-wan-ip&gt; tunnel 1 remote prefix '192.168.2.0/24'
48
+ </code></pre>
49
+ <h3>Route-based VPN với VTI</h3>
50
+ <pre><code class="language-bash">set interfaces vti vti0 address '10.100.100.1/30'
51
+ set vpn ipsec site-to-site peer &lt;peer-wan-ip&gt; vti bind vti0
52
+ set vpn ipsec site-to-site peer &lt;peer-wan-ip&gt; vti esp-group ESP-GROUP
53
+ set vpn ipsec site-to-site peer &lt;peer-wan-ip&gt; vti ike-group IKE-GROUP
54
+ </code></pre>
55
+ <h3>Kết nối IPsec với Cisco/Palo Alto</h3>
56
+ <p>Chỉ cần đồng bộ proposal, pre-shared key, local/remote subnet. Đảm bảo NAT-T bật nếu có NAT.</p>
57
+ <h3>Route-based VPN tới Azure với BGP</h3>
58
+ <pre><code class="language-bash">set interfaces vti vti1 address '169.254.21.2/30'
59
+ set protocols bgp 65001 neighbor 169.254.21.1 remote-as 65515
60
+ set protocols bgp 65001 neighbor 169.254.21.1 update-source vti1
61
+ </code></pre>
62
+ <h3>DMVPN Dual Hub Concept</h3>
63
+ <p>VyOS hỗ trợ DMVPN với nhiều hub, tăng tính sẵn sàng. Cấu hình tương tự route-based, thêm nhiều peer.</p>
64
+ <h3>Kiểm tra và khắc phục sự cố IPsec</h3>
65
+ <pre><code class="language-bash">show vpn ipsec sa
66
+ show vpn ipsec status
67
+ run monitor vpn ipsec
68
+ </code></pre>
69
+ <p>Debug peer nếu không lên tunnel:</p>
70
+ <pre><code class="language-bash">run monitor vpn ipsec log peer &lt;peer-wan-ip&gt;
71
+ </code></pre>
72
+ <h3>Lab thực hành: Route-based IPsec VPN với BGP overlay</h3>
73
+ <ol>
74
+ <li>Cấu hình VTI interface trên cả hai VyOS.</li>
75
+ <li>Cấu hình IPsec peer, proposal, pre-shared key.</li>
76
+ <li>Thiết lập BGP trên VTI interface để trao đổi route.</li>
77
+ <li>Kiểm tra trạng thái tunnel và routing.</li>
78
+ </ol>
79
+ <pre><code class="language-bash"># Kiểm tra trạng thái IPsec
80
+ show vpn ipsec sa
81
+ # Kiểm tra VTI interface
82
+ show interfaces vti
83
+ # Kiểm tra BGP
84
+ show ip bgp summary
85
+ </code></pre>
86
+ <h3>Tổng kết</h3>
87
+ <p>Bài này giúp bạn hiểu rõ IPsec trên VyOS, phân biệt policy-based và route-based, tích hợp với thiết bị khác, thực hành lab với BGP overlay và kỹ năng kiểm tra, khắc phục sự cố thực tế.</p>
@@ -0,0 +1,61 @@
1
+ ---
2
+ id: 019d65ef-d36f-773e-bf0a-9e3bbb16e57f
3
+ title: 'Bài 13: High Availability — VRRP và Conntrack Sync'
4
+ slug: bai-13-high-availability-vrrp-va-conntrack-sync
5
+ description: >-
6
+ Hướng dẫn cấu hình High Availability trên VyOS với VRRP, conntrack-sync, NAT rules cho HA, kiểm tra failover, lab thực hành HA pair VyOS.
7
+ duration_minutes: 160
8
+ is_free: true
9
+ video_url: null
10
+ sort_order: 13
11
+ section_title: "VyOS từ Cơ bản đến Nâng cao"
12
+ course:
13
+ id: 019d65ef-d36f-773e-bf0a-9e2efc5e19df
14
+ title: VyOS từ Cơ bản đến Nâng Cao
15
+ slug: vyos-tu-co-ban-den-nang-cao
16
+ ---
17
+ <h2>High Availability trên VyOS: VRRP và Conntrack Sync</h2>
18
+ <p>Đảm bảo tính sẵn sàng cao (HA) là yêu cầu quan trọng cho hệ thống mạng. VyOS hỗ trợ VRRP (Virtual Router Redundancy Protocol) và conntrack-sync để đồng bộ trạng thái NAT/connection giữa các node.</p>
19
+ <h3>VRRP: Virtual Router Redundancy Protocol</h3>
20
+ <p>VRRP cho phép nhiều router chia sẻ một địa chỉ ảo (virtual IP), khi node chính gặp sự cố, node dự phòng sẽ tiếp quản IP này.</p>
21
+ <pre><code class="language-bash">set high-availability vrrp group G1 interface eth0
22
+ set high-availability vrrp group G1 virtual-address 192.168.100.254/24
23
+ set high-availability vrrp group G1 priority 200
24
+ set high-availability vrrp group G1 preempt true
25
+ set high-availability vrrp group G1 rfc-compatibility 3
26
+ </code></pre>
27
+ <h3>Conntrack Sync: Đồng bộ trạng thái NAT/Connection</h3>
28
+ <pre><code class="language-bash">set service conntrack-sync interface eth1
29
+ set service conntrack-sync accept-protocol vrrp
30
+ </code></pre>
31
+ <p>Đảm bảo các kết nối NAT không bị gián đoạn khi failover.</p>
32
+ <h3>Config Sync giữa HA Pair</h3>
33
+ <pre><code class="language-bash">set service config-sync peer 192.168.100.2
34
+ set service config-sync interface eth1
35
+ </code></pre>
36
+ <h3>NAT Rules cho HA</h3>
37
+ <p>Áp dụng NAT rule cho virtual IP:</p>
38
+ <pre><code class="language-bash">set nat source rule 100 outbound-interface eth0
39
+ set nat source rule 100 source address 192.168.100.0/24
40
+ set nat source rule 100 translation address masquerade
41
+ </code></pre>
42
+ <h3>Kiểm tra và kiểm soát Failover</h3>
43
+ <pre><code class="language-bash">show high-availability vrrp
44
+ show service conntrack-sync
45
+ </code></pre>
46
+ <h3>Thiết kế HA: VM primary + physical backup</h3>
47
+ <p>Khuyến nghị triển khai VyOS chính trên VM, backup trên thiết bị vật lý để tăng độ tin cậy.</p>
48
+ <h3>Lab thực hành: HA Pair VyOS với VRRP + Conntrack Sync</h3>
49
+ <ol>
50
+ <li>Cấu hình VRRP group trên cả hai VyOS, chọn priority khác nhau.</li>
51
+ <li>Cấu hình conntrack-sync trên interface kết nối nội bộ.</li>
52
+ <li>Kiểm tra failover bằng cách shutdown node chính, quan sát virtual IP chuyển sang node dự phòng.</li>
53
+ <li>Kiểm tra trạng thái NAT/connection sau failover.</li>
54
+ </ol>
55
+ <pre><code class="language-bash"># Kiểm tra trạng thái VRRP
56
+ show high-availability vrrp
57
+ # Kiểm tra đồng bộ conntrack
58
+ show service conntrack-sync
59
+ </code></pre>
60
+ <h3>Tổng kết</h3>
61
+ <p>Bài này giúp bạn cấu hình HA trên VyOS với VRRP, conntrack-sync, NAT rules, kiểm tra failover và thực hành lab thực tế. Đảm bảo hệ thống mạng luôn sẵn sàng, giảm downtime tối đa.</p>
@@ -0,0 +1,62 @@
1
+ ---
2
+ id: 019d65ef-d36f-773e-bf0a-9e3cc2fa6f1e
3
+ title: 'Bài 14: WAN Load Balancing, QoS và Monitoring'
4
+ slug: bai-14-wan-load-balancing-qos-va-monitoring
5
+ description: >-
6
+ Hướng dẫn cấu hình cân bằng tải WAN, QoS, giám sát lưu lượng trên VyOS, lab thực hành dual-WAN, cấu hình NetFlow, SNMP, syslog, Prometheus.
7
+ duration_minutes: 160
8
+ is_free: true
9
+ video_url: null
10
+ sort_order: 14
11
+ section_title: "VyOS từ Cơ bản đến Nâng cao"
12
+ course:
13
+ id: 019d65ef-d36f-773e-bf0a-9e2efc5e19df
14
+ title: VyOS từ Cơ bản đến Nâng Cao
15
+ slug: vyos-tu-co-ban-den-nang-cao
16
+ ---
17
+ <h2>WAN Load Balancing, QoS và Monitoring trên VyOS</h2>
18
+ <p>Đảm bảo kết nối Internet ổn định, tối ưu hóa băng thông và giám sát lưu lượng là yêu cầu quan trọng. VyOS cung cấp các tính năng mạnh mẽ cho cân bằng tải WAN, QoS và monitoring.</p>
19
+ <h3>WAN Load Balancing</h3>
20
+ <pre><code class="language-bash">set load-balancing wan rule 10 inbound-interface eth0
21
+ set load-balancing wan rule 10 interface eth1 weight 100
22
+ set load-balancing wan rule 10 interface eth2 weight 50
23
+ set load-balancing wan rule 10 failover
24
+ set load-balancing wan rule 10 exclude traffic source address 192.168.1.0/24
25
+ set load-balancing wan interface-health eth1 test 10 type ping target 8.8.8.8
26
+ set load-balancing wan interface-health eth2 test 10 type ping target 1.1.1.1
27
+ </code></pre>
28
+ <h3>QoS: Traffic Shaping và Ưu tiên</h3>
29
+ <pre><code class="language-bash">set qos policy shaper SHAPER bandwidth 100mbit
30
+ set qos policy shaper SHAPER default bandwidth 80mbit
31
+ set qos policy shaper SHAPER class 10 match ip destination address 192.168.2.0/24
32
+ set qos policy shaper SHAPER class 10 bandwidth 20mbit
33
+ set interfaces ethernet eth0 qos policy shaper SHAPER
34
+ </code></pre>
35
+ <p>Ưu tiên traffic VoIP/gaming bằng CAKE hoặc HTB.</p>
36
+ <h3>NetFlow/sFlow, SNMP, Syslog</h3>
37
+ <pre><code class="language-bash">set system flow-accounting interface eth0
38
+ set system flow-accounting netflow server 192.168.10.10 port 2055
39
+ set service snmp community public authorization ro
40
+ set service snmp listen-address 0.0.0.0
41
+ set system syslog host 192.168.10.20 facility all level info
42
+ set system syslog host 192.168.10.20 transport tls
43
+ </code></pre>
44
+ <h3>Prometheus Monitoring Integration</h3>
45
+ <p>VyOS hỗ trợ xuất số liệu qua SNMP hoặc exporter container.</p>
46
+ <h3>Lab thực hành: Dual-WAN Load Balancing + QoS</h3>
47
+ <ol>
48
+ <li>Cấu hình hai WAN interface (eth1, eth2) với rule cân bằng tải.</li>
49
+ <li>Thiết lập interface-health kiểm tra ping.</li>
50
+ <li>Cấu hình QoS shaper cho eth0, ưu tiên traffic cần thiết.</li>
51
+ <li>Kiểm tra failover bằng cách ngắt một WAN.</li>
52
+ <li>Kiểm tra NetFlow, SNMP, syslog gửi về server giám sát.</li>
53
+ </ol>
54
+ <pre><code class="language-bash"># Kiểm tra trạng thái load balancing
55
+ show load-balancing wan
56
+ # Kiểm tra QoS
57
+ show qos
58
+ # Kiểm tra flow-accounting
59
+ show system flow-accounting
60
+ </code></pre>
61
+ <h3>Tổng kết</h3>
62
+ <p>Bài này giúp bạn cấu hình cân bằng tải WAN, QoS, giám sát lưu lượng trên VyOS, thực hành dual-WAN, cấu hình NetFlow, SNMP, syslog, Prometheus để vận hành hệ thống mạng chuyên nghiệp.</p>
@@ -0,0 +1,80 @@
1
+ ---
2
+ id: 019d65ef-d36f-773e-bf0a-9e3dd57adcb1
3
+ title: 'Bài 15: Containers, Automation và Production Best Practices'
4
+ slug: bai-15-containers-automation-va-production-best-practices
5
+ description: >-
6
+ Hướng dẫn sử dụng container trên VyOS, tự động hóa với Ansible, API, backup, upgrade, bảo mật và triển khai thực tế, lab thực hành Ansible playbook.
7
+ duration_minutes: 170
8
+ is_free: true
9
+ video_url: null
10
+ sort_order: 15
11
+ section_title: "VyOS từ Cơ bản đến Nâng cao"
12
+ course:
13
+ id: 019d65ef-d36f-773e-bf0a-9e2efc5e19df
14
+ title: VyOS từ Cơ bản đến Nâng Cao
15
+ slug: vyos-tu-co-ban-den-nang-cao
16
+ ---
17
+ <h2>Containers, Automation và Production Best Practices trên VyOS</h2>
18
+ <p>VyOS 1.4/1.5 hỗ trợ container (Podman) cho phép chạy dịch vụ phụ trợ, exporter, monitoring. Ngoài ra, VyOS cung cấp API, hỗ trợ Ansible, backup, upgrade và các best practices cho môi trường production.</p>
19
+ <h3>Containers trên VyOS</h3>
20
+ <pre><code class="language-bash">set container name prometheus-exporter image prom/node-exporter
21
+ set container name prometheus-exporter network bridge address 192.168.50.10/24
22
+ set container name prometheus-exporter health-check interval 30
23
+ </code></pre>
24
+ <p>Hỗ trợ bridge, macvlan, health-check, quản lý bằng Podman CLI.</p>
25
+ <h3>Tự động hóa với Ansible</h3>
26
+ <pre><code class="language-bash"># ansible.cfg
27
+ [defaults]
28
+ inventory = ./hosts
29
+ host_key_checking = False
30
+
31
+ # playbook.yaml
32
+ - hosts: vyos
33
+ gather_facts: no
34
+ tasks:
35
+ - name: Push config
36
+ vyos.vyos.vyos_config:
37
+ lines:
38
+ - set interfaces ethernet eth0 address 192.168.1.1/24
39
+ </code></pre>
40
+ <h3>VyOS HTTP API và REST API</h3>
41
+ <pre><code class="language-bash">set service https api listen-address 0.0.0.0
42
+ set service https api port 8443
43
+ </code></pre>
44
+ <p>Gửi lệnh cấu hình qua REST API:</p>
45
+ <pre><code class="language-bash">curl -k -u vyos:password -X POST https://vyos:8443/configure -d '{"op": "set", "path": ["interfaces", "ethernet", "eth0", "address"], "value": "192.168.1.2/24"}'
46
+ </code></pre>
47
+ <h3>Scripting và Custom Commands</h3>
48
+ <pre><code class="language-bash">set system login user vyos authentication plaintext-password 'password'
49
+ run show version
50
+ </code></pre>
51
+ <h3>Backup, Upgrade và Rollback</h3>
52
+ <pre><code class="language-bash"># Backup config
53
+ cp /config/config.boot /config/backup-$(date +%F).boot
54
+ # Upgrade image
55
+ add system image https://downloads.vyos.io/rolling/current/amd64/vyos-1.5-rolling.iso
56
+ # Rollback
57
+ set system image default-boot vyos-1.4-rolling
58
+ </code></pre>
59
+ <h3>Security Hardening Checklist</h3>
60
+ <ul>
61
+ <li>Đổi port SSH, tắt root login, chỉ cho phép key.</li>
62
+ <li>Tắt dịch vụ không dùng: <code>delete service telnet</code>, <code>delete service ftp</code>.</li>
63
+ <li>Thiết lập firewall bảo vệ chính VyOS.</li>
64
+ </ul>
65
+ <h3>Production Deployment Scenarios</h3>
66
+ <ul>
67
+ <li>Home router: NAT, VPN, firewall, monitoring.</li>
68
+ <li>Small business: dual-WAN, HA, container exporter.</li>
69
+ <li>ISP edge: BGP, IPsec, automation, backup.</li>
70
+ </ul>
71
+ <h3>Lab thực hành: Ansible Playbook triển khai VyOS config</h3>
72
+ <ol>
73
+ <li>Chuẩn bị file <code>ansible.cfg</code> và <code>hosts</code> với IP VyOS.</li>
74
+ <li>Viết playbook sử dụng module <code>vyos_config</code> để đẩy cấu hình.</li>
75
+ <li>Chạy playbook và kiểm tra trạng thái trên VyOS.</li>
76
+ </ol>
77
+ <pre><code class="language-bash">ansible-playbook -i hosts playbook.yaml
78
+ </code></pre>
79
+ <h3>Tổng kết</h3>
80
+ <p>Bài này giúp bạn vận dụng container, tự động hóa với Ansible, sử dụng API, backup, upgrade, bảo mật và triển khai VyOS trong môi trường production thực tế.</p>