🇻🇳 Tiếng Việt
Bài viết này ghi lại quá trình triển khai máy chủ tệp tin cho một công ty nhỏ tại Hải Phòng, quy mô dưới 20 nhân sự.
Công ty cần một giải pháp chia sẻ tệp tin đơn giản giữa các máy tính chạy Windows 10/11.
1. Yêu cầu đối với hệ thống
Vì nhân viên không chuyên CNTT, hệ thống cần đơn giản, ổn định và dễ bảo trì.
Ngoài ra, còn có các yêu cầu cụ thể:
- Truy cập từ xa có mã hóa
- Snapshot và sao lưu dễ dàng
- Có WebUI để doanh nghiệp tự quản lý
- Không lưu dữ liệu trên máy khách
2. Các lựa chọn cân nhắc
Chia sẻ tệp là nhu cầu cơ bản, có nhiều giải pháp sẵn sàng. Dưới đây là các lựa chọn được xem xét.
2.1. Hệ điều hành
Để chạy máy chủ tệp tin, có thể dùng Linux, FreeBSD hoặc các hệ điều hành tối ưu cho NAS:
- TrueNAS CORE (dựa trên FreeBSD)
- TrueNAS SCALE (dựa trên Linux)
- FreeBSD (barebone)
- Debian (barebone)
Chúng tôi chọn TrueNAS SCALE vì giao diện Web quản trị tốt và hỗ trợ phần cứng tốt hơn FreeBSD.
2.2. Giao thức chia sẻ tệp
Các giao thức phổ biến cho chia sẻ tệp tin gồm:
- Server Message Block (SMB)
- Network File System (NFS)
- WebDAV (Web Distributed Authoring and Versioning)
- Giải pháp đồng bộ: Nextcloud, ownCloud
Chúng tôi chọn SMB vì tương thích tốt với Windows 10/11. WebDAV cũng khả thi nhưng bảo trì phức tạp hơn.
TrueNAS SCALE quản lý người dùng và ACL rất tốt với SMB, do đó là lựa chọn tối ưu.
3. Lựa chọn cuối cùng
Để đơn giản hóa quản trị, hệ thống cuối cùng gồm:
TrueNAS SCALE "Dragonfish" 24.04
Server Message Block (SMB)
WireGuard (VPN)
Tailscale (VPN)
4. Triển khai TrueNAS SCALE “Dragonfish” 24.04
- Dữ liệu lưu trên 2 HDD chạy RAID1
- Snapshot và backup định kỳ bằng ZFS
- Chia sẻ qua SMB, tương thích máy khách Windows
- Mã hóa dữ liệu truyền qua VPN (WireGuard)
- Quản lý phân quyền ACL qua TrueNAS
4.1. Cấu trúc phân quyền
Với quy mô nhỏ, việc phân quyền đơn giản:
- Tạo group cho từng phòng ban
- Tạo dataset / SMB share tương ứng
- Phân quyền đọc/ghi theo từng nhóm
4.2. Mạng riêng ảo (VPN)
Ban đầu sử dụng WireGuard Easy, nhưng gặp lỗi cập nhật DNS chậm.
Sau đó chuyển sang Tailscale để ổn định hơn, chỉ giữ WireGuard cho truy cập giao diện TrueNAS Web.
WireGuard Easy:
- Cài đặt
wg-easy
trên TrueNAS qua Apps (k3s) - Mở port UDP trên modem
- Cấu hình máy khách đơn giản
- Truy cập bằng IP WireGuard (bỏ DNS giảm độ trễ)
- Chưa cấu hình site-to-site
Tailscale:
- Cài đặt trực tiếp trên TrueNAS
- Chuyển tiếp port UDP 41641
4.3. Sao lưu sau giai đoạn thử nghiệm
- Sao lưu ngoại tuyến bằng ZFS send/recv (pull method, tự động bởi máy khác)
- Bổ sung thêm phương án
rsync
hoặc tương đương
5. Các vấn đề gặp phải
5.1. WireGuard client mất kết nối
Một số máy khách Windows bị mất kết nối, cần kích hoạt lại thủ công.
Nguyên nhân: máy chủ WireGuard dùng DDNS, khi IP thay đổi endpoint không cập nhật kịp.
Đã khắc phục bằng Tailscale.
Bài viết tổng hợp từ kinh nghiệm triển khai thực tế tại doanh nghiệp nhỏ tại Việt Nam. Hy vọng hữu ích cho những ai đang tìm kiếm giải pháp lưu trữ và bảo mật dữ liệu nội bộ.
🇬🇧 English
This post documents the process of deploying a file server for a small company in Hai Phong, Vietnam, with fewer than 20 employees.
The company needed a simple and reliable solution for sharing files between Windows 10/11 clients.
1. System Requirements
Since most employees are non-technical, the system must be simple, stable, and easy to maintain.
Specific requirements included:
- Encrypted remote access
- Easy snapshot and backup
- Web-based administration interface
- No local data stored on client devices
2. Options Considered
File sharing is a basic requirement with many ready-made solutions. Below are the evaluated options.
2.1. Operating System
To host a file server, you can use Linux, FreeBSD, or NAS-optimized OS:
- TrueNAS CORE (based on FreeBSD)
- TrueNAS SCALE (based on Linux)
- FreeBSD (barebone)
- Debian (barebone)
We selected TrueNAS SCALE because it provides an excellent web interface and broader hardware compatibility than FreeBSD.
2.2. File Sharing Protocols
Common protocols include:
- Server Message Block (SMB)
- Network File System (NFS)
- WebDAV (Web Distributed Authoring and Versioning)
- Sync solutions: Nextcloud, ownCloud
We chose SMB for its strong compatibility with Windows 10/11 clients.
WebDAV works too, but is more complex to maintain.
TrueNAS SCALE provides excellent user and ACL management with SMB, making it the best option.
3. Final Setup
To simplify administration, the final setup included:
TrueNAS SCALE "Dragonfish" 24.04
Server Message Block (SMB)
WireGuard (VPN)
Tailscale (VPN)
4. Deploying TrueNAS SCALE “Dragonfish” 24.04
- Data stored on 2 HDDs in RAID1
- Regular ZFS snapshots and backups
- SMB file sharing compatible with Windows clients
- Encrypted communication via VPN (WireGuard)
- Access control managed via TrueNAS ACLs
4.1. Permission Structure
With a small team, access control is simple:
- Create groups for each department
- Create corresponding datasets / SMB shares
- Assign read/write permissions by group
4.2. Virtual Private Network (VPN)
Initially, WireGuard Easy was used, but DNS updates were slow.
We switched to Tailscale for better reliability and kept WireGuard for accessing the TrueNAS Web UI.
WireGuard Easy:
- Installed
wg-easy
on TrueNAS via Apps (k3s) - Opened UDP port on router
- Client setup was straightforward
- Accessed TrueNAS via WireGuard IP (no DNS latency)
- Site-to-site not configured yet
Tailscale:
- Installed directly on TrueNAS
- Forwarded UDP port 41641
4.3. Backup after Testing Phase
- Offline backup via ZFS send/recv (pull method, auto-triggered by another host)
- Additional backup plan via
rsync
or similar
5. Issues Encountered
5.1. WireGuard Client Disconnections
Some Windows clients lost connection and had to be reactivated manually.
Cause: the WireGuard server used DDNS; when its public IP changed, endpoints failed to update.
Resolved by switching to Tailscale.
This article is based on real-world deployment experience at a small business in Vietnam. We hope it helps those looking for a simple, secure, and maintainable internal file-sharing solution.