Monthly Archives: November 2024

Mellanox Cumulus Switch Config MLAG

leaf01 คือ Switch 1
leaf02 คือ Switch 2
bond11 คือ uplink ไปที่ Core Switch มี 2 port คือ Port 16 ของ Switch ทั้งคู่
br_default คือ trunk vlan
peerlink คือ port ที่ Switch ทั้งคู่ใช้คุยกันเอง Port 20,21 ของ Switch ทั้งคู่

Initial Switch leaf01

nv set interface eth0 ip address 192.168.5.201/24
nv set interface eth0 ip gateway 192.168.5.1
nv set system hostname leaf01
nv set system ssh-server permit-root-login enabled
nv set system ssh-server vrf mgmt
nv set system timezone Asia/Bangkok
nv set service ntp mgmt server 3.th.pool.ntp.org iburst on
nv set interface swp1-22
nv config apply
date

Initial Switch leaf02

nv set interface eth0 ip address 192.168.5.202/24
nv set interface eth0 ip gateway 192.168.5.1
nv set system hostname leaf01
nv set system ssh-server permit-root-login enabled
nv set system ssh-server vrf mgmt
nv set system timezone Asia/Bangkok
nv set service ntp mgmt server 3.th.pool.ntp.org iburst on
nv set interface swp1-22
nv config apply
date

Config MLAG leaf01

nv set interface bond11 bond member swp16
nv set interface bond11 description Leaf-to-Spine-Connection
nv set interface bond11 bond mlag id 1
nv set interface bond11 bridge domain br_default
nv config apply

Config MLAG leaf02

nv set interface bond11 bond member swp16
nv set interface bond11 description Leaf-to-Spine-Connection
nv set interface bond11 bond mlag id 1
nv set interface bond11 bridge domain br_default
nv config apply

Config Peerlink leaf01

nv set interface peerlink bond member swp20-21
nv set mlag mac-address 22:45:20:AE:FF:AA
nv set mlag backup 192.168.5.202 vrf eth0
nv set mlag peer-ip linklocal
nv config apply
nv config save

Config Peerlink leaf02

nv set interface peerlink bond member swp20-21
nv set mlag mac-address 22:45:20:AE:FF:AA
nv set mlag backup 192.168.5.201 vrf eth0
nv set mlag peer-ip linklocal
nv config apply
nv config save

Check Status leaf01 and leaf02

nv show mlag
nv show mlag consistency-checker global
nv show interface bond11 bond mlag (status ต้องเป็น dual)

* MTU Bond11 กับ SWP ของ Bond11 ต้องเท่ากับ Switch ฝั่งตรงข้าม

Linux ลืม Password, เพิ่ม User, เพิ่ม sudo User

เพิ่ม User ที่มีสิทธิ์ sudo

  1. กด ESC ก่อน Boot เข้า Linux
  2. เลือก Advanced Options for Ubuntu
  3. เลือก (recovery mode)
  4. เลือก root
  5. กด Enter
  6. adduser <username>
  7. usermod -aG sudo <username>
  8. groups <username>
  9. reboot

เปลี่ยน Password ให้ User
ทำขั้นตอน 1-5
passwd <username>

เพิ่มสิทธิ์ sudo ให้ User
ทำขั้นตอน 1-5
usermod -aG sudo <username>

Windows Core ติดตั้ง SSH

Get-WindowsCapability -Online | ? Name -like ‘OpenSSH*’

Name : OpenSSH.Client~~0.0.1.0 
State : Installed

Name : OpenSSH.Server~~0.0.1.0
State : NotPresent

Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

Path :
Online : True
RestartNeeded : False

Start-Service -Name “sshd”
Set-Service -Name “sshd” -StartupType Automatic
Get-Service -Name “sshd” | Select-Object *

Name : sshd
RequiredServices : {}
CanPauseAndContinue : False
CanShutdown : False
CanStop : True
DisplayName : OpenSSH SSH Server
DependentServices : {}
MachineName : .
ServiceName : sshd
ServicesDependedOn : {}
ServiceHandle : SafeServiceHandle
Status : Running
ServiceType : Win32OwnProcess
StartType : Automatic
Site :
Container :

ค่า Default Shell เป็น CMD ต้องเปลี่ยนเป็น Powershell ก่อนถึงจะ SSH เป็น Powershell ได้

New-ItemProperty -Path “HKLM:\SOFTWARE\OpenSSH” -Name DefaultShell -Value “C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe” -PropertyType String -Force

VMware vCenter เตือน Certificate Status ทั้งที่ Renew Certificate ไปแล้ว

เข้าไปดู Certificate ทั้งหมดไม่เจอที่ Expire ปัญหาเกิดจากไฟล์ CRS หมดอายุ

วิธีแก้

for store in $(/usr/lib/vmware-vmafd/bin/vecs-cli store list | grep -v TRUSTED_ROOT_CRLS); do echo "[*] Store :" $store; /usr/lib/vmware-vmafd/bin/vecs-cli entry list --store $store --text | grep -ie "Alias" -ie "Not After"; echo "===================================================="; done;

ผลลัพธ์

[*] Store : MACHINE_SSL_CERT
Alias : __MACHINE_CERT
Not After : Oct 11 03:53:39 2026 GMT
Alias : __MACHINE_CSR
Not After : Oct 11 06:23:45 2024 GMT

จะเห็นว่า __MACHINE_CSR หมดอายุ วิธีแก้คือลบไฟล์นี้ด้วยคำสั่ง

/usr/lib/vmware-vmafd/bin/vecs-cli entry delete --store MACHINE_SSL_CERT --alias __MACHINE_CSR

Windows Core Error Failed to release DHCP lease

ดู Interface ที่ต้องการแก้ไขด้วย command

Get-NetAdapter

ตัวอย่างลบ Config ที่ Ethernet0

Remove-NetIPAddress -InterfaceAlias Ethernet0 -confirm:$False

Fixed IP Address ด้วย command

New-NetIPAddress -InterfaceAlias Ethernet0 -IPAddress 172.16.1.2 -PrefixLength 24 -DefaultGateway 172.16.1.1

ถ้า Error: Instance DefaultGateway already exists ให้ใช้ Command นี้ก่อน แล้ว Fixed IP Address ใหม่อีกครั้ง

Remove-NetRoute -InterfaceAlias Ethernet0