Wednesday, 12 October 2022

Show server hardware "Product Name" and "Serial Number" from shell

Just secure shell to server and run this command as a root permission

sudo dmidecode | egrep -i 'manufacturer|product|Serial'

The result will show information such as Manufacturer,  Product Name, Serial Number, etc.

Manufacturer: Dell Inc.

Product Name: PowerEdge R430

Serial Number: xxxxxx

Manufacturer: Dell Inc.

Product Name: zzzz

Serial Number: .xxx.yyy.

Manufacturer: Dell Inc.

Serial Number: xxxx

Sunday, 22 May 2022

อย่าลืมปิด Multicast Snooping บน Bridge Interface ถ้าจะติดตั้ง KVM โดยเชื่อมต่อเครือข่ายผ่าน Bridge เพราะอาจะมีปัญหาการใช้งาน IPv6 ของ Guest OS

โดยปกติการติดตั้ง Virtural Machine บน Linux OS หรือ KVM รอบรับใช้งานเครือข่ายระดับ Layer 2 ของ Guest OS ผ่าน Bridge ของ Linux Kernel ซึ่ง Bridge บน Host OS ทำหน้าที่เป็น Switch เชื่อมต่อ Guest OS กับเครือข่าย โดยมี Physical Interface บน Host OS ทำหน้าที่เป็น Uplink port ของ Switch 

แต่เนื่องจาก Bridge ของ Linux มีการเปิด Multicast Snooping เป็นค่าเริ่มต้น โดยนี้จะปิดกั้นการส่ง Multicast บางประเภทไม่ให้ส่งข้าม Bridge ซึ่งฟีเจอร์ Multicast Snooping อาจจะทำให้เครื่อง Guest OS ไม่สามารถเชื่อมต่อกับเครือข่ายผ่าน Bridge ด้วย IPv6 ได้ เนื่องจาก Multicast Snooping ไปปิดกั้นแพคเก็ตของ Neightbor Discovry Protocol (ND) ทำให้ไม่สามารถค้นหาเครื่องที่อยู่อีกฝากของเครือข่ายได้

ดังนั้นเพื่อป้องกันปัญหาได้กลาวมาข้างต้นนั้น จำเป็นต้องปิด Multicast Snooping ด้วยคำสั่งดังนี้

echo -n 0 > /sys/class/net/<brif>/bridge/multicast_snooping


Source : https://askubuntu.com/questions/460405/ipv6-does-not-work-over-bridge


Friday, 15 October 2021

How to enable serial console KVM guest os.

 1. Enable serial console with command :

 systemctl enable --now serial-getty@ttyS0.service  

2. Connecting to guest OS from KVM with command:

 virsh console [VM_NAME]  

ref: ostechnix.com

Saturday, 9 October 2021

How to fix expired Freeradius certificate problem.

Problem :

    1. Can't start RADIUS Systemd service.

    2. Log show like this. 

 Oct 9 00:00:49 radius1 sh[1114]: C = FR, ST = Radius, L = Somewhere, O = Example Inc., emailAddress = admin@example.org, CN = Example Certificate Authority  
 Oct 9 00:00:49 radius1 sh[1114]: error 10 at 1 depth lookup: certificate has expired  
 Oct 9 00:00:49 radius1 sh[1114]: C = FR, ST = Radius, O = Example Inc., CN = Example Server Certificate, emailAddress = admin@example.org  
 Oct 9 00:00:49 radius1 sh[1114]: error 10 at 0 depth lookup: certificate has expired  
 Oct 9 00:00:49 radius1 sh[1114]: error server.pem: verification failed  
 Oct 9 00:00:49 radius1 sh[1114]: make: *** [Makefile:107: server.vrfy] Error 2  
 Oct 9 00:00:49 radius1 rsyslogd[1098]: imjournal: journal files changed, reloading... [v8.1911.0-6.el8 try https://www.rsyslog.com/e/0 ]  
 Oct 9 00:00:49 radius1 systemd[1]: radiusd.service: Control process exited, code=exited status=2  
 Oct 9 00:00:49 radius1 systemd[1]: radiusd.service: Failed with result 'exit-code'.  
 Oct 9 00:00:49 radius1 systemd[1]: Failed to start FreeRADIUS high performance RADIUS server..  

Cause :

    Certificate file in `/etc/raddb/certs/` have any expired certificates.

Resolution 1 (If you do not user certificate in /Certs ) :

    Delete all certificate files in `/raddb/certs` with this command.

 rm -f *.pem *.der *.csr *.crt *.key *.p12 serial* index.txt*  

Resolution 2 :

     Create new certificate new certificate instead expired certs. 


   



Friday, 8 October 2021

Basic Firewalld configuration for Linux server

1. Show all zone name and information about those zone.

 firewall-cmd --list-all-zones  

2. Create new zone.

 firewall-cmd --new-zone=dmz2 --permanent
3. Add source network or source IP to firewall zone to allow those network access allow services or port number in specific zone.
 firewall-cmd --zone=dmz2 --add-source=192.168.0.0/24 --permanent  
 firewall-cmd --reload  #Apply

4. Add service port to allow sources network in a zone to access those port.

 firewall-cmd --zone=dmz2 --add-port=80/tcp --add-port=443 --permanent  
 firewall-cmd --reload  #apply

Wednesday, 12 April 2017

Simple way to install go for CENTOS


  1. Download Go From Go Site 
  2. Untar Go to /usr/local/
    tar -C /usr/local -xzf go-xx.tar
  3. Create Link in /usr/bin
    ln -s /usr/bin/go/ /usr/local/go/bin
  4. Create Go Working Directory
  5. mkdir /go
    
  6. Set GOPATH 
    export GOPATH=/go

Tuesday, 6 September 2016

How to add network interface card (NIC) to Docker’s container and bridging with phisical NIC


  1. Create Docker Network
    • # docker network create --driver=bridge [docker's network name]
    • *Docker automatically create network bridge with brctl when running command (for linux environment).
  2. Bridge created network with another interface
    • # brctl addif [brid name] [NIC’s name]
    • *brctl show (for lookup bridge name).
    • **Manual add interface to bridge everytime after restart host.
  3. Create Docker Cointainer
  4. Connect Docker to bridge
    • # docker network connect [Network Name] [Container ID]
    • *Container will be connect and automatically create another interface on container that connect with created network.

Import SSH Private Key to Yubikey (PIV) for SSH Authentication

Introduction: This guide will walk you through the process of importing your SSH private key to a Yubikey (PIV) for SSH authentication on y...