วันจันทร์ที่ 2 พฤศจิกายน พ.ศ. 2563

การตั้งค่า MikroTik เพื่อทำการ Block (https) Facebook, Youtube, Gmail, Hotmail, Yahoo

การตั้งค่า MikroTik เพื่อทำการ Block (https) Facebook, Youtube, Gmail, Hotmail, Yahoo


1. ไปที่เมนู IP > Firewall >  ตามภาพด้านล่าง






2.จากนั้นให้เลือกที่ Layer7 Protocols กดปุ่มสร้าง " + " ตั้งชื่อ  ตามภาพด้านล่าง

Name:            Facebook

Regexp:        ^(.*)(facebook)(.*)$

Name:            YouTube

Regexp:        ^.+(youtube.com).*$

Name:            Gmail

Regexp:        ^(.*)(mail.google.com)(.*)$

Name:            Hotmail

Regexp:        ^(.*)(outlook)(.*)$

Name:            Yahoo

Regexp:        ^(.*)(yahoo)(.*)$







3.ไปที่เมนู Firewall > Filter Rules กดสร้าง " + "
แท็บ General เลือก  Chain: forward ตามภาพด้านล่าง







4. ไปที่แท็บ Advanced > Layer7Protocol: เลือก Facebook ดังภาพด้านล่าง
(list จะแสดงขึ้นมาหลังจากที่สร้างแล้วใน Layer7 Protocols)






5. แท็ป Advanced : เลือก drop ดังภาพด้านล่าง




6.ทำการทดสอบ ดังภาพด้านล่าง




















 เสร็จขั้นตอน การตั้งค่า MikroTik เพื่อทำการ Block (https) Facebook, Youtube, Gmail, Hotmail, Yahoo


Trip Computer 







วันพุธที่ 21 ตุลาคม พ.ศ. 2563

แก้ไข Add Printer ไม่ได้ "Windows couldn't connect to the printer. Check the printer name and try again."

 แก้ไข Add Printer ไม่ได้ "Windows couldn't connect to the printer. Check the printer name and try again." 



1.ให้เลือกที่เมนู Search แล้วพิมพ์คำว่า Control Panel จากนั้นเลือกตามภาพด้านล่าง


2.จากนั้นให้เลือกที่ Devices and Printers ดังภาพด้านล่าง


3.จากนั้นให้เลือก Add a printer ดังภาพด้านล่าง


4.จากนั้นให้เลือก The printer I want isn't listed ดังภาพด้านล่าง


5.จากนั้นให้เลือกที่ Select a shared printer by name แล้วเลือกที่ Browse... ดังภาพด้านล่าง


6.จากนั้นให้เลือกชื่อเครื่องคอมพิวเตอร์ที่แชร์เครื่อง Printer ไว้ (ในที่นี้เครื่องคอมพิวเตอร์ ชื่อ Kaew) 
ดังภาพด้านล่าง 


7.จากนั้นให้เลือกที่เครื่อง Printer ที่แชร์ไว้ เลือก Select ดังภาพด้านล่าง


8.จากนั้นให้เลือก Next ดังภาพด้านล่าง


9.จากนั้นรอลงไดว์เวอร์ให้เสร็จ ดังภาพด้านล่าง


10.ลงไดว์เวอร์เสร็จ จากนั้นให้เลือก Next ดังภาพด้านล่าง


11.ติดตั้ง Printer เสร็จ จากนั้นให้เลือกที่ Finish ดังภาพด้านล่าง



เสร็จขั้นตอนการแก้ไข Add Printer Error : "Windows couldn't connect to the printer. Check the printer name and try again." 












วันจันทร์ที่ 31 สิงหาคม พ.ศ. 2563

วิธีการใช้ rsync เพื่อสำรองข้อมูล บน Linux Server

 rsync  เป็นโปรโตคอลที่สร้างขึ้นสำหรับระบบยูนิกซ์เหมือนที่ให้ความคล่องตัวที่ไม่น่าเชื่อสำหรับการสำรองข้อมูลและซิงโครไนซ์ข้อมูล สามารถใช้ในการสำรองไฟล์ไปยังไดเร็กทอรีอื่นหรือสามารถกำหนดค่าให้ซิงค์ผ่านอินเทอร์เน็ตไปยังโฮสต์อื่นได้

   rsync สามารถ Backup ข้อมูล Directory หนึ่งไปยังอีก Directory ทำงานได้หลายโหมด และสามารถใช้ร่วมกับ ssh ก็สามารถ Backup ไฟล์ข้าม Server ได้ ซึ่ง rsync มีให้ใช้กับทุก OS นั่นหมายความว่าเรา สามารถ Backup Directory ข้าม Server ข้าม OS ได้


ขั้นตอนแรก Linux ต้องติดตั้งโปรแกรม rsync 

โดยใช้คำสั่ง   apt-get install rsync


1. Backup Driectory ในเครื่อง server เดียวกัน  

เช่น ต้องการ backup ข้อมูลใน /samba/All-Data/IT  มาไว้ที่ /backup  ใช้คำสั่ง 

rsync -av --delete /samba/All-Data/IT/ /backup


" คำสั่งด้านบนจะทำการ sync ข้อมูลให้ตรงกันเนื้อหาของ/samba/All-Data/IT/ ไปยัง /backup และถ้ามีการเปลี่ยนแปลง สร้างหรือลบ ใน/samba/All-Data/IT/ข้อมูลใน /backup จะเปลี่ยนแปลงเหมือนกันกับข้อมูลต้นฉบับ "


- Backup จาก Server ไปไว้อีก Server

rsync -av --delete -e 'ssh -p 12345' root@192.168.0.1:/Directory2/  /Directory1/ 


"คำสั่งด้านบน จะทำการ sync ข้อมูลจาก server ปลายทาง 192.168.0.1  ใน Folder Directory2 มาไว้ในเครื่อง Directory1 ใน server ต้นทาง"


ความหมาย Option แต่ละตัว

-a คือ archive ทำให้ ไฟล์ตันฉบับกับไฟล์ปลายทางเหมือนกันทุกอย่าง

-v คือ verbose ให้แสดงรายละเอียดระหว่างทำงานขึ้นมาบนหน้าจอ

--exclude คือไม่รวมไฟล์ สามารถให้ รูปแบบ ได้เช่น ตามตัวอย่างหมายความว่า ไม่เอา ไฟล์ทุกไฟล์ที่ .gz ที่อยู่ใน home/admin/admin_backups/ *

--delete ให้ลบไฟล์ปลายทางถ้าไฟล์ต้นทางถูกลบไป

-p เป็นการกำหนด port ssh กรณีที่ server เปลี่ยน port 


การกำหนดให้ rsync backups อัตโนมัติ โดยใช้ crontab

#crontab -e

0 22 * * * rsync -av --delete -e 'ssh -p 12345'  root@192.168.0.1:/Directory2/  /Directory1/ 


"คำสั่งด้านบน จะเป็นการตั้งเวลาในการ Backup ข้อมูล ทุกวันเวลา 4 ทุ่ม หรือ 22.00 น. จะทำการ sync ข้อมูลจาก server ปลายทาง 192.168.0.1  ใน Folder Directory2 มาไว้ในเครื่อง Directory1 ใน server ต้นทาง"

** การ Sync โดย rsync กรณีที่ Network ขาดหรือหลุด จะหยุดทำงานทันที แล้วจะเริ่ม sync ใหม่ตามเวลาที่ตั้งไว้ **



เสร็จขั้นตอน การใช้ rsync เพื่อสำรองข้อมูล บน Linux Server


Trip Computer 

คำสั่ง SCP เพื่อทำการ copy ข้อมูลระหว่าง Server [Linux SCP command ]

 scp command line  เป็นการคัดลอกไฟล์อย่างปลอดภัยผ่าน ssh ระหว่างเครื่อง linux, mac, windows

โดยไม่ต้องติดตั้งอะไร หรือกำหนดค่าอะไรให้ยุ่งยาก เพียงใช้ scp command บรรทัดเดียว ก็สามารถคัดลอกไฟล์ข้ามเครื่อง server ได้ทันที


>>> มาดูวิธีใช้งาน scp command <<<


มี options ให้เลือกใช้งานดังนี้

-c cipher  คือ เลือกการเข้ารหัสของข้อมูลที่ต้องการส่ง 

Selects the cipher to use for encrypting the data transfer. This option is directly passed to ssh(1).


-i identity_file  คือ เลือกไฟล์ที่ใช้สำหรับเก็บ key ในการ authentication

Selects the file from which the identity (private key) for RSA authentication is read. This option is directly passed to ssh(1).


-p คือ คงวันที่แก้ไขไฟล์ไว้ รวมทั้งวันที่ access times หรือ permission mode ต่างๆ ไว้ให้เหมือนเดิม

    Preserves modification times, access times, and modes from the original file.


-r  คือทำการ copy ข้อมูลใน sub directories ด้วย

    Recursively copy entire directories.


-v คือ Verbose mode. Causes scp and ssh(1) to print debugging messages about their progress. 

This is helpful in debugging connection, authentication, and configuration problems.


-B คือ เลือกเป็นโหมด batch จำทำให้ป้องกันการถามรหัสผ่าน

    Selects batch mode (prevents asking for passwords or passphrases).


-q  คือ ปิดการใช้งานแถบแสดงสถานะ

    Disables the progress meter.


-C  คือ เปิดการใช้งานการบีบอัดข้อมูล

    Compression enable. Passes the -C flag to ssh(1) to enable compression.


-F ssh_config  คือ ระบุค่าต่างๆ สำหรับ ssh

    Specifies an alternative per-user configuration file for ssh This option is directly passed to ssh(1).


-P port คือ ระบุ port ที่จะเชื่อมต่อไปยังปลายทาง โดยตัวเลือกนี้จะต้องใช้ตัว P ใหญ่ เนื่องจาก p เล็กถูกนำไปใช้อย่างอื่นแล้ว

    Specifies the port to connect to on the remote host. Note that this option is written with a capital `P’ because -p is already reserved for preserving the times and modes of the file in rcp(1).


-S program  คือ  ชื่อของโปรแกรมที่จะใช้ในการเข้ารหัสการเชื่อมต่อ โดยโปรแกรมจะต้องเข้าใจใน protocol ssh ด้วย

    Name of program to use for the encrypted connection. The program must understand ssh(1) options.


-o ssh_option คือ Can be used to pass options to ssh in the format used in ssh_config5. This is useful for specifying options for which there is no separate scp command-line flag. For example, forcing the use of protocol version 1 is specified using scp -oProtocol=1


-4  คือ บังคับให้ scp ใช้ IPv4 เท่านั้น

    Forces scp to use IPv4 addresses only.


-6 คือ บังคับให้ scp ใช้ IPv6 เท่านั้น

    Forces scp to use IPv6 addresses only.



ตัวอย่างการใช้งาน scp command


กรณีต้องการส่งไฟล์ ไปยัง Server ปลายทาง


scp -C -r /home/share/all-data/IT root@192.168.0.101:/samba/All-Data



คำสั่งนี้เป็นการ copy ข้อมูลโดยรวม sub directories ด้วย จากเครื่องต้นทาง /home/share/all-data/IT คัดลอกไปยังปลายทางเครื่อง 192.168.0.101 โดยเข้าไปโดยใช้ root ในการ authenticate และนำไฟล์ copy ไปวางที่ /samba/All-Data


เสร็จขั้นตอน คำสั่ง SCP เพื่อทำการ copy ข้อมูลระหว่าง Server [Linux SCP command ]



Trip Computer 


วันจันทร์ที่ 24 สิงหาคม พ.ศ. 2563

แก้ปัญหาเข้า Share Folder ไม่ได้ Error : You might not have permission to use this network resource.

 Error : You might not have permission to use this network resource.



1.แก้ไขโดยการไปที่ เมนู Search แล้วพิมพ์  Run จากนั้นดับเบิ้ลคลิ๊ก ดังภาพด้านล่าง


2.จากนั้นให้พิมพ์ regedit ในช่อง แล้วเลือก OK ดังภาพด้านล่าง




3.จากนั้นให้เลือกที่ HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters  ดังภาพด้านล่าง


4.ให้ดับเบิ้ลคลิ๊กที่ AllowlnsecureGuestAuth แล้วเปลี่ยนค่าในช่อง จาก 0 เป็น 1 แล้วตอบ OK 
ดังภาพด้านล่าง

เสร็จขั้นตอน แก้ปัญหาเข้า Share Folder ไม่ได้ Error : You can't connect to the file share because it's not secure.

วันพุธที่ 29 มกราคม พ.ศ. 2563

ติดตั้งแชร์ปริ๊นเตอร์บนแลนไม่ได้ Installing network printer on Windows 10 ERROR " Windows cannot connect to printer. Print processor does not exist "

Installing network printer on Windows 10 ERROR "  Windows cannot connect to printer. Print processor does not exist "

Add printer จากเครื่องแม่ที่แชร์ไว้บนแลนแล้วไม่สามารถติดตั้งได้ ขึ้น   Error : Connect to Printer  : Windows cannot connect to printer. Print processor does not exist.   ดังภาพด้านล่าง




วิธีการแก้ไขดังนี้

1.ให้เข้าไปที่ Control Panel แล้วลือกที่ Device and Printer  จากนั้นให้เลือกที่  Printer server properties
ดังภาพด้านล่าง


2.จากนั้นให้เลือกที่ Drivers  แล้วเลือกไดว์เวอร์เครื่องปริ๊นเตอร์ที่เราไม่สามารถติดตั้งได้แล้วเลือก Remove ดังภาพด้านล่าง 


3.จากนั้นให้เลือก Remove driver and driver package แล้วเลือกที่ OK ดังภาพด้านล่าง


4.จากนั้นให้เลือกที่ Yes ดังภาพด้านล่าง


5.จากนั้นให้เลือกที่ Delete  ดังภาพด้านล่าง


6.จากนั้นให้เลือกที่ OK ดังภาพด้านล่าง


7.จากนั้นให้เลือกที่ Close ดังภาพด้านล่าง


***เสร็จขั้นตอนการลบไดว์เวอร์ ขั้นตอนต่อไปเป็นการติดตั้งปริ๊นเตอร์จากเครื่องที่แชร์ไว้***

8.จากนั้นให้ทำการติดตั้งปริ๊นเตอร์แล้วรอให้เสร็จสิ้น  ดังภาพด้านล่าง