<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Networking &#8211; NhanVPH&#039;s Blog</title>
	<atom:link href="https://blntech.io.vn/category/networking/feed/" rel="self" type="application/rss+xml" />
	<link>https://blntech.io.vn</link>
	<description></description>
	<lastBuildDate>Mon, 01 Jun 2026 06:50:09 +0000</lastBuildDate>
	<language>vi</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://blntech.io.vn/wp-content/uploads/2026/04/cropped-cropped-Logo-BLN-32x32.jpg</url>
	<title>Networking &#8211; NhanVPH&#039;s Blog</title>
	<link>https://blntech.io.vn</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>pfSense Lab – Phần 11 &#8211; Cấu Hình WireGuard VPN Và Định Tuyến Tự Động</title>
		<link>https://blntech.io.vn/pfsense-lab-phan-11-cau-hinh-wireguard-vpn-va-dinh-tuyen-tu-dong/</link>
		
		<dc:creator><![CDATA[nhanvph]]></dc:creator>
		<pubDate>Mon, 01 Jun 2026 06:50:09 +0000</pubDate>
				<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[pfSense]]></category>
		<category><![CDATA[Seri pfSense]]></category>
		<guid isPermaLink="false">https://blntech.io.vn/?p=1741</guid>

					<description><![CDATA[I. Yêu cầu thiết bị Hướng dẫn thiết lập VPN Server miễn phí với Oracle Cloud VPS II. Cài đặt [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h1 class="wp-block-heading"><strong>I. Yêu cầu thiết bị</strong></h1>



<ul class="wp-block-list">
<li>pfSense đã được cấu hình mạng Internet. (<a href="https://blntech.io.vn/pfsense-lab-phan-3-cau-hinh-can-ban-cho-pfsense/" target="_blank" rel="noreferrer noopener">Xem hướng dẫn</a>)</li>



<li>1 VPS đã được thiết lập WireGuard Server. Bạn có thể tham khảo hướng dẫn dưới đây để tạo VPN Server miễn phí</li>
</ul>



<p class="wp-block-paragraph"><strong>Hướng dẫn thiết lập VPN Server miễn phí với Oracle Cloud VPS</strong></p>



<h2 class="wp-block-heading">II. Cài đặt WireGuard package</h2>



<p class="wp-block-paragraph">Mặc định pfSense chưa có sẵn dịch vụ WIreGuard VPN. Bạn cần phải cài thêm WireGuard từ trang quản lý Package Manager.</p>



<p class="wp-block-paragraph">Truy cập vào Web UI của pfSense, bấm vào Mneu System , chọn Package Manager. Sau đó bạn chọn qua tab Available Packages</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-wireguard-1.png" alt=""/></figure>



<p class="wp-block-paragraph">Kéo xuống dưới, tìm WireGuard và bấm Install để cài đặt.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-wireguard-2.png" alt=""/></figure>



<p class="wp-block-paragraph">Chờ vài phút để pfSense tải và cài đặt WireGuard. Sau khi cài thành công, bạn sẽ thấy thông báo Success.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-wireguard-3.png" alt=""/></figure>



<h2 class="wp-block-heading">III. Cấu hình WireGuard VPN</h2>



<h3 class="wp-block-heading">1. Chuẩn bị file Wireguard Client</h3>



<p class="wp-block-paragraph">Trước tiên, bạn cần phải truy cập WireGuard VPN Server để tạo 1 Client mới dành cho Mikrotik và tải file conf về. Nội dung file sẽ tương tự như dưới đây.</p>



<pre class="wp-block-code"><code>&#91;Interface]
PrivateKey = UDbFxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxaN9Oms=
Address = 10.7.0.3/24
DNS = 10.2.0.100

&#91;Peer]
PublicKey = e/VZhqIyyyyyyyyyyyyyyyyyyyyyyyyy/4wS37B5x8QMxg=
PresharedKey = 5XvmWvYUm2xxxxxxxxxxxxxxxxxxxxxxxxxxxlgYPoFzj8Q618=
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = 146.ooo.iii.eee:51820
PersistentKeepalive = 0</code></pre>



<p class="wp-block-paragraph">Chúng ta sẽ dùng thông tin trong file conf này để cấu hình WireGuard VPN trên pfSense.</p>



<h3 class="wp-block-heading">3. Tạo Tunnel</h3>



<p class="wp-block-paragraph">Bấm vào Menu VPN, chọn WireGuard để truy cập vào trang quản lý WireGuard. Bấm Add Tunnel.</p>



<p class="wp-block-paragraph">Chúng ta sẽ dùng thông tin trong mục [Interface] của file cấu hình ở trên để thiết lập Tunnel</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-wireguard-4.png" alt=""/></figure>



<p class="wp-block-paragraph">Nhập thông số:</p>



<ul class="wp-block-list">
<li>Enable Tunner: bấm chọn</li>



<li>Description: tuỳ bạn chọn, mình ghi WireGuard-SF</li>



<li>Interface Keys: nhập vào Private key nằm trong phần [Interface] của file cấu hình .conf. Sau đó mục Public Key kế bên sẽ tự động được tạo ra.</li>



<li>Interface Address: nhập vào Address trong phần [Interface] của file cấu hình .conf</li>
</ul>



<p class="wp-block-paragraph">Bấm Save tunnel để lưu lại.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-wireguard-5.png" alt=""/></figure>



<h3 class="wp-block-heading">3. Tạo Peer</h3>



<p class="wp-block-paragraph">Bấm qua tab Tunnel, bấm vào Add Peer.</p>



<p class="wp-block-paragraph">Chúng ta sẽ dùng thông tin trong mục [Peer] của file cấu hình ở trên để thiết lập Peer.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-wireguard-6.png" alt=""/></figure>



<p class="wp-block-paragraph">Nhập thông số:</p>



<ul class="wp-block-list">
<li>Enbale Peer: Bấm chọn</li>



<li>Tunnel: chọn Tunnel mới vùa tạo ở bước 2</li>



<li>Endpoint / Port / Public Key / Preshared Key / Keep Alive / Allowed IP: nhập theo thông tin trong file cấu hình</li>
</ul>



<p class="wp-block-paragraph">Bấm Save Peer để lưu lại.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-wireguard-7.png" alt=""/></figure>



<h3 class="wp-block-heading">4. Kích hoạt WireGuard</h3>



<p class="wp-block-paragraph">Bấm qua tab Settings, bấm chọn vào mục Enable WireGuard để kích hoạt WireGuard và bấm Save.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-wireguard-8.png" alt=""/></figure>



<p class="wp-block-paragraph">Sau đó, chuyển qua tab Status, bấm vào nút Show Peers, bạn sẽ thấy thông báo kết nối thành công đến WireGuard VPN Server.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-wireguard-9.png" alt=""/></figure>



<h2 class="wp-block-heading">IV. Cấu hình WireGuard Interface</h2>



<p class="wp-block-paragraph">Truy cập vào mục Interface Assignment từ menu Interfaces. Bấm vào nút Add ở dòng Available network ports.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-wireguard-10.png" alt=""/></figure>



<p class="wp-block-paragraph">Sau đó bấm vào Interface vừa tạo để thiết lập thông số</p>



<ul class="wp-block-list">
<li>Enable: bấm chọn Enable Interface</li>



<li>Description: WG (hoặc tên gì tuỳ ý bạn)</li>



<li>IPv4 Configuration Type: Static IPv4</li>



<li>IPv6 Configuration Type: Static IPv6</li>



<li>IPv4 Address: nhập vào Address trong phần [Interface] của file cấu hình .conf</li>



<li>IPv6 Address: nhập vào Address trong phần [Interface] của file cấu hình .conf</li>
</ul>



<p class="wp-block-paragraph">Bấm vào nút Add a new gateway cạnh mục IPv4 và IPv6 để tạo Gateway mới. Nhập vào thông tin và bấm Add.</p>



<p class="wp-block-paragraph">Bấm Save để lưu lại.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-wireguard-12.png" alt=""/></figure>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-wireguard-11.png" alt="Tạo Gateway mới"/><figcaption class="wp-element-caption"><strong>Tạo Gateway mới</strong></figcaption></figure>



<h2 class="wp-block-heading">V. Thiết lập Gateway mặc định</h2>



<p class="wp-block-paragraph">Bấm vào Menu System, chọn Routing để truy cập trang thiết lập Gateways.</p>



<p class="wp-block-paragraph">Bạn cần thiết lập Gateway mặc định cho mạng sử dụng Gateway của WAN</p>



<ul class="wp-block-list">
<li>Default gateway IPv4: chọn WAN_DHCP</li>



<li>Default gateway IPv6: WAN_DHCP6</li>
</ul>



<p class="wp-block-paragraph">Bấm Save để lưu lại</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-wireguard-19.png" alt=""/></figure>



<h2 class="wp-block-heading">VI. Cấu hình Firewall Rule for WireGuard</h2>



<p class="wp-block-paragraph">Để truy cập Internet thông qua WireGuard, bạn cần thiết lập Firewall Rule cho LAN.</p>



<p class="wp-block-paragraph">Bấm vào menu Firewall, chọn Rules, sau đó bấm tiếp qua tab LAN. Bấm vào nút Add để tạo rule mới</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-wireguard-13.png" alt=""/></figure>



<p class="wp-block-paragraph">Thông số:</p>



<ul class="wp-block-list">
<li>Action: Pass</li>



<li>Interface: LAN</li>



<li>Address Family: IPv4 hoặc IPv4+v6</li>



<li>Protocol: Any</li>



<li>Destination: WAN net</li>
</ul>



<p class="wp-block-paragraph">Bấm vào nút Advance Setting, mục Gateway: chọn Gateway WireGuard: WG_GW</p>



<p class="wp-block-paragraph">Sau đó bấm Save. Bấm tiếp Apply để kích hoạt Firewall Rule mới.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-wireguard-15.png" alt=""/></figure>



<p class="wp-block-paragraph">Với Firewall Rule mới thiết lập, mọi kết nối từ trong LAN sẽ được chuyển hướng đi qua WireGuard Gateway. Bạn có thể kiểm tra bằng cách truy cập&nbsp;<code>https://ip.me/</code>&nbsp;sẽ thấy hiện ra IP của VPN Server đang kết nối.</p>



<h2 class="wp-block-heading">VII. Định tuyến tự động mạng quốc tế chạy qua VPN</h2>



<p class="wp-block-paragraph">Với cách thiết lập ở bước trên, mọi kết nối từ trong mạng LAN đều sẽ được gửi đến WireGuard VPN Server. Mình sẽ làm thêm 1 bước nữa để phân luồng mạng:</p>



<ul class="wp-block-list">
<li>Truy cập ra quốc tế sẽ chạy qua VPN.</li>



<li>Truy cập trong nước sẽ đi trực tiếp, không qua VPN.</li>
</ul>



<p class="wp-block-paragraph">Nguyên lý hoạt động như sau</p>



<ul class="wp-block-list">
<li>Tạo 1 danh sách tất cả IP của Việt Nam sử dụng tính năng Alias của pfSense</li>



<li>Tạo thêm Firewall Rule: chỉ các truy cập nào không phải đến IP Việt Nam mới chạy qua VPN.</li>
</ul>



<h3 class="wp-block-heading">1. Tạo IP Aliases</h3>



<p class="wp-block-paragraph">Từ Menu Firwall, bấm chọn Aliases. Bấm vào nút Import để nhập vào danh sách IP.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-wireguard-16.png" alt=""/></figure>



<p class="wp-block-paragraph">Sử dụng danh sách chứa tàon bộ dải IP của Việt Nam ở link dưới đây để nhập vào ô <strong>Aliases to Import </strong></p>



<pre class="wp-block-preformatted"><a href="https://gist.githubusercontent.com/10h30/4347744f239f837dc0997ccbb1a0fd93/raw/abaeda6863304c0edf1b9b10439fcb7398ee14f6/pfsense-vietnam-ip-list">https://gist.githubusercontent.com/10h30/4347744f239f837dc0997ccbb1a0fd93/raw/abaeda6863304c0edf1b9b10439fcb7398ee14f6/pfsense-vietnam-ip-list</a></pre>



<p class="wp-block-paragraph">Aliase Name: Vietnam_IP_List</p>



<p class="wp-block-paragraph">Bấm Save để lưu lại</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-wireguard-17.png" alt=""/></figure>



<h3 class="wp-block-heading">2. Chỉnh sửa Firewall Rule</h3>



<p class="wp-block-paragraph">Quay lại trang quản lý Firewall Rule của LAN, chỉnh sửa lại Wirewall rule đã tạo ở bước trước đó, chỉnh lại thông số ở mục Destination:</p>



<ul class="wp-block-list">
<li>Destination: bấm chọn Invert Match, chọn Single host or Alias, sau đó gõ Vietnam_IP_List ở mục địa chỉ kế bên, bạn sẽ thấy tên hiện ra. Bấm chọn nó.</li>
</ul>



<p class="wp-block-paragraph">Bấm Save để lưu lại.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-wireguard-14.png" alt=""/></figure>



<p class="wp-block-paragraph">Danh sách Firewall Rule cho LAN sẽ hiện ra như sau:</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-wireguard-18.png" alt=""/></figure>



<p class="wp-block-paragraph">Với thiết lập này, tất cả các truy cập đến IP quốc tế (nằm ngoài dải IP Việt Nam) sẽ chạy qua WireGuard VPN. Còn các truy cập trong nước sẽ chạy qua kết nối mạng thông thường.</p>



<p class="wp-block-paragraph">Bạn có thể kiểm tra bằng cách truy cập vào <code><strong>https://ip.me</strong></code> và <code><strong>https://kiemtraip.com/</strong></code> sẽ thấy hiện ra 2 IP khác nhau:</p>



<ul class="wp-block-list">
<li>IP.me hiện ra IP của VPN Server</li>



<li>KiemtraIP: hiện ra IP của WAN.</li>
</ul>



<p class="wp-block-paragraph">Để bảo đảm kết nối thông suốt, bạn nên <a href="https://blntech.io.vn/pfsense-lab-phan-10-cau-hinh-dual-wan-load-balancing-failover/" data-type="link" data-id="https://blntech.io.vn/pfsense-lab-phan-10-cau-hinh-dual-wan-load-balancing-failover/" target="_blank" rel="noreferrer noopener">thiết lập Failover</a> để tránh tính trạng VPN Server gặp vấn đề sẽ ảnh hưởng đến kết nối quốc tế.</p>



<p class="wp-block-paragraph">Chúc bạn thực hiện thành công!</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p class="wp-block-paragraph">Nguồn: thuanbui</p>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>pfSense Lab – Phần 10 &#8211; Cấu Hình Dual-Wan Load Balancing &#038; Failover</title>
		<link>https://blntech.io.vn/pfsense-lab-phan-10-cau-hinh-dual-wan-load-balancing-failover/</link>
		
		<dc:creator><![CDATA[nhanvph]]></dc:creator>
		<pubDate>Fri, 29 May 2026 10:04:30 +0000</pubDate>
				<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[Failover]]></category>
		<category><![CDATA[Load-Balancing]]></category>
		<guid isPermaLink="false">https://blntech.io.vn/?p=1765</guid>

					<description><![CDATA[I. Load Balancing và Failover là gì? 1. Load Balancing Trong hệ thống mạng, Load Balancing (cân bằng tải) là [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">I. Load Balancing và Failover là gì?</h2>



<h3 class="wp-block-heading">1. Load Balancing</h3>



<p class="wp-block-paragraph">Trong hệ thống mạng, Load Balancing (cân bằng tải) là tính năng giúp gộp băng thông 2 hay nhiều đường truyền WAN để nâng cao tốc độ và sự ổn định cho mạng LAN.</p>



<p class="wp-block-paragraph">Ví dụ: WAN 1 có tốc độ 3Mbps và WAN 2 có tốc độ 7Mbps. Khi thiết lập Load Balancing, băng thông sẽ được gộp lại thành 10Mbps.</p>



<p class="wp-block-paragraph">Khi một trong hai đường truyền WAN mất kết nối, hệ thống sẽ tự động chuyển qua sử dùng đường truyền còn lại.</p>



<h3 class="wp-block-heading">2. Failover là gì?</h3>



<p class="wp-block-paragraph">Failover (chế độ dự phòng) là tính năng thiết lập mạng WAN dự phòng cho mạng WAN chính. Khi mạng WAN chính gặp trục trặc, router sẽ tự động chuyển qua sử dụng mạng dự phòng để giúp kết nối không bị gián đoạn.</p>



<p class="wp-block-paragraph">Ví dụ: WAN 1 có tốc độ 7Mbps và WAN 2 có tốc độ 3Mbps. Với thiết lập Failover: WAN 1 là mạng chính và WAN 2 làm mạng dự phòng, hệ thống chỉ sử dụng đường truyền của WAN 1 &#8211; 7Mbps. Khi WAN 1 mất kết nối, WAN 2 sẽ được kích hoạt thay thế.</p>



<p class="wp-block-paragraph">Failover thường được sử dụng trong trường hợp bạn chỉ muốn sử dụng mạng WAN dự phòng trong trường hợp bất khả kháng. Ví dụ: chỉ dùng mạng WAN 4G khi mạng FTTH ở nhà gặp trục trặc.</p>



<h2 class="wp-block-heading">II. Thiết lập hệ thống mạng</h2>



<p class="wp-block-paragraph">Để thực hiện Load Balancing và Failover trên pfSense, yêu cầu pfSense phải có ít nhất 3 card mạng: 2 WAN và 1 LAN. Mình thiết lập hệ thống mạng ảo như dưới đây để thực hiện nghiên cứu</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-load-balancer-fail-over.png" alt="Sơ đồ pfSense Lab - Load Balancing &amp; Failover"/><figcaption class="wp-element-caption"><strong>Sơ đồ pfSense Lab &#8211; Load Balancing &amp; Failover</strong></figcaption></figure>



<p class="wp-block-paragraph">Quy trình thiết lập như sau:</p>



<ol class="wp-block-list">
<li>Tạo 3 máy ảo pfSense sử dụng phương pháp <a href="https://blntech.io.vn/huong-dan-clone-tao-ban-sao-may-ao-tren-hyper-v/" data-type="link" data-id="https://blntech.io.vn/huong-dan-clone-tao-ban-sao-may-ao-tren-hyper-v/" target="_blank" rel="noreferrer noopener">clone (tạo bản sao) máy ảo trên Hyper-V</a>.
<ul class="wp-block-list">
<li>2 máy ảo pfSense đóng vai trò làm ISP ảo cung cấp kết nối WAN 1 và WAN 2</li>



<li>1 máy ảo pfSense đóng vai trò làm Router chính sẽ được thiết lập Load Balancing và Failover.</li>
</ul>
</li>



<li>Giới hạn băng thông: 70Mbps cho WAN 1 <code>10.0.0.0/24</code> và 30Mbps cho WAN 2 <code>172.27.0.0/24</code> (Xem hướng dẫn: <a href="https://blntech.io.vn/pfsense-lab-phan-9-cau-hinh-gioi-han-bang-thong-mang-lan/" data-type="link" data-id="https://blntech.io.vn/pfsense-lab-phan-9-cau-hinh-gioi-han-bang-thong-mang-lan/" target="_blank" rel="noreferrer noopener">Cấu hình giới hạn băng thông mạng LAN</a>)</li>



<li>Tạo 3 Private Switch để kết nối các máy ảo lại với nhau.</li>
</ol>



<p class="wp-block-paragraph">Thao tác cấu hình Load Balancing và Failover sẽ được thực hiện trên pfSense trung tâm nằm ngay giữa sơ đồ.</p>



<h2 class="wp-block-heading">III. Cấu hình Load Balancing</h2>



<p class="wp-block-paragraph">Trước khi cấu hình Load Balancing, bạn cần phải hoàn thành việc thiết lập các cổng mạng WAN Interface và LAN Interface trên pfSense. </p>



<p class="wp-block-paragraph">Xem hướng dẫn : <a href="https://blntech.io.vn/pfsense-lab-phan-3-cau-hinh-can-ban-cho-pfsense/" data-type="link" data-id="https://blntech.io.vn/pfsense-lab-phan-3-cau-hinh-can-ban-cho-pfsense/" target="_blank" rel="noreferrer noopener">Cấu hình căn bản cho pfSense</a></p>



<h3 class="wp-block-heading">1. Tạo Gateway Groups</h3>



<p class="wp-block-paragraph">Truy cập vào mục Gateway Groups: Bấm vào mục Routing trong Menu System, sau đó chọn qua tab Gateway Groups.</p>



<p class="wp-block-paragraph">Bấm vào nút Add để tạo mới Gateway Group</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-load-balacing-1.png" alt=""/></figure>



<ul class="wp-block-list">
<li><strong>Group Name</strong>: Load_Balancer</li>



<li><strong>Gateway Priority</strong>: Chọn Tier 1 cho cả hai WAN.</li>



<li><strong>Trigger Level</strong>: Member Down</li>



<li><strong>Description</strong>: Dual Wan Load Balancer.</li>
</ul>



<p class="wp-block-paragraph">Mục Gateway Priority sẽ quyết định Gateway Group của bạn hoạt động dưới chế độ Load Balancing hay Failover:</p>



<ul class="wp-block-list">
<li>Hai WAN được set cùng Tier 1: chế độ Load Balancing, hai đường truyền sẽ được sử dụng đồng thời.</li>



<li>Nếu hai WAN được set Tier khác nhau: ví dụ WAN 1 &#8211; Tier 1 &amp; WAN 2 &#8211; Tier 2, chỉ WAN 1 sẽ được sử dụng cho đường truyền chính. Khi WAN 1 mất kết nối, WAN 2 sẽ được sử dụng.</li>
</ul>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-load-balancing-2.png" alt=""/></figure>



<p class="wp-block-paragraph">Sau khi nhập thông số, bấm Save. Sau đó bấm thêm Apply Changes để xác nhận.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-load-balancing-3.png" alt=""/></figure>



<h3 class="wp-block-heading">2. Thiết lập Monitor IP</h3>



<p class="wp-block-paragraph">Để pfSense nhận biết được WAN có mất kết nối Internet không, cần phải thiết lập Monitor IP cho từng Gateway. Mình sẽ sử dụng 2 Public IP sau đây để theo dõi hai cổng WAN</p>



<ul class="wp-block-list">
<li>WAN 1: <code>8.8.8.8</code> (DNS của Google)</li>



<li>WAN 2: <code>208.67.222.222</code> (DNS của OpenDNS)</li>
</ul>



<p class="wp-block-paragraph">Quay lại tab Gateways, bấm vào biểu tượng bút chì để chỉnh sửa thông số</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-load-balancing-4.png" alt=""/></figure>



<p class="wp-block-paragraph">Kéo xuống phần Monitor IP: nhập vào&nbsp;<code>8.8.8.8</code>&nbsp;và bấm Save</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-load-balancing-5.png" alt=""/></figure>



<p class="wp-block-paragraph">Lập lại thao tác tương tự cho WAN 2.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-load-balancing-6.png" alt="Thiết lập Monitor IP cho hai cổng mạng WAN."/><figcaption class="wp-element-caption">Thiết lập Monitor IP cho hai cổng mạng WAN.</figcaption></figure>



<h3 class="wp-block-heading">3. Điều chỉnh Firewall Rule</h3>



<p class="wp-block-paragraph">Để sử dụng Gateway Group cho mạng LAN, chúng ta cần phải điều chỉnh lại Firewall Rule của pfSense.</p>



<p class="wp-block-paragraph">Truy cập vào mục Rules từ Menu Firewall, chọn qua tab LAN. Bấm vào biểu tượng bút chì để thay đổi thông số cho Rule mặc định “<em>Default allow LAN to any rule</em>”</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-load-balancing-7.png" alt=""/></figure>



<p class="wp-block-paragraph">Kéo xuống dưới cùng, bấm vào nút Display Advanced để hiện ra các thông số nâng cao.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-load-balancing-8.png" alt=""/></figure>



<p class="wp-block-paragraph">Mục Gateway: chọn Load_BLancer &#8211; Dual WAN Load Balancer. Sau đó bấm Save</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-load-balancing-9.png" alt=""/></figure>



<p class="wp-block-paragraph">Bấm tiếp Apply Changes để kích hoạt thay đổi.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-load-balancing-10.png" alt=""/></figure>



<h3 class="wp-block-heading">4. Thực nghiệm Load Balancing</h3>



<p class="wp-block-paragraph">Mình sử dụng dịch vụ Speedtest.vn để kiểm tra băng thông mạng trên máy ảo WIndows 10 nằm trong mạng LAN của pfSense.</p>



<h4 class="wp-block-heading">a. Trước khi kích hoạt Load Balancing</h4>



<p class="wp-block-paragraph">Trước khi kích hoạt Load Balanching, pfSense chỉ sử dụng đường truyền từ WAN 1 (30Mbps). Kiểm tra Speedtest ra kết quả tương ứng.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-load-balancing-speed-test-1.png" alt=""/></figure>



<h4 class="wp-block-heading">b. Sau khi kích hoạt Load Balancing</h4>



<p class="wp-block-paragraph">Sau khi kích hoạt, băng thông của WAN 1 (30Mbps) và WAN 2 (70Mbps) được gộp lại. Speedtest ra được 100Mbps. Ngon lành!</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-load-balancing-speed-test-2.png" alt=""/></figure>



<h4 class="wp-block-heading">c. WAN 1 mất kết nối</h4>



<p class="wp-block-paragraph">Như đã chia sẻ ở đầu bài, chế độ Load Balancing mặc định sẽ hoạt động như một giải pháp Failover khi 1 trong 2 cổng WAN mất kết nối.</p>



<p class="wp-block-paragraph">Mình kiểm tra thử bằng cách vào mục Interfaces trong Menu Status, sau đó bấm Release WAN1 để ngắt kết nối WAN 1.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-load-balancing-11-1.png" alt=""/></figure>



<p class="wp-block-paragraph">Lúc này pfSense chỉ còn sử dụng đường truyền WAN 2 (70Mbps). Kiểm tra Speedtest cho ra tốc độ đúng như thông số.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-load-balancing-speed-test-3.png" alt=""/></figure>



<h2 class="wp-block-heading">IV. Cấu hình Failover</h2>



<p class="wp-block-paragraph">Thao tác cấu hình Failover gần như y hệt cấu hình Load Balancing. Khác biệt duy nhất là ở mục thiết lập thông số Gateway Priority khi tạo Gateway Group.</p>



<ul class="wp-block-list">
<li>WAN 1: Tier 1</li>



<li>WAN 2: Tier 2</li>
</ul>



<p class="wp-block-paragraph">WAN 1 sẽ được sử dụng làm đường truyền chính, WAN 2 để dự phòng và chỉ được sử dụng khi WAN 1 mất kết nối.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-failover-1.png" alt=""/></figure>



<p class="wp-block-paragraph">Thac tác 2-3-4 thao tác y hệt như mục Cấu hình Load Balancing ở trên nên mình sẽ không nhắ lại.</p>



<h2 class="wp-block-heading">V. Tổng kết</h2>



<p class="wp-block-paragraph">Thông thường với hệ thống mạng Dual-WAN, bạn nên thiết lập 3 Gateway Groups:</p>



<ul class="wp-block-list">
<li><strong>Load Balance</strong>: Gateways của WAN1 và WAN2 cùng Tier 1</li>



<li><strong>PreferWAN1</strong>: Gateway của WAN1: Tier 1 và WAN2: Tier 2</li>



<li><strong>PreferWAN2</strong>: Gateway for WAN1: Tier và WAN2: Tier 1</li>
</ul>



<p class="wp-block-paragraph">Tuỳ theo nhu cầu sử dụng mà bạn chọn Gateway Group tương ứng. Ví dụ:</p>



<ul class="wp-block-list">
<li>LAN: dùng Load Balancing</li>



<li>VLAN 10: Dùng Failover WAN1</li>



<li>VLAN 20: Dùng Failover WAN2</li>
</ul>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Bài viết kết thúc ở đây</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p class="wp-block-paragraph">Nguồn: thuanbui</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>pfSense Lab – Phần 9 &#8211; Cấu Hình Giới Hạn Băng Thông Mạng LAN</title>
		<link>https://blntech.io.vn/pfsense-lab-phan-9-cau-hinh-gioi-han-bang-thong-mang-lan/</link>
		
		<dc:creator><![CDATA[nhanvph]]></dc:creator>
		<pubDate>Fri, 29 May 2026 09:55:00 +0000</pubDate>
				<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[pfSense]]></category>
		<category><![CDATA[Seri pfSense]]></category>
		<guid isPermaLink="false">https://blntech.io.vn/?p=1763</guid>

					<description><![CDATA[Tiếp tục seri về pfSense, bài viết [Phần 9] hôm nay sẽ giới thiệu cách giới hạn băng thông cho các [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Tiếp tục seri về pfSense, bài viết [Phần 9] hôm nay sẽ giới thiệu cách giới hạn băng thông cho các máy khách trong mạng LAN của pfSense.</p>



<p class="wp-block-paragraph">Sơ đồ Lab sử dụng cho bài viết này như hình ở đầu bài:</p>



<ul class="wp-block-list">
<li>pfSense đóng vai trò Router chính, cung cấp Internet cho hai máy tính trong mạng LAN: Windows 10 và Arch Linux 2.</li>



<li>Mình sẽ cấu hình giới hạn băng thông trên cổng mạng LAN của pfSense:
<ul class="wp-block-list">
<li>Download: 10Mbps</li>



<li>Upload: 50Mbps</li>
</ul>
</li>
</ul>



<p class="wp-block-paragraph">Sau khi cấu hình giới hạn băng thông, các máy tính trong mạng LAN sẽ không thể vượt quá hạn mức đã thiết lập trên pfSense.</p>



<p class="wp-block-paragraph">Tính năng giới hạn băng thông của pfSense được quản lý bởi dịch vụ Limiter thuộc phần Traffic Shaper. Chúng ta cần tạo 2 quy tắc giới hạn băng thông: 1 dành cho Download và 1 dành cho Upload.</p>



<h2 class="wp-block-heading">1. Tạo Upload Limiter</h2>



<p class="wp-block-paragraph">Từ Menu Firewall, chọn Traffic Shaper, chọn tiếp tab Limiters.</p>



<p class="wp-block-paragraph">Bấm vào New Limiter để thiết lập quy tắc giới hạn mới</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-gioi-han-bang-thong-2.png" alt=""/></figure>



<p class="wp-block-paragraph">Thiết lập thông số:</p>



<ul class="wp-block-list">
<li>Bấm chọn Enable limiter and its childer mở chế độ giới hạn băng thông.</li>



<li>Name: Upload</li>



<li>Bandwidth: 50 Mbit/s</li>



<li><strong>Mask: Source addresses</strong></li>



<li>Description: Limit Upload Bandwidth</li>
</ul>



<p class="wp-block-paragraph">Phần còn lại để trống. Bấm Save</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-gioi-han-bang-thong-3.png" alt=""/></figure>



<h2 class="wp-block-heading">2. Tạo Download Limiter</h2>



<p class="wp-block-paragraph">Lập lại thao tác tương tự để tạo Download Limiter</p>



<ul class="wp-block-list">
<li>Bandwidth: 10Mbit/s</li>



<li><strong>Mask: Destination addresses</strong></li>
</ul>



<p class="wp-block-paragraph">Bấm Save. Sau đó bấm tiếp Apply Changes để kích hoạt Limiter.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-gioi-han-bang-thong-4.png" alt=""/></figure>



<h2 class="wp-block-heading">3. Cập nhật Firewall Rule</h2>



<p class="wp-block-paragraph">Tiếp theo, mình vào Firewall Rule của LAN và chỉnh sửa lại thông số.</p>



<p class="wp-block-paragraph">Bấm vào biểu tượng bút chì của Firewall Rule hiện tại của mạng LAN để chỉnh sửa</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-gioi-han-bang-thong-5.png" alt=""/></figure>



<p class="wp-block-paragraph">Kéo xuống dưới, bấm vào nút Display Advanced để hiện ra các thông số cấu hình nâng cao.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-gioi-han-bang-thong-6.png" alt=""/></figure>



<p class="wp-block-paragraph">Mục In / Out pipe: Chọn Upload ở mục bên trái và Download ở mục bên phải. Bấm Save để lưu lại.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-gioi-han-bang-thong-7.png" alt=""/></figure>



<p class="wp-block-paragraph">Bấm Apply changes để kích hoạt sửa đổi.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-gioi-han-bang-thong-8.png" alt=""/></figure>



<h2 class="wp-block-heading">4. Kiểm tra</h2>



<p class="wp-block-paragraph">Mình sử dụng dịch vụ&nbsp;<a href="https://speedtest.vn/" rel="noreferrer noopener" target="_blank">Speedtest.vn</a>&nbsp;để kiểm tra băng thông mạng trên máy tính chạy Windows 10 nằm trong mạng LAN của pfSense.</p>



<p class="wp-block-paragraph">Dưới đây là kết quả đo tốc độ mạng trước khi thiết lập giới hạn băng thông: Download và Upload đều đạt tối đa ~ 150Mbps</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-gioi-han-bang-thong-1.png" alt=""/></figure>



<p class="wp-block-paragraph">Sau khi thiết lập giới hạn băng thông, truy cập Speedtest.vn để kiểm tra lại. Kết quả hiện ra đúng như thông số đã thiết lập: Download ~ 10Mbps và Upload ~ 50Mbps</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-gioi-han-bang-thong-9.png" alt=""/></figure>



<p class="wp-block-paragraph">Trên đây chỉ là ví dụ đơn giản cách thiết lập giới han băng thông trên pfSense. Trong điều kiện thực tế, bạn có thể kết hợp sử dụng thêm tính năng Schedule và VLAN của pfSense để cấu hình giới hạn băng thông chi tiết và hiệu quả hơn cho mạng nội bộ.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p class="wp-block-paragraph">Nguồn: thuanbui</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>pfSense Lab – Phần 8 &#8211; Cấu hình PPPoE Server, PPPoE Client</title>
		<link>https://blntech.io.vn/pfsense-lab-phan-8-cau-hinh-pppoe-server-pppoe-client/</link>
		
		<dc:creator><![CDATA[nhanvph]]></dc:creator>
		<pubDate>Fri, 29 May 2026 09:47:19 +0000</pubDate>
				<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[pfSense]]></category>
		<category><![CDATA[Seri pfSense]]></category>
		<guid isPermaLink="false">https://blntech.io.vn/?p=1761</guid>

					<description><![CDATA[Trong series&#160;pfSense Lab&#160;đang chia sẻ, mình thiết lập pfSense trên máy ảo Hyper-V, kết nối đến Router Mikrotik. Do đó, [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Trong series&nbsp;pfSense Lab&nbsp;đang chia sẻ, mình thiết lập pfSense trên máy ảo Hyper-V, kết nối đến Router Mikrotik. Do đó, cổng WAN của pfSense được mình cấu hình Static IP thay vì sử dụng PPPoE Client.</p>



<p class="wp-block-paragraph">Để học cách cấu hình PPPoE Client trên pfSense, mình cần phải tạo thêm PPPoE Server trong mạng ảo. pfSense có thể được cấu hình làm PPPoE Client lẫn PPPoE Server nên mình sẽ tạo thêm 1 máy ảo pfSense và thiết lập lại mạng ảo cho pfSense Lab &#8211; [Phần 8] như dưới đây:</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-pppoe.png" alt=""/></figure>



<p class="wp-block-paragraph">Việc tạo thêm 1 bản sao máy ảo pfSense chỉ mất khoảng 5’ sử dụng tính năng tạo bản sao máy ảo của Hyper-V. </p>



<p class="wp-block-paragraph">Các bạn có thể tham khảo bài hướng dẫn : <strong><a href="https://blntech.io.vn/huong-dan-clone-tao-ban-sao-may-ao-tren-hyper-v/" target="_blank" rel="noreferrer noopener">Hướng dẫn clone (tạo bản sao) máy ảo trên Hyper-V</a></strong></p>



<ul class="wp-block-list">
<li>PPPoE Server:
<ul class="wp-block-list">
<li>WAN —&gt; Mikrotik Router</li>



<li>LAN —&gt; Private Switch</li>
</ul>
</li>



<li>PPPoE Client:
<ul class="wp-block-list">
<li>WAN —&gt; Private Switch (nối với PPPoE Server)</li>



<li>LAN —&gt; Private Switch (nối với máy ảo Arch Linux)</li>
</ul>
</li>
</ul>



<h2 class="wp-block-heading">1. Cấu hình PPPoE Server</h2>



<p class="wp-block-paragraph">Để cấu hình PPPoE server cho pfSense, truy cập vào dịch vụ PPPoE Server trong menu Services</p>



<p class="wp-block-paragraph">Bấm vào nút Add để tạo PPPoE Server</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-pppoe-server-1.png" alt=""/></figure>



<p class="wp-block-paragraph">Bấm vào&nbsp;<code>Enable PPPoE Server</code>&nbsp;để kích hoạt.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-pppoe-server-2.png" alt=""/></figure>



<p class="wp-block-paragraph">Phần cấu hình PPPoE Server, bạn cần nhập vào các thông số như sau:</p>



<ul class="wp-block-list">
<li><strong>Interface</strong>: chọn LAN, hoặc bạn có thể chọn VLAN nếu muốn dùng VLAN cho PPPoE Client</li>



<li><strong>Total User Count</strong>: số lượng PPPoE Client có thể kết nối đồng thời</li>



<li><strong>User Max Logins</strong>: cho phép 1 tài khoản PPPoE Client có thể đăng nhập trên nhiều thiết bị cùng lúc. Chọn 1 : chỉ cho phép 1 tài khoản sử dụng ở 1 thời điểm.</li>



<li><strong>Server address</strong>: Chọn địa chỉ IP bất kỳ, miễn sao không trùng lập với các dải IP đã thiết lập trên pfSense</li>



<li><strong>Remote Address Range</strong>: Địa chỉ IP dùng cho PPPoE Client, cần phải khác Subnet với Server address.</li>



<li><strong>Subnet Mask</strong>: xác định Subnet. Mình chọn 24</li>



<li><strong>Description</strong>: PPPoE Server</li>
</ul>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-pppoe-server-3.png" alt=""/></figure>



<p class="wp-block-paragraph">Bạ có thể để trống phần RADIUS nếu không dùng RADIUS Server. Kéo tiếp xuống phần User table để tạo tài khoản cho PPPoE Client</p>



<ul class="wp-block-list">
<li>Username: tên tài khoản</li>



<li>Password: mật khẩu</li>



<li>IP Address: địa chỉ IP sẽ được cấp cho tài khoản này khi đăng nhập thành công.</li>
</ul>



<p class="wp-block-paragraph">Bấm Save để lưu lại</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-pppoe-server-4.png" alt=""/></figure>



<p class="wp-block-paragraph">Bấm Apply Changes để kích hoạt các thông số vừa tạo trên PPPoE Server.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-pppoe-server-5.png" alt=""/></figure>



<p class="wp-block-paragraph">PPPoE đã được kích hoạt thành công và đang hoạt động.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-pppoe-server-6.png" alt=""/></figure>



<p class="wp-block-paragraph">Để kiểm tra xem có PPPoE Client nào đang kết nối vào PPPoE Server không, bạn truy cập vào mục Systems Logs trong Menu Status. Sau đó chọn tab PPPoE/L2TP Server.</p>



<p class="wp-block-paragraph">Các thông tin đăng nhập sẽ hiện ra trong mục PPPoE Logins</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-pppoe-server-7.png" alt=""/></figure>



<h2 class="wp-block-heading">2. Cấu hình PPPoE Client</h2>



<p class="wp-block-paragraph">Phần này sẽ được cấu hình trên máy ảo pfSense thiết lập làm PPPoE Client.</p>



<p class="wp-block-paragraph">Truy cập vào mục WAN trong Menu Interfaces và cấu hình thông số</p>



<ul class="wp-block-list">
<li><strong>IPv4 Configuration Type</strong>: PPPoE</li>



<li><strong>Username</strong>: điền vào tên tài khoản đã thiết lập trong PPPoE Server</li>



<li><strong>Password</strong>: điền vào mật khẩu tương ứng.</li>
</ul>



<p class="wp-block-paragraph">Nếu bạn sử dụng pfSense làm router chính trong nhà thì Username và Password nhập vào tên tài khoản và mật khẩu mà nhà mạng cung cấp.</p>



<p class="wp-block-paragraph">Bấm Save.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-pppoe-client-1.png" alt=""/></figure>



<p class="wp-block-paragraph">Bấm tiếp Apply Changes.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-pppoe-client-2.png" alt=""/></figure>



<p class="wp-block-paragraph">Chờ vài giây cho PPPoE Client kết nối đến PPPoE Server. Bạn có thể kiểm tra kết nối thành công chưa bằng cách truy cập vào mục Interfaces trong menu Status.</p>



<p class="wp-block-paragraph">WAN Interface đã được kết nối thành công và được cấp IP Address&nbsp;<code>192.168.200.222</code>&nbsp;đúng như đã thiết lập trên PPPoE Server.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-pppoe-client-3.png" alt=""/></figure>



<p class="wp-block-paragraph">Tuy nhiên, hiện tại các máy ảo nằm trong mạng LAN của PPPoE Client không thể truy cập ra khỏi mạng nội bộ, không thể truy cập Internet. Lý do: chưa thiết lập Firewall Rule trên PPPoE Server cho phép kết nối từ PPPoE Client ra ngoài.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-pppoe-client-4.png" alt="Máy ảo Arch Linux trong mạng LAN của PPPoE Client không truy cập dược Internet"/><figcaption class="wp-element-caption">Máy ảo Arch Linux trong mạng LAN của PPPoE Client không truy cập dược Internet</figcaption></figure>



<h2 class="wp-block-heading">3. Tạo Firewall Rule trên PPPoE Server</h2>



<p class="wp-block-paragraph">Để cho phép các máy tính trọng mạng LAN của PPPoE Client truy cập Internet, mình cần tạo thêm Firewall Rule trên PPPoE Server như hình dưới đây</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-pppoe-client-5.png" alt="Firewall Rule cho PPPoE Server"/><figcaption class="wp-element-caption"><strong>Firewall Rule cho PPPoE Server</strong></figcaption></figure>



<p class="wp-block-paragraph">Thử lại trên máy ảo Arch Linux: kết nối Internet thành công.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-pppoe-client-6.png" alt=""/></figure>



<p class="wp-block-paragraph">[Phần 8] của series pfSense Lab đã xong. Hẹn gặp lại ở các bài viết sau, nếu có.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p class="wp-block-paragraph">Nguồn: thuanbui</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>pfSense Lab – Phần 7 &#8211; Thiết Lập Captive Portal Trên pfSense</title>
		<link>https://blntech.io.vn/pfsense-lab-phan-7-thiet-lap-captive-portal-tren-pfsense/</link>
		
		<dc:creator><![CDATA[nhanvph]]></dc:creator>
		<pubDate>Fri, 29 May 2026 09:42:18 +0000</pubDate>
				<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[pfSense]]></category>
		<category><![CDATA[Seri pfSense]]></category>
		<guid isPermaLink="false">https://blntech.io.vn/?p=1753</guid>

					<description><![CDATA[1. Captive Portal là gì? Captive Portal là một tính năng của pfSense yêu cầu người dùng phải xác thực [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">1. Captive Portal là gì?</h2>



<p class="wp-block-paragraph">Captive Portal là một tính năng của pfSense yêu cầu người dùng phải xác thực tài khoản trước khi truy cập vào hệ thống mạng. Người dùng sẽ được chuyển hướng về 1 trang web trung gian và phải đăng nhập bằng tài khoản/mật khẩu, bằng mã voucher, hoặc chỉ cần bấm vào nút Đăng nhập, sau đó mới có thể truy cập vào hệ thống mạng (thường là truy cập Internet).</p>



<p class="wp-block-paragraph">Tính năng này thường được sử dụng phổ biến trong ngành du lịch &#8211; nhà hàng &#8211; khách sạn, nhằm mục đích Marketing quảng cáo, hoặc trong văn phòng, cửa hàng bán lẻ nhằm hạn chế truy cập trái phép.</p>



<h2 class="wp-block-heading">2. Kích hoạt Captive Portal</h2>



<p class="wp-block-paragraph">Truy cập vào mục Captive Portal trong menu Services của pfSense. Sau đó bấm vào nút Add để tạo Captive Portal Zone.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-captive-portal-1.png" alt=""/></figure>



<p class="wp-block-paragraph">Nhập vào tên (Zone name) và chú thích (Zone description). Bấm Save &amp; Continue</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-captive-portal-2.png" alt=""/></figure>



<p class="wp-block-paragraph">Bấm chọn vào ô Enable Captive Portal để kích hoạt.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-captive-portal-3.png" alt=""/></figure>



<h2 class="wp-block-heading">3. Cấu hình Captive Portal</h2>



<p class="wp-block-paragraph">Sau khi bấm kích hoạt Captive Portal, trang cấu hình sẽ hiện ra yêu cầu bạn tuỳ chỉnh thông số. Dưới đây là giải thích các thông số quan trọng:</p>



<ul class="wp-block-list">
<li><strong>Interfaces</strong>: chọn hệ thống mạng nội bộ bạn muốn áp dụng Captive Portal. Trong điều kiện thực tế, bạn nên <a href="https://thuanbui.me/pfsense-lab-cau-hinh-vlan-pfsense/">tạo 1 VLAN riêng biệt</a> để dùng cho Captive Portal. Mình chọn LAN cho đơn giản.</li>



<li><strong>Maximum Concurrent connections</strong>: giới hạn số lượt truy cập cùng lúc từ 1 IP, không phải giối hạn số lượng người dùng.</li>



<li><strong>Idle timeout (Minutes)</strong>: tự động ngắt kết nối sau khoảng thời gian không hoạt động.</li>



<li><strong>After authentication Redirection URL</strong>: tự động chuyển hướng về địa chỉ này sau khi đăng nhập thành công. Mục này thường được thiết lập nếu bạn muốn quảng cáo website cho tất cả người dùng truy cập vào mạng.</li>



<li><strong>Concurrent User logins</strong>: quy định số lượng truy cập trên mỗi tài khoản
<ul class="wp-block-list">
<li>Disabled: chỉ cho phép 1 lượt đăng nhập trên mỗi tài khoản / voucher</li>



<li>Multiple: không giới hạn lượt đăng nhập trên mỗi tài khoản / voucher</li>



<li>Last login: lượt đăng nhập sau sẽ được trao quyền truy cập. Lượt truy cập trước đó sẽ bị ngắt.</li>



<li>First login: chỉ lượt đăng nhập đầu tiên có quyền truy cập. Các lượt đăng nhập sau đều không hiệu lực</li>
</ul>
</li>
</ul>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-captive-portal-4-1.jpg" alt=""/></figure>



<ul class="wp-block-list">
<li><strong>Captive Portal Login Page</strong>: bạn có thể thay đổi logo và hình nền và điều khoản sử dụng của trang Portal cho phù hợp với thương hiệu của mình. Mình để mặc định cho đơn giản.</li>



<li><strong>Authentication</strong>:
<ul class="wp-block-list">
<li>Authentication method: lựa chọn cách thức xác nhận tài khoản: <em>Authentication backend</em> (sử dụng trang đăng nhập), <em>None</em> (yêu cầu bấm nút xác nhận), <em>Radius MAC Authentication</em> (xác thực bằng MAC address)</li>



<li>Authentication Server: chọn Local Database</li>
</ul>
</li>
</ul>



<p class="wp-block-paragraph">Mình chọn các xác thực bằng cách sử dụng trang đăng nhập: Authentication backend. Sau đó bấm Save để lưu lại.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-captive-portal-4-2.png" alt=""/></figure>



<h2 class="wp-block-heading">4. Tạo Voucher đăng nhập</h2>



<p class="wp-block-paragraph">Khi chọn cách thức xác thực tài khoản, bạn có thể tạo tài khoản pfSense hoặc tạo mã Voucher đăng nhập. Mình chọn cách tạo mã Voucher đăng nhập vì có thể giới hạn thời gian truy cập cho mỗi người dùng.</p>



<p class="wp-block-paragraph">Bấm qua tab Voucher, kích hoạt mục&nbsp;<em>Enable the creation, generation and activate of rolls with vouchers</em>&nbsp;và bấm Save.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-captive-portal-6.png" alt=""/></figure>



<p class="wp-block-paragraph">Bấm vào nút Generate new keys để tạo mã bảo mật mới. Các thông số còn lại có thể giữ nguyên. Bấm Save để lưu lại.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-captive-portal-7.png" alt=""/></figure>



<p class="wp-block-paragraph">Mục Voucher Rolls sẽ hiện ra thêm nút Add. Bấm vào nó để tạo danh sách voucher.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-captive-portal-8.png" alt=""/></figure>



<p class="wp-block-paragraph">Điền vào các thông số như sau và bấm Save</p>



<ul class="wp-block-list">
<li><strong>Roll #</strong>: điền bất kỳ số nào trong khoảng 0 &#8211; 65535</li>



<li><strong>Minutes per ticket</strong>: giới hạn thời gian truy cập cho mỗi voucher</li>



<li><strong>Count</strong>: số lượng voucher cần tạo.</li>



<li>Comment: chú thích để ghi nhớ</li>
</ul>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-captive-portal-9.png" alt=""/></figure>



<p class="wp-block-paragraph">Danh sách voucher đã được tạo thành công. Bấm vào biểu tượng Excel bên trái để tải về danh sách theo định dạng csv.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-captive-portal-10.png" alt=""/></figure>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-captive-portal-11.png" alt="Danh sách 10 voucher truy cập mạng"/><figcaption class="wp-element-caption"><strong>Danh sách 10 voucher truy cập mạng</strong></figcaption></figure>



<h2 class="wp-block-heading">5. Điều chỉnh DHCP Server</h2>



<p class="wp-block-paragraph">Tiếp theo, bạn cần truy cập vào <a href="https://blntech.io.vn/pfsense-lab-phan-4-quan-ly-tai-khoan-cau-hinh-ssh-server-dhcp-server/" data-type="link" data-id="https://blntech.io.vn/pfsense-lab-phan-4-quan-ly-tai-khoan-cau-hinh-ssh-server-dhcp-server/" target="_blank" rel="noreferrer noopener">dịch vụ DHCP Server của pfSense</a>, chọn đúng Network Interface đã kích hoạt ở bước trên: LAN.</p>



<p class="wp-block-paragraph">Kéo xuống phần DNS Servers và xoá hết địa chỉ IP nếu có. Captive Portal yêu cầu phải sử dụng DNS Server mặc định của pfSense. Nếu bỏ qua bước này, người dùng sẽ không được tự động chuyển hướng về trang Captive Portal để đăng nhập sử dụng mạng.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-captive-portal-5.png" alt=""/></figure>



<h2 class="wp-block-heading">6. Thực nghiệm Captive Portal</h2>



<p class="wp-block-paragraph">Do mình đang sử dụng pfSense trong nền tảng ảo hoá nên việc thực nghiệm Captive Portal sẽ được thực hiện trên máy ảo Windows 10 kết nối vào mạng LAN của pfSense.</p>



<p class="wp-block-paragraph">Mở Edge, truy cập google.com, trình duyệt tự động chuyển hướng qua trang đăng nhập với logo pfSense.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-captive-portal-13.jpg" alt="Đăng nhập bằng voucher và bấm Login"/><figcaption class="wp-element-caption"><strong>Đăng nhập bằng voucher và bấm Login</strong></figcaption></figure>



<p class="wp-block-paragraph">Video minh hoạ dưới đây</p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe title="pfsense Captive Portal" width="1200" height="675" src="https://www.youtube.com/embed/BsWyAaDeGPY?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<p class="wp-block-paragraph">Bạn có thể kiểm tra danh sách truy cập vào Captive Portal trên giao diện quản lý của pfSense: bấm vào Status —&gt; Captive Portal.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-captive-portal-12.png" alt="Danh sách người dùng đang đăng nhập."/><figcaption class="wp-element-caption"><strong>Danh sách người dùng đang đăng nhập.</strong></figcaption></figure>



<p class="wp-block-paragraph">Bạn có thể kiểm tra danh sách Voucher đang sử dụng, kiểm tra Voucher hay vô hiệu hoá Voucher trong trang quản lý này. Hoặc bấm vào nút Disconnect All Users để kick hết mọi tài khoản ra khỏi mạng.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p class="wp-block-paragraph">Nguồn: thuanbui</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>pfSense Lab – Phần 6 &#8211; Cấu Hình Dynamic DNS</title>
		<link>https://blntech.io.vn/pfsense-lab-phan-6-cau-hinh-dynamic-dns/</link>
		
		<dc:creator><![CDATA[nhanvph]]></dc:creator>
		<pubDate>Fri, 29 May 2026 09:22:52 +0000</pubDate>
				<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[pfSense]]></category>
		<category><![CDATA[Seri pfSense]]></category>
		<guid isPermaLink="false">https://blntech.io.vn/?p=1751</guid>

					<description><![CDATA[Trong [Phần 6] của series pfSense Lab, mình chia sẻ cách cấu hình Dynamic DNS trên pfSense để cập nhật [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Trong [Phần 6] của series pfSense Lab, mình chia sẻ cách cấu hình Dynamic DNS trên pfSense để cập nhật Public IP tự động cho tên miền của bạn.</p>



<p class="wp-block-paragraph">pfSense có sẵn tính năng Dynamic DNS cực kỳ mạnh mẽ, hỗ trợ rất nhiều các dịch vụ DNS phổ biến: Cloudflare, DigitalOcean, GoDaddy, FreeDNS, OpenDNS, Linode,… Mình sẽ sử dụng dịch vụ DNS của Cloudflare trong bài hướng dẫn này.</p>



<h2 class="wp-block-heading">1. Yêu cầu</h2>



<ul class="wp-block-list">
<li>Đã có sẵn tên miền và đã có tài khoản Cloudflare.</li>



<li>Tên miền đã được chuyển về CloudFlare quản lý</li>



<li>Router pfSense</li>
</ul>



<h2 class="wp-block-heading">2. Tạo A Record cho tên miền</h2>



<p class="wp-block-paragraph">Ví dụ mình muốn sử dụng tên miền&nbsp;<code>pfsense.thuanbui.me</code>&nbsp;để truy cập đến homelab ở nhà. Bấm vào Add record và tạo một A record mới.</p>



<ul class="wp-block-list">
<li>Name: điền vào <code>pfsense</code></li>



<li>IPv4: điền tạm <code>1.1.1.1</code>, thông số này sẽ được tự động cập nhật thành Public IP ở nhà sau khi thiết lập Dynamic DNS trên pfSense</li>
</ul>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-dynamic-dns-4.png" alt="Mình tạo tên miền pfsense.thuanbui.me, tạm thời trỏ về 1.1.1.1"/><figcaption class="wp-element-caption"><strong>Mình tạo tên miền pfsense.thuanbui.me, tạm thời trỏ về 1.1.1.1</strong></figcaption></figure>



<h2 class="wp-block-heading">3. Tìm Zone ID và tạo API Token</h2>



<p class="wp-block-paragraph">Tham khảo bài viết: <strong><a href="https://blntech.io.vn/cloudflare-huong-dan-lay-zone-id-va-api-token/" target="_blank" rel="noreferrer noopener">Cloudflare: Hướng dẫn lấy Zone ID và tạo API Token nhanh chóng</a></strong></p>



<h2 class="wp-block-heading">4. Tạo Dynamic DNS Client</h2>



<p class="wp-block-paragraph">Truy cập vào dịch vụ Dynamic DNS từ menu Services —&gt; Dynamic DNS. Bấm Add</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-dynamic-dns-1.png" alt=""/></figure>



<p class="wp-block-paragraph">Nhập thông số cho DNS Dynamic Client</p>



<ul class="wp-block-list">
<li>Service Type: mình chọn Cloudflare. Bạn có thể chọn dịch vụ DNS khác đang sử dụng</li>



<li>Interface to monitor: WAN</li>



<li>Hostname: nhập vào tên miền cần cập nhật Dynamc DNS.</li>



<li>Cloudflare Proxy: Tick chọn Enable Proxy để ẩn Public IP của mạng nhà.</li>



<li>Username: Tuỳ theo dịch vụ bạn chọn ở mục Service Type mà thông số Username này sẽ khác nhau. Với Cloudflare, mình cần nhập vào Zone ID của tên miền (đã ghi lại ở bước 4)</li>



<li>Password: nhập vào API Token của Cloudflare (đã tạo ở bước 3)</li>



<li>TTL: có thể để trống</li>



<li>Description: nhập nội dung tuỳ thích để ghi nhớ</li>
</ul>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-dynamic-dns-2.png" alt="Nhập vào thông số cho DNS Dynamic Client"/><figcaption class="wp-element-caption"><strong>Nhập vào thông số cho DNS Dynamic Client</strong></figcaption></figure>



<p class="wp-block-paragraph">Bấm Save để lưu lại.</p>



<p class="wp-block-paragraph">pfSense sẽ tự động kết nối đến Cloudflare thông qua API Token và Zone ID để cập nhật Zone DNS cho tên miền&nbsp;<code>pfsense.thuanbui.me</code></p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-dynamic-dns-3.png" alt="Tạo Dynamic DNS Client thành công cho tên miền pfsense.thuanbui.me"/><figcaption class="wp-element-caption"><strong>Tạo Dynamic DNS Client thành công cho tên miền pfsense.thuanbui.me</strong></figcaption></figure>



<p class="wp-block-paragraph">Kiểm tra lại trên Cloudflare, tên miền đã được trỏ về Public IP ở nhà, giống với Cache IP hiển thị trong pfSense.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-dynamic-dns-5.png" alt=""/></figure>



<p class="wp-block-paragraph">pfSense không cho chỉnh tần suất cập nhật Dynamic DNS nên mình không rõ bao lâu nó sẽ chạy 1 lần. Có lẽ hệ thống nó đủ thông minh để cập nhật mỗi khi IP ở nhà có sự thay đổi.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p class="wp-block-paragraph">Nếu mạng nhà không sử dụng pfSense, bạn có thể cập nhật Dynamic DNS lên Cloudflare bằng cách dùng Bash Script trên Linux theo hướng dẫn dưới đây</p>



<p class="wp-block-paragraph"><strong><a href="https://blntech.io.vn/cap-nhat-ip-dong-cho-ten-mien-qua-cloudflare/" target="_blank" rel="noreferrer noopener">Cập Nhật IP Động Cho Tên Miền Qua CloudFlare</a></strong></p>



<p class="wp-block-paragraph">Chúc bạn thực hiện thành công!</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>pfSense Lab – Phần 5 &#8211; Cấu Hình VLAN Cho pfSense</title>
		<link>https://blntech.io.vn/pfsense-lab-phan-5-cau-hinh-vlan-cho-pfsense/</link>
		
		<dc:creator><![CDATA[nhanvph]]></dc:creator>
		<pubDate>Fri, 29 May 2026 09:16:32 +0000</pubDate>
				<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[pfSense]]></category>
		<category><![CDATA[Seri pfSense]]></category>
		<guid isPermaLink="false">https://blntech.io.vn/?p=1759</guid>

					<description><![CDATA[I. VLAN là gì? Trước khi đi chi tiết vào cách cấu hình VLAN trên pfSense, mình ôn lại kiến [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">I. VLAN là gì?</h2>



<p class="wp-block-paragraph">Trước khi đi chi tiết vào cách cấu hình VLAN trên pfSense, mình ôn lại kiến thức căn bản tí.</p>



<p class="wp-block-paragraph">VLAN (Virtual Local Area Network) hay Virtual LAN, được gọi là mạng LAN ảo. VLAN là công nghệ cho phép tạo ra các mạng LAN logic độc lập trên cùng một hệ thống mạng LAN vật lý. VLAN giúp chia nhỏ hệ thống mạng nội bộ, mang lại các lợi ích sau:</p>



<ul class="wp-block-list">
<li><strong>Tối ưu băng thông mạng</strong>: nhờ giảm số lượng miền quảng bá (broadcast domain)</li>



<li><strong>Tăng tính bảo mật</strong>: các VLAN không thể giao tiếp với nhau, trừ khi được cấu hình Routing trên Router.</li>



<li><strong>Tính linh hoạt cao</strong>: dễ dàng quản lý và thay đổi các thiết bị nằm trong VLAN.</li>
</ul>



<p class="wp-block-paragraph">Để có thể thiết lập VLAN trong mạng nội bộ, Router và Switch phải hỗ trợ tính năng VLAN trong Firmware. Tính năng này thường chỉ được trang bị trên các thiết bị mạng cao cấp dành cho doanh nghiệp (Enterprise), không có trong các thiết bị mạng cho gia đình và văn phòng nhỏ.</p>



<p class="wp-block-paragraph">Trong môi trường doanh nghiệp, VLAN thường được dùng để phân chia mạng nội bộ giữa các phòng ban, chi nhánh. Còn trong gia đình, VLAN có thể được sử dụng để phân tách các thiết bị IOT (Internet of Things) ra khỏi mạng nội bộ chính trong nhà.</p>



<h2 class="wp-block-heading">II. Sơ đồ thiết lập VLAN</h2>



<p class="wp-block-paragraph">Nhờ sự phát triển của công nghệ ảo hoá, mình có thể nghiên cứu và thực hành VLAN mà không cần phải đầu tư mua thêm thiết bị mạng cao cấp. pfSense có sẵn tính năng VLAN và Virtual Switch của Hyper-V cũng hỗ trợ VLAN, bắt tay nghiên cứu nào!</p>



<p class="wp-block-paragraph">Dưới đây sơ đồ thiết lập VLAN trên pfSense của mình</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-vlan.png" alt=""/></figure>



<p class="wp-block-paragraph">Mình sẽ tạo thêm VLAN ID 10 và chuyển máy ảo Arch Linux 2 sử dụng VLAN 10 mới này.</p>



<p class="wp-block-paragraph">Các bước cần làm trong Lab hôm nay:</p>



<ul class="wp-block-list">
<li>Tạo VLAN ID 10</li>



<li>Cấu hình VLAN Interface</li>



<li>Cấu hình DHCP Server cho VLAN 10</li>



<li>Cấu hình VLAN ID cho máy ảo Arch Linux</li>



<li>Cấu hình VLAN TRUNK cho cổng mạng Internal trên pfSense</li>



<li>Kiểm tra thành quả</li>
</ul>



<h2 class="wp-block-heading">III. Tạo VLAN 10</h2>



<p class="wp-block-paragraph">Trong Web UI của pfSense, truy cập vào menu Interfaces, chọn Assigments</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-vlan-2.png" alt="Bấm chọn tab VLANs, sau đó bấm Add để tạo VLAN mới"/><figcaption class="wp-element-caption"><strong>Bấm chọn tab VLANs, sau đó bấm Add để tạo VLAN mới</strong></figcaption></figure>



<p class="wp-block-paragraph">Chỉnh thông số VLAN:</p>



<ul class="wp-block-list">
<li>Parent Interface: chọn hn1 &#8211; lan</li>



<li>VLAN tag: 10</li>



<li>VLAN Priority: 0</li>



<li>Description: VLAN 10</li>
</ul>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-vlan-3.png" alt="Bấm Save để lưu lại"/><figcaption class="wp-element-caption"><strong>Bấm Save để lưu lại</strong></figcaption></figure>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-vlan-4.png" alt="VLAN tag 10 đã tạo thành công."/><figcaption class="wp-element-caption"><strong>VLAN tag 10 đã tạo thành công.</strong></figcaption></figure>



<h2 class="wp-block-heading">IV. Cấu hình VLAN Interface</h2>



<p class="wp-block-paragraph">Bấm vào tab Interface Assignments, bạn sẽ thấy có thêm 1 dòng Available network ports: <strong>VLAN 10 on hn1 &#8211; lan (VLAN 10)</strong></p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-vlan-5.png" alt="Bấm vào nút Add bên cạnh VLAN 10 để tạo VLAN Interface"/><figcaption class="wp-element-caption"><strong>Bấm vào nút Add bên cạnh VLAN 10 để tạo VLAN Interface</strong></figcaption></figure>



<p class="wp-block-paragraph">pfSense sẽ tự động tạo 1 Network Interface mới với tên gọi OPT1. Bấm vào chữ OPT1 để thay đổi thông số</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-vlan-6.png" alt="Bấm vào OPT1"/><figcaption class="wp-element-caption">Bấm vào OPT1</figcaption></figure>



<p class="wp-block-paragraph">Chỉnh lại các thông số như sau và bấm Save</p>



<ul class="wp-block-list">
<li>Enable: Tick chọn Enable interface</li>



<li>IPv4 Configuration Type: Static IPv4</li>



<li>IPv4 Address: 10.0.10.1 / 24</li>
</ul>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-vlan-7.png" alt="Thiết lập thông số cho VLAN 10"/><figcaption class="wp-element-caption"><strong>Thiết lập thông số cho VLAN 10</strong></figcaption></figure>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-vlan-8.png" alt="Bấm Apply Changes để kích hoạt VLAN 10."/><figcaption class="wp-element-caption"><strong>Bấm Apply Changes để kích hoạt VLAN 10.</strong></figcaption></figure>



<h2 class="wp-block-heading">V. Cấu hình DHCP Server cho VLAN</h2>



<p class="wp-block-paragraph">Tiếp tục, cần phải cấu hình DHCP Server cho VLAN Interface vừa mới tạo để các máy tính nằm trong VLAN được cấp IP tự động.</p>



<p class="wp-block-paragraph">Truy cập vào dịch vụ DHCP Server nằm trong menu Services, chọn qua tab VLAN10 để cấu hình.</p>



<ul class="wp-block-list">
<li>Enable: Tick chọn Enable DHCP server on VLAN10 Interface</li>



<li>Range: 10.0.10.101 &#8211; 10.0.10.199</li>



<li>DNS: 1.1.1.1 và 1.0.0.1</li>
</ul>



<p class="wp-block-paragraph">Sau đó bấm Save để lưu lại.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-vlan-9.png" alt="Cấu hình DHCP Server cho VLAN 10"/><figcaption class="wp-element-caption"><strong>Cấu hình DHCP Server cho VLAN 10</strong></figcaption></figure>



<p class="wp-block-paragraph">VLAN 10 đã được tạo và cấu hình DHCP thành công.</p>



<h2 class="wp-block-heading">VI. Cập nhật VLAN ID cho máy ảo</h2>



<p class="wp-block-paragraph">Để chuyển máy ảo Arch Linux 2, mình sẽ vào Setttings của máy ảo này, truy cập vào mục Network Adapter và đổi VLAN thành 10.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-vlan-10.png" alt="Đổi VLAN ID cho máy ảo và bấm OK để lưu lại."/><figcaption class="wp-element-caption"><strong>Đổi VLAN ID cho máy ảo và bấm OK để lưu lại.</strong></figcaption></figure>



<h2 class="wp-block-heading">VII. Thiết lập VLAN Trunk cho pfSense</h2>



<p class="wp-block-paragraph">Để pfSense có thể truyền tải VLAN trong mạng nội bộ, cần phải cấu hình đổi chế độ hoạt động của Network Adapter (card mạng) kết nối vào Private Switch thành Trunk Mode.</p>



<p class="wp-block-paragraph">Việc thiết lập VLAN Trunk bắt buộc phải sử dụng dòng lệnh trong PowerShell. Không thể điều chỉnh trên Hyper-V Manager được.</p>



<p class="wp-block-paragraph">Bạn cần mở PowerShell (Run as Administrator) và làm theo các bước sau</p>



<h3 class="wp-block-heading">1. Kiểm tra thông số VLAN</h3>



<p class="wp-block-paragraph">Kiểm tra thông số VLAN của các máy ảo trong mạng bằng lệnh sauTerminal window</p>



<pre class="wp-block-code"><code>Get-VMNetworkAdapterVlan -VMName "(Tên của máy ảo)"</code></pre>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-vlan-11.png" alt=""/></figure>



<p class="wp-block-paragraph">Kết quả nhận được khi kiểm tra 3 máy ảo pfSense, Arch Linux và Arch Linux 2 như sau:</p>



<ul class="wp-block-list">
<li>Arch Linux: Mode Untagged (không sử dụng VLAN)</li>



<li>Arch Linux: Mode Access &#8211; Vlanlist 10 (sử dụng VLAN 10)</li>



<li>pfSense: Mode Untagged</li>
</ul>



<h3 class="wp-block-heading">2. Đổi tên Network Adapter của pfSense</h3>



<p class="wp-block-paragraph">Hiện tại cả hai Network Adapter của pfSense đều sử dụng tên giống nhau: “Network Adapter”. Mình cần phải đổi thành hai tên khác nhau thì mới cấu hình VLAN chính xác.</p>



<p class="wp-block-paragraph">Kiểm tra tên của Network Adapter của máy ảo pfSenseTerminal window</p>



<pre class="wp-block-code"><code>Get-VMNetworkAdapterVlan -VMName "pfSense Firewall (test)"</code></pre>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-vlan-12.png" alt=""/></figure>



<p class="wp-block-paragraph">Thay đổi tên của Network Adapter thành&nbsp;<code>Internal</code>&nbsp;và&nbsp;<code>External</code>&nbsp;dựa theo Mac AddressTerminal window</p>



<pre class="wp-block-code"><code>Get-VMNetworkAdapter -VMName "pfSense Firewall (test)" | Where-Object MacAddress -EQ "00155D006426"| Rename-VMNetworkAdapter -NewName "Internal"Get-VMNetworkAdapter -VMName "pfSense Firewall (test)" | Where-Object MacAddress -EQ "00155D006425"| Rename-VMNetworkAdapter -NewName "External"</code></pre>



<p class="wp-block-paragraph">Kiểm tra lại xem tên Adapter đã thay đổi đúng chưa?Terminal window</p>



<pre class="wp-block-code"><code>Get-VMNetworkAdapterVlan -VMName "pfSense Firewall (test)"</code></pre>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-vlan-13.png" alt="2 Network Adapter đã đổi tên thành External và Internal"/><figcaption class="wp-element-caption"><strong>2 Network Adapter đã đổi tên thành External và Internal</strong></figcaption></figure>



<h3 class="wp-block-heading">3. Thiết lập VLAN Trunk Mode</h3>



<p class="wp-block-paragraph">Giờ mình đã có thể thay đổi VLAN Mode của Network Adapter “Internal” thành Trunk Mode với lệnh sauTerminal window</p>



<pre class="wp-block-code"><code>Set-VMNetworkAdapterVlan -VMName "pfSense Firewall (test)" -VMNetworkAdapterName "Internal" -Trunk -NativeVlanId 0 -AllowedVlanIdList 1-4094</code></pre>



<p class="wp-block-paragraph">Kiểm tra lại thông số VLANTerminal window</p>



<pre class="wp-block-code"><code>Get-VMNetworkAdapterVlan -VMName "pfSense Firewall (test)"</code></pre>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-vlan-14.png" alt="Thiết lập Trunk Mode thành công cho Internal Adapter"/><figcaption class="wp-element-caption"><strong>Thiết lập Trunk Mode thành công cho Internal Adapter</strong></figcaption></figure>



<p class="wp-block-paragraph">pfSense đã sẵn sàng phân chia VLAN cho mạng nội bộ.</p>



<h2 class="wp-block-heading">VIII. Kiểm tra VLAN</h2>



<h3 class="wp-block-heading">1. Trước khi thiết lập VLAN</h3>



<p class="wp-block-paragraph">Dưới đây là thông số DHCP Leases của pfSense trước khi thiết lập VLAN 10.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-vlan-1.png" alt=""/></figure>



<p class="wp-block-paragraph">Cả hai máy ảo&nbsp;<code>thuanbui-arch</code>&nbsp;và&nbsp;<code>arch2</code>&nbsp;đều nằm chung mạng LAN nội bộ&nbsp;<code>10.0.0.0/24</code>&nbsp;với IP lần lượt là&nbsp;<code>10.0.0.101</code>&nbsp;và&nbsp;<code>10.0.0.102</code></p>



<h3 class="wp-block-heading">2. Sau khi thiết lập VLAN10</h3>



<p class="wp-block-paragraph">Mình mở lại hai máy ảo nằm trong mạng nội bộ cua pfSense. Sau đó kiểm tra lại DHCP Lease</p>



<ul class="wp-block-list">
<li>Máy ảo <code>thuanbui-arch</code> có IP như cũ <code>10.0.0.101</code></li>



<li>Máy ảo <code>arch2</code> đã đổi qua IP mới <code>10.0.10.101</code> do mình đã đổi nó qua VLAN10 mới thiết lập.</li>
</ul>



<p class="wp-block-paragraph">Ở bước sau mình sẽ thiết lập Firewall để VLAN10 có thể truy cập Internet và chặn kết nối giữa LAN và VLAN.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-vlan-15.png" alt=""/></figure>



<p class="wp-block-paragraph">Hai máy ảo tuy cùng cắm vào chung 1 Switch nhưng thuộc 2 mạng LAN khác nhau:&nbsp;<code>10.0.0.0/24</code>&nbsp;và&nbsp;<code>10.0.10.0/24</code>.</p>



<p class="wp-block-paragraph">Kiểm tra kết nối mạng bằng lệnh&nbsp;<code>ping</code></p>



<ul class="wp-block-list">
<li>Máy ảo Arch Linux 2 trong VLAN 10 không thể Ping qua máy ảo Arch Linux nhưng ở chiều ngược lại máy ảo Arch Linux có thể ping được qua máy ảo trong VLAN10</li>



<li>Máy ảo Arch Linux 2 chưa có kết nối mạng Internet trong khi máy ảo Arch Linux kết nối Internet bình thường.</li>
</ul>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-vlan-16-arch-1.png" alt=""/><figcaption class="wp-element-caption"><strong>Máy ảo Arch Linux &#8211; LAN</strong></figcaption></figure>



<h2 class="wp-block-heading">IX. Thiết lập Firewall Rule cho VLAN</h2>



<h3 class="wp-block-heading">1. Mở truy cập Internet cho VLAN10</h3>



<p class="wp-block-paragraph">Để máy ảo trong VLAN10 có thể truy cập Internet, mình cần tạo 1 Firewall Rule mới như sau</p>



<ul class="wp-block-list">
<li>Action: Pass</li>



<li>Interface: VLAN10</li>



<li>Protocol: Any</li>



<li>Source: VLAN10 net</li>



<li>Destination: Any</li>
</ul>



<p class="wp-block-paragraph">Rule này sẽ cho phép VLAN10 truy cập qua LAN. Do đó mình cần tạo thêm 1 Rule để chặn kết nối VLAN10 đến LAN và kéo nó lên đầu danh sách Rule để ưu tiên</p>



<ul class="wp-block-list">
<li>Action: Block</li>



<li>Interface: VLAN10</li>



<li>Protocol: Any</li>



<li>Source: VLAN10 net</li>



<li>Destination: LAN net</li>
</ul>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-vlan-17.png" alt="Firewal Rule cho VLAN10"/><figcaption class="wp-element-caption"><strong>Firewal Rule cho VLAN10</strong></figcaption></figure>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-vlan-18.png" alt="Máy ảo Arch Linux 2 có thể Ping ra Internet, nhưng không thể Ping qua máy ảo Arch Linux trong mạng LAN"/><figcaption class="wp-element-caption"><strong>Máy ảo Arch Linux 2 có thể Ping ra Internet, nhưng không thể Ping qua máy ảo Arch Linux trong mạng LAN</strong></figcaption></figure>



<h3 class="wp-block-heading">2. Chặn kết nối từ LAN đến VLAN10</h3>



<p class="wp-block-paragraph">Tạo Firewall Rule tương tự như bước ở trên để chặn kết nối giữa 2 mạng nội bộ</p>



<ul class="wp-block-list">
<li>Action: Block</li>



<li>Interface: LAN</li>



<li>Protocol: Any</li>



<li>Source: LAN net</li>



<li>Destination: VLAN10 net</li>
</ul>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-vlan-20.png" alt="Tạo thêm Firewall Rule chặn kết nối đến VLAN10"/><figcaption class="wp-element-caption"><strong>Tạo thêm Firewall Rule chặn kết nối đến VLAN10</strong></figcaption></figure>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-vlan-19.png" alt="Kiểm tra lại trên máy ảo Arch Linux: không thể ping đến VLAN10"/><figcaption class="wp-element-caption"><strong>Kiểm tra lại trên máy ảo Arch Linux: không thể ping đến VLAN10</strong></figcaption></figure>



<h2 class="wp-block-heading">X. Tổng kết</h2>



<p class="wp-block-paragraph">Trong bài viết này mình đã hướng dẫn cách thiết lập 1 hệ thống VLAN đơn giản sử dụng pfSense trên nền tảng ảo hoá Hyper-V. Trong điều kiện thực tế, tuỳ theo nhu cầu sử dụng, bạn có thể thiết lập thêm nhiều VLAN (tối đa 4096 VLANs) và cấu hình Firewall Rule tương ứng.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p class="wp-block-paragraph">Nguồn: thuanbui</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>pfSense Lab – Phần 4 &#8211; Quản Lý Tài Khoản, Cấu Hình SSH Server,  DHCP Server</title>
		<link>https://blntech.io.vn/pfsense-lab-phan-4-quan-ly-tai-khoan-cau-hinh-ssh-server-dhcp-server/</link>
		
		<dc:creator><![CDATA[nhanvph]]></dc:creator>
		<pubDate>Fri, 29 May 2026 09:03:00 +0000</pubDate>
				<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[pfSense]]></category>
		<category><![CDATA[Seri pfSense]]></category>
		<guid isPermaLink="false">https://blntech.io.vn/?p=1771</guid>

					<description><![CDATA[Phần này mình sẽ nghiên cứu tiếp 3 thành phần khác của pfSense: I. Tạo tài khoản quản lý pfSense [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Phần này mình sẽ nghiên cứu tiếp 3 thành phần khác của pfSense:</p>



<ul class="wp-block-list">
<li>User Manager: quản lý tài khoản quản trị pfSense</li>



<li>SSH Server: cấu hình đăng nhập SSH</li>



<li>DHCP Server: cấu hình DHCP Server cho thiết bị trong mạng nội bộ</li>
</ul>



<h2 class="wp-block-heading">I. Tạo tài khoản quản lý pfSense</h2>



<p class="wp-block-paragraph">Để tránh phải dùng tài khoản Admin mặc định, mình sẽ tạo thêm tài khoản mới để quản lý pfSense.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-user-1.jpg" alt="Truy cập vào mục User Manager trong System Menu"/><figcaption class="wp-element-caption"><strong>Truy cập vào mục User Manager trong System Menu</strong></figcaption></figure>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-user-2.png" alt="Bấm Add để tạo tài khoản mới"/><figcaption class="wp-element-caption"><strong>Bấm Add để tạo tài khoản mới</strong></figcaption></figure>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-user-3.jpeg" alt="Nhập thông tin Username, Password và chỉnh Group membership: Member of admins và bấm Save để lưu lại"/><figcaption class="wp-element-caption"><strong>Nhập thông tin Username, Password và chỉnh Group membership: Member of admins và bấm Save để lưu lại</strong></figcaption></figure>



<h2 class="wp-block-heading">II. Cấu hình SSH Server</h2>



<p class="wp-block-paragraph">Để việc quản trị dễ dàng hơn, mình sẽ mở cấu hình Secure Shell để có thể SSH vào pfSense bằng các công cụ như Terminal, SSH.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-ssh-1.jpg" alt="Bấm vào System trên Menu, chọn Advanced"/><figcaption class="wp-element-caption"><strong>Bấm vào System trên Menu, chọn Advanced</strong></figcaption></figure>



<p class="wp-block-paragraph">Truy cập đường dẫn&nbsp;<strong>System / Advanced</strong>&nbsp;và kéo xuống tới khi gặp dòng&nbsp;<strong>Secure Shell</strong>.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-ssh-2.png" alt="Kéo xuống mục Secure Shell và bấm tick vào ô Secure Shell, sau đó kéo xuống dưới cùng bấm Save để lưu lại."/><figcaption class="wp-element-caption"><strong>Kéo xuống mục Secure Shell và bấm tick vào ô Secure Shell, sau đó kéo xuống dưới cùng bấm Save để lưu lại.</strong></figcaption></figure>



<p class="wp-block-paragraph">Tiếp theo, cần phải tạo thêm 1 Firewall để mở cổng 22 cho truy cập từ WAN vào pfSense. Hiện tại pfSense chỉ mới cho phép truy cập theo cổng 443 (HTTPS) đã thiết lập trong [Phần 3].</p>



<p class="wp-block-paragraph">Bấm vào Firewall, chọn Rules, sau đó bấm Add để tạo Rule mới như sau:</p>



<ul class="wp-block-list">
<li><strong>Action</strong>: <em>Pass</em></li>



<li><strong>Interface</strong>: <em>WAN</em></li>



<li><strong>Protocol</strong>: <em>TCP</em></li>



<li><strong>Source</strong>: <em>Any</em> (hoặc có thể điền IP, Subnet của mạng)</li>



<li><strong>Destination</strong>: <em>WAN Address</em></li>



<li><strong>Destination port range</strong>: <em>SSH</em></li>



<li><strong>Description</strong>: <em>SSH to Web UI</em></li>
</ul>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-ssh-3.png" alt="Tạo thêm Rule mới cho SSH Server"/><figcaption class="wp-element-caption"><strong>Tạo thêm Rule mới cho SSH Server</strong></figcaption></figure>



<p class="wp-block-paragraph">Giờ mình đã có thể đăng nhập SSH vào pfSense sử dụng tài khoản&nbsp;<code>thuanbui</code>&nbsp;đã tạo ở bước trước</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-ssh-4.png" alt="Đăng nhập SSH thành công vào pfSense"/><figcaption class="wp-element-caption"><strong>Đăng nhập SSH thành công vào pfSense</strong></figcaption></figure>



<h2 class="wp-block-heading">III. Cấu hình DHCP Server</h2>



<p class="wp-block-paragraph">Tiếp theo, mình sẽ chỉnh cấu hình DHCP Server &#8211; dịch vụ cung cấp IP động cho máy tính nằm trong mạng LAN nội bộ.</p>



<h3 class="wp-block-heading">Kích hoạt DHCP Server</h3>



<p class="wp-block-paragraph">Bấm vào Services trên Menu, chọn DHCP Server. Mặc định khi đã hoàn thành các bước thiết lập ban đầu, pfSense đã tự động kích hoạt DHCP Server và cấu hình NAT để các máy trong mạng LAN có thể truy cập ra mạng WAN.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-dhcp-server-1.png" alt="Chỉnh DHCP Range"/><figcaption class="wp-element-caption"><strong>Chỉnh DHCP Range</strong></figcaption></figure>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-dhcp-server-2.png" alt="Chỉnh DNS Server"/><figcaption class="wp-element-caption"><strong>Chỉnh DNS Server</strong></figcaption></figure>



<p class="wp-block-paragraph">Mình sẽ điều chỉnh lại thông số cho phù hợp với nhu cầu:</p>



<ul class="wp-block-list">
<li>Nhớ bấm Tick vào mục Enable DHCP Server on LAN interface để kích hoạt DHCP Server</li>



<li>Range: Mình chỉnh lại From <code>10.0.0.101</code> &#8211; To <code>10.0.0.199</code>, nghĩa là DHCP Server sẽ sử dụng IP Range từ <code>10.0.0.101</code> đến <code>10.0.0.199</code> cho các máy tính trong mạng LAN</li>



<li>DNS Servers: <code>1.1.1.1</code> và <code>1.0.0.1</code></li>
</ul>



<p class="wp-block-paragraph">Sau đó bấm Save để lưu lại.</p>



<h3 class="wp-block-heading">Thử kết nối từ máy ảo Arch</h3>



<p class="wp-block-paragraph">Mình mở máy ảo nằm trong mạng LAN của pfSense để kiểm tra DHCP Server của pfSense có hoạt động chưa.</p>



<p class="wp-block-paragraph">Sau khi khởi động máy ảo, kiểm tra IP Address bằng lệnhTerminal window</p>



<pre class="wp-block-code"><code>ip addr show</code></pre>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-arch-linux-1.png" alt="Máy được cấp IP Address 10.0.0.101, nghĩa là DHCP Server của pfSense đang hoạt động."/><figcaption class="wp-element-caption"><strong>Máy được cấp IP Address 10.0.0.101, nghĩa là DHCP Server của pfSense đang hoạt động.</strong></figcaption></figure>



<p class="wp-block-paragraph">Kiểm tra xem máy ảo có kết nối Internet khôngTerminal window</p>



<pre class="wp-block-code"><code>ping yahoo.com</code></pre>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-arch-linux-2.png" alt="Ping thành công. Máy có thể truy cập ra Internet."/><figcaption class="wp-element-caption"><strong>Ping thành công. Máy có thể truy cập ra Internet.</strong></figcaption></figure>



<h3 class="wp-block-heading">Theo dõi DHCP Server</h3>



<p class="wp-block-paragraph">Mình có thể kiểm tra các tình trạng hoạt động của DHCP Server bằng cách truy cập vào mục DHCP Leases trong Menu Status.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-dhcp-server-3.png" alt="Trong danh sách hiện ra IP Address của máy ảo Arch Linux đang kết nối vào mạng LAN, cùng các thông số Hostname, MAC address"/><figcaption class="wp-element-caption"><strong>Trong danh sách hiện ra IP Address của máy ảo Arch Linux đang kết nối vào mạng LAN, cùng các thông số Hostname, MAC address</strong></figcaption></figure>



<p class="wp-block-paragraph">Phần 4] của series pfSense Lab đã hết</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p class="wp-block-paragraph">Nguồn: thuanbui</p>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>pfSense Lab – Phần 3 &#8211; Cấu Hình Căn Bản Cho pfSense</title>
		<link>https://blntech.io.vn/pfsense-lab-phan-3-cau-hinh-can-ban-cho-pfsense/</link>
		
		<dc:creator><![CDATA[nhanvph]]></dc:creator>
		<pubDate>Fri, 29 May 2026 08:56:28 +0000</pubDate>
				<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[pfSense]]></category>
		<category><![CDATA[Seri pfSense]]></category>
		<guid isPermaLink="false">https://blntech.io.vn/?p=1757</guid>

					<description><![CDATA[I. Thiết lập ban đầu Ở lần truy cập vào giao diện Web UI, pfSense sẽ tự động hiển thị [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">I. Thiết lập ban đầu</h2>



<p class="wp-block-paragraph">Ở lần truy cập vào giao diện Web UI, pfSense sẽ tự động hiển thị trang Setup Wizard để thiết lập các thông số chính cho hệ thống.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-web-ui-3.png" alt="Bấm Next để tiếp tục"/><figcaption class="wp-element-caption"><strong>Bấm Next để tiếp tục</strong></figcaption></figure>



<h3 class="wp-block-heading">Thông tin chung</h3>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-web-ui-4.png" alt="Thiết lập Hostname, Domain, DNS Server rồi bấm Next"/><figcaption class="wp-element-caption"><strong>Thiết lập Hostname, Domain, DNS Server rồi bấm Next</strong></figcaption></figure>



<ul class="wp-block-list">
<li>Hostname: giữ nguyên pfSense, bạn có thể thay đổi sau</li>



<li>Domain: giữ nguyên mặc đinh home.arpa, bạn có thể thay đổi sau</li>



<li>Primary &amp; Secondary DNS Server: Điền Cloudflare DNS (<code>1.1.1.1</code> và 1.0.0.1) hoặc Google DNS (<code>8.8.8.8</code> và <code>8.8.4.4</code>), hoặc để trống cũng không sao.</li>



<li>Override DNS: Chọn mục này nếu bạn muốn sử dụng DNS cung cấp từ DHCP Server gửi đến cổng WAN.</li>
</ul>



<p class="wp-block-paragraph"></p>



<h3 class="wp-block-heading">Cấu hình Time Server</h3>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-web-ui-5.png" alt="Chỉnh múi giờ và Time Server. Mình sử dụng time server 1.vn.pool.ntp.org"/><figcaption class="wp-element-caption"><strong>Chỉnh múi giờ và Time Server. Mình sử dụng time server 1.vn.pool.ntp.org</strong></figcaption></figure>



<h3 class="wp-block-heading">Cấu hình WAN Interface</h3>



<p class="wp-block-paragraph">Mình sẽ cấu hình WAN Interface và LAN Interface đúng theo sơ đồ mạng ảo đã thiết kế trong Phần 1.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-hyper-v.png" alt="Sơ đồ hệ thống mạng ảo pfSense Lab"/><figcaption class="wp-element-caption"><strong>Sơ đồ hệ thống mạng ảo pfSense Lab</strong></figcaption></figure>



<p class="wp-block-paragraph">Thiết lập WAN Interface Type là Static cùng thông số IP như sau:</p>



<ul class="wp-block-list">
<li>IP Address: 192.168.0.200</li>



<li>Subnet Mask: 24</li>



<li>Upstream Gateway: 192.168.0.1 (IP của Router Mikrotik)</li>
</ul>



<p class="wp-block-paragraph">Trong điều kiện thực tế, nếu bạn sử dụng pfSense để kết nối với modem quang của nhà mạng, cần phải chỉnh WAN Interface Type thành PPPoE và nhập Username / Password được cung cấp để xác thực kết nối.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-web-ui-6.png" alt="Chỉnh WAN Interface thành Static IP"/><figcaption class="wp-element-caption"><strong>Chỉnh WAN Interface thành Static IP</strong></figcaption></figure>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-web-ui-7.png" alt="Bỏ chọn mục Block RFC1918 Private Networks"/><figcaption class="wp-element-caption"><strong>Bỏ chọn mục Block RFC1918 Private Networks</strong></figcaption></figure>



<p class="wp-block-paragraph"><strong>Block RFC1918 Private Networks</strong>: mục này có nghĩa là pfSense sẽ chặn tất cả các truy cập vào cổng WAN từ các dãy IP nội bộ (10/8, 172.16/12, 192.168/16)</p>



<p class="wp-block-paragraph">Do mình pfSense trong mạng ảo của Hyper-V, các kết nối vào cổng WAN đều là IP nội bộ (192.168.0.0/24), do đó cần phải bỏ chọn Block RFC1918 Private Networks để cho phép Host có thể truy cập vào trang quản trị của pfSense.</p>



<h3 class="wp-block-heading">Cấu hình LAN Interface</h3>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-web-ui-8.png" alt="Đổi LAN IP Address thành 10.0.0.1 và Subnet Mask 24"/><figcaption class="wp-element-caption"><strong>Đổi LAN IP Address thành 10.0.0.1 và Subnet Mask 24</strong></figcaption></figure>



<h3 class="wp-block-heading">Thay đổi mật khẩu Admin</h3>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-web-ui-9.png" alt="Nhập mật khẩu mới cho tài khoản Admin"/><figcaption class="wp-element-caption"><strong>Nhập mật khẩu mới cho tài khoản Admin</strong></figcaption></figure>



<h3 class="wp-block-heading">Lưu lại thông số</h3>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-web-ui-10.png" alt="Bấm Reload để pfSense lưu lại thông số và khởi động lại dịch vụ"/><figcaption class="wp-element-caption"><strong>Bấm Reload để pfSense lưu lại thông số và khởi động lại dịch vụ</strong></figcaption></figure>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-web-ui-11.png" alt="Bấm Finish để hoàn thành"/><figcaption class="wp-element-caption"><strong>Bấm Finish để hoàn thành</strong></figcaption></figure>



<h2 class="wp-block-heading">II. Truy cập Web UI theo IP mới</h2>



<p class="wp-block-paragraph">Bạn cần phải quay lại Shell của pfSense để tắt packet-filter. Lý do vì sau khi thiết lập, pfSense khởi động lại dịch vụ và sẽ quay về chế độ mặc định chặn truy cập Web UI vào cổng WAN.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/cai-dat-pfsense-hyper-v-17.png" alt="Bấm 8 để truy cập Shell, gõ lệnh pfctl -d để tắt packet filter"/><figcaption class="wp-element-caption"><strong>Bấm 8 để truy cập Shell, gõ lệnh pfctl -d để tắt packet filter</strong></figcaption></figure>



<p class="wp-block-paragraph">Truy cập vào trang quản trị Web UI theo WAN IP mới đã thay đổi trong bước thiết lập ban đầu:&nbsp;<code>192.168.0.200</code>.</p>



<ul class="wp-block-list">
<li>Tài khoản: admin</li>



<li>Mật khẩu: mật khẩu mới bạn đã thay đổi ở bước trên</li>
</ul>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-web-ui-12.png" alt="Giao diện chính của pfSense"/><figcaption class="wp-element-caption"><strong>Giao diện chính của pfSense</strong></figcaption></figure>



<h2 class="wp-block-heading">III. Cho phép truy cập Web UI từ WAN</h2>



<p class="wp-block-paragraph">Để tiện việc cấu hình pfSense khi truy cập từ máy tính trong mạng nhà (nằm trên WAN của pfSense), mình sẽ tạo 1 Firewall Rule mới cho phép truy cập vào Web UI từ WAN. Nhờ vậy, không phải truy cập Shell gõ lệnh&nbsp;<code>pfctl -d</code>&nbsp;nữa.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-firewall-rule-wan.jpg" alt="Bấm vào Firewall trên Menu, chọn Rules"/><figcaption class="wp-element-caption"><strong>Bấm vào Firewall trên Menu, chọn Rules</strong></figcaption></figure>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-firewall-rule-wan-1.png" alt="Bấm Add để tạo Rule mới cho WAN"/><figcaption class="wp-element-caption"><strong>Bấm Add để tạo Rule mới cho WAN</strong></figcaption></figure>



<p class="wp-block-paragraph">Thiết lập thông số như sau:</p>



<ul class="wp-block-list">
<li><strong>Action</strong>: <em>Pass</em></li>



<li><strong>Interface</strong>: <em>WAN</em></li>



<li><strong>Protocol</strong>: <em>TCP</em></li>



<li><strong>Source</strong>: <em>Any</em> (hoặc có thể điền IP, Subnet của mạng)</li>



<li><strong>Destination</strong>: <em>WAN Address</em></li>



<li><strong>Destination port range</strong>: <em>HTTPS</em></li>



<li><strong>Description</strong>: <em>Cho phép truy cập Web UI từ WAN</em></li>
</ul>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-firewall-rule-wan-2.jpeg" alt="Bấm Save để lưu lại."/><figcaption class="wp-element-caption"><strong>Bấm Save để lưu lại.</strong></figcaption></figure>



<figure class="wp-block-image aligncenter"><img decoding="async" src="https://media.thuanbui.me/cdn-cgi/image/format=auto,onerror=redirect/images/pfsense-firewall-rule-wan-3.png" alt="Bấm Apply Changes để áp dụng Rule mới cho pfSense"/><figcaption class="wp-element-caption"><strong>Bấm Apply Changes để áp dụng Rule mới cho pfSense</strong></figcaption></figure>



<p class="wp-block-paragraph">Vậy là xong. Bạn có thể truy cập vào pfSense theo địa chỉ&nbsp;<code>192.168.0.200</code>&nbsp;từ bất cứ máy tính nào trong nhà.</p>



<pre class="wp-block-code"><code>https:&#47;&#47;192.168.0.200</code></pre>



<p class="wp-block-paragraph">Bài viết đến đây tạm kết thúc</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p class="wp-block-paragraph">Nguồn: thuanbui</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
