Thực hiện tạo 1 folder trống rồi robocopy kiểu mirror tới folder bị lỗi:
robocopy C:\Empty "D:\Backup path" /MIR
Sau đó sẽ xóa được
Thực hiện tạo 1 folder trống rồi robocopy kiểu mirror tới folder bị lỗi:
robocopy C:\Empty "D:\Backup path" /MIR
Sau đó sẽ xóa được
# trước khi chạy: kiểm tra csv dạng UTF-8, check duplicate MAC
# ghi đè lên các bản ghi đã có nếu trùng MAC
# Xóa các reserve có trên DHCP nhưng không có trong file. Không xóa các bản ghi DHCP bình thường
# Ghi log ra file CSV kèm thời gian, action
# ================= CONFIG =================
$ScopeId = "x.x.x.x"
$CsvPath = "C:\bat\Reserve-MAC-IP.csv"
$LogPath = "C:\bat\Dhcp-Reserve-Log.csv"
$rawCsv = Import-Csv -Path $CsvPath -Encoding UTF8
# ================= FUNCTION =================
# Format MAC về aa-bb-cc-dd-ee-ff
function Format-Mac($mac) {
$mac = $mac -replace "[:-]", ""
return ($mac.ToLower() -split '(.{2})' | Where-Object { $_ }) -join "-"
}
function Write-Log($mac, $ip, $desc, $action) {
$time = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
$logObj = [PSCustomObject]@{
"MAC" = $mac
"IP" = $ip
"Description" = $desc
"Action" = $action
"Time" = $time
}
Write-Host ("[{0}] {1} | {2} | {3} | {4}" -f $time, $action, $mac, $ip, $desc)
if (!(Test-Path $LogPath)) {
$logObj | Export-Csv -Path $LogPath -NoTypeInformation -Encoding UTF8
} else {
$logObj | Export-Csv -Path $LogPath -NoTypeInformation -Append -Encoding UTF8
}
}
# ================= NORMALIZE CSV =================
$csvData = $rawCsv | ForEach-Object {
[PSCustomObject]@{
MAC = (Format-Mac $_.'MAC validate')
IP = $_.'IP Reserve'
Description = $_.Description
}
}
# ================= CHECK DUPLICATE MAC =================
$dupMac = $csvData | Group-Object MAC | Where-Object { $_.Count -gt 1 }
foreach ($d in $dupMac) {
Write-Host ("WARNING: DUPLICATE MAC {0} ({1} records) -> giữ dòng cuối" -f $d.Name, $d.Count) -ForegroundColor Yellow
}
# ================= REMOVE DUPLICATE (GIỮ DÒNG CUỐI) =================
$csvData = $csvData |
Group-Object MAC |
ForEach-Object { $_.Group[-1] }
# ================= GET EXISTING =================
$existingReservations = Get-DhcpServerv4Reservation -ScopeId $ScopeId
$existingByMac = @{}
foreach ($res in $existingReservations) {
$existingByMac[$res.ClientId.ToLower()] = $res
}
$csvMacSet = @{}
# ================= ADD / OVERWRITE =================
foreach ($row in $csvData) {
$mac = $row.MAC
$ip = $row.IP
$desc = $row.Description
$csvMacSet[$mac.ToLower()] = $true
if ($existingByMac.ContainsKey($mac.ToLower())) {
try {
Remove-DhcpServerv4Reservation -ScopeId $ScopeId -ClientId $mac -Confirm:$false -ErrorAction Stop
Add-DhcpServerv4Reservation -ScopeId $ScopeId -IPAddress $ip -ClientId $mac -Description $desc -ErrorAction Stop
Write-Log $mac $ip $desc "Overwrite"
} catch {
Write-Host "ERROR Overwrite: $mac" -ForegroundColor Red
}
} else {
try {
Add-DhcpServerv4Reservation -ScopeId $ScopeId -IPAddress $ip -ClientId $mac -Description $desc -ErrorAction Stop
Write-Log $mac $ip $desc "Add"
} catch {
Write-Host "ERROR Add: $mac" -ForegroundColor Red
}
}
}
# ================= DELETE =================
foreach ($res in $existingReservations) {
$mac = $res.ClientId.ToLower()
if (-not $csvMacSet.ContainsKey($mac)) {
try {
Remove-DhcpServerv4Reservation -ScopeId $ScopeId -ClientId $res.ClientId -Confirm:$false -ErrorAction Stop
Write-Log $res.ClientId $res.IPAddress $res.Description "Delete"
} catch {
Write-Host "ERROR Delete: $mac" -ForegroundColor Red
}
}
}
Sử dụng NAS Synology (xpen)
Sử dụng domain free qua ddns
Truy cập domain => lỗi cert
Phương án xử lý:
- Sử dụng ddns của Synology => cần có tài khoản Syno mới tạo đc domain và get cert, xpen thì ko login tài khoản Synology đc
- Sử dụng ddns bên ngoài như noip => domain riêng, quá trình get cert cần thông từ internet tới port 80 trên NAS:
Hiện chưa có cách gì. Hướng xử lý có thể nghĩ tới:
- Ôm cục NAS tới mạng khác cho phép mở port 80, chờ ddns update IP mới rồi thực hiện get cert
- Tìm cách login đc tài khoản Synology lên NAS => tạo domain theo Syno
Dựng VM Rocky
Chạy playbook new_server
dnf install -y nginx php php-fpm php-cli php-curl php-json policycoreutils-python-utils firewalld
systemctl enable --now nginx
systemctl enable --now php-fpm
systemctl enable --now firewalld
setsebool -P httpd_can_network_connect 1
firewall-cmd --permanent --add-service=http
firewall-cmd --reload
SSH vào thiết bị
Chạy Show configuration
Tìm dòng SKU để lấy serial:
SKU
---
Part Number: E7W00A
Serial Number: xxx
Revision: F
Roaming factor trên hệ thống Ruckus sử dụng để điều chỉnh mức độ nhạy khi client di chuyển giữa các AP. Tương ứng có các mức từ 1 đến 10: mức 1 - client sẽ "bám" AP nhất, mức 10 sẽ dễ đổi AP nhất.
Ví dụ cài đặt để set mức 3: vào console của controller:
config
zone "tên zone" => áp dụng cho zone
wlan "tên SSID" => áp dụng cho SSID
roam => bật smart roaming
roam-factor 2.4g 3 => áp dụng cho sóng 2.4Ghz
roam-factor 5g 3 => áp dụng cho sóng 5Ghz
Như vậy khi thay đổi/phát sinh zone và SSID cũng sẽ phải chạy lại lệnh mới để có tác dụng
Kiểm tra lại config:
show running-config zone "tên zone" wlan "tên SSID"
CA server riêng, chạy Windows core, cấp phát cert cho AD và các client pc
Sử dụng windows server khác, kết nối remote vào CA server, chuột phải và kết nối vào CA:
Cần thêm config:
aaa new-model
!
!
aaa authentication login default local
aaa authorization exec default local
và:
Lấy thông tin disk đã map (powershell):
Get-IscsiSession | Get-Disk | Get-Partition | ft DiskNumber, DriveLetter
Get-IscsiSession | Get-Disk | Get-Partition | Select DiskNumber, PartitionNumber, DriveLetter
Online lại disk:
- Diskpart (cmd) > select disk
- Online disk
- sửa readonly: Attributes disk clear readonly
Thực hiện tạo 1 folder trống rồi robocopy kiểu mirror tới folder bị lỗi: robocopy C:\Empty "D:\Backup path" /MIR Sau đó sẽ xóa đ...