Anúncio
Anúncio

Mais conteúdo relacionado

Similar a Ch05 name-services(20)

Anúncio

Ch05 name-services

  1. Linux Server Admin Linux Name Services Chatchai J 2012-11-21
  2. Name Sevices ● การให้บริการ “ชือ” บน Linux ่ ● คอมพิวเตอร์ใช้ “ตัวเลข” ในการติดต่อสือสาร ่ ● แต่คนจะสามารถ “ชือ” จดจำาได้ง่ายกว่า ่ ● ระบบปฏิบติการ จึงต้องมี ทัง library และ application ั ้ สำาหรับใช้ในการเปลียน ระหว่าง ชือและตัวเลข ่ ่
  3. Name Services on Linux ● อย่างไร – http://www.google.com สำาหรับคน – 173.94.38.{176-180}:80 สำาหรับคอมพิวเตอร์
  4. Name Services (ต่อ) ● Linux resolve address (แปลงจากชือเป็ น address) ่ อย่างไร? ● อย่่ใน C library function ● ซึงสามารถ config ได้ ่ – Name Service Configuration – /etc/nsswitch.conf ● เริมจาก /etc/nsswitch.conf ่
  5. Name Services (ต่อ) ● Server / minimum install passwd:         compat group:          compat shadow:         compat hosts:          files dns networks:       files protocols:      db files services:       db files ethers:         db files rpc:            db files netgroup:       nis
  6. Name Services (ต่อ) – กรณีของ desktop ทีติดตัง Multicast DNS (avahi) ่ ้ passwd:         compat group:          compat shadow:         compat hosts:          files mdns_minimal [NOTFOUND=return] dns mdns networks:       files protocols:      db files services:       db files ethers:         db files rpc:            db files netgroup:       nis
  7. Name Services (ต่อ) ● Name Service Switch ระบุ database สำาหรับ name เป็ น number passwd:         compat group:          compat shadow:         compat ● สำาหรับ password, group, shadow ใช้ compat mode
  8. Name Services (ต่อ) ● คือ /etc/passwd /etc/group /etc/shadow ● สำาหรับเก็บข้อม่ลของ account บนระบบ
  9. Name Services (ต่อ) ● กรณีของ hostname → address จะใช้ hosts: files dns ● files ในทีนคือ /etc/hosts ่ ี้ ด่จากของจริงบนเครือง ่ ● ทดลองเพิม ใน /etc/hosts ่ 127.0.0.1 www.google.com ● แล้วใช้คำาสัง ่ $ ping www.google.com
  10. Name Services (ต่อ) ● dns ในทีนคือ domain name system ่ ี้ ● ซึงจะใช้ config ทีระบุไว้ใน /etc/resolv.conf ่ ่ – domain ระบุ local domain name – search ระบุ domain part ในกรณีทใช้ชือ host แบบสัน ี่ ่ ้ – nameserver ระบุ DNS server
  11. resolv.conf ● เปลียน /etc/resolv.conf บนเครือง ่ ่ domain coe.psu.ac.th search coe.psu.ac.th psu.ac.th nameserver 172.30.0.5 nameserver 172.30.0.9 ● Domain มี 1, seach ได้หลาย แบ่งด้วย space ● Name server มีได้ถึง 3 (โดยทัวไป) เขียนบรรทัดละ 1 ่
  12. Name Query Tools ● เครืองมือสำาหรับ query name และ address ่ – บน Windows มี nslookup – บน Linux ใช้ host หรือ dig ● เช่น $ host www.google.com $ host www.facebook.com 172.30.0.5
  13. Name Query Tools (ต่อ) $ host -a www.coe.psu.ac.th 172.30.0.9 $ host -t a www.coe.psu.ac.th 192.100.77.2 $ host -t aaaa www.coe.psu.ac.th 192.100.77.5 option -a ใช้แสดงข้อม่ลทังหมด ้ option -t X ใช้เลือกชนิดของข้อม่ลใน DNS ทีตองการ ่ ้ ถ้ามี ชือ/address ตามหลังจะเป็ นการระบุ server ทีจะให้ query ่ ่
  14. Name Query Tools (ต่อ) ● dig – ขุด $ dig @172.30.0.5 fivedots.coe.psu.ac.th a $ dig @192.100.77.3 www.coe.psu.ac.th soa ● dig จะให้ข้อม่ลมากกว่า host แต่ก็อาจจะชวนสับสนกว่า
  15. Name Server ● ตัว Server ทีให้บริการในการแปลงจาก name ่ เป็ น address และ กลับกัน ● แปลงจาก address เป็ น ชือ เรียกกระบวนการ ่ นี ้ ว่า reverse lookup
  16. # Break 1 # ● ติดตัง tools สำาหรับ admin ้ $ sudo apt-get install tmux ● TMUX – terminal multiplexer – ใช้ CTRL+B, C สำาหรับสร้าง terminal ใหม่ – CTRL+B, SPACE สำาหรับ เปลียน terminal ่ – CTRL+B, D สำาหรับ detach $ tmux attach – สำาหรับการ re-attach
  17. # Break 2 # $ sudo apt-get install htop ● ใช้ F+no สำาหรับเลือก function ● ทดลองเรียกใช้ history ของ bash $ !ls $ !499 ● ทดลองเรียกใช้ คำาสัง script ่
  18. dnsmasq ● ทดลองใช้งานใน debug mode ● สร้างไฟล์ /tmp/hosts 172.30.0.19 www.google.com 172.30.0.7 www.facebook.com $ sudo service dnsmasq stop $ sudo dnsmasq -d -q -h -H /tmp/hosts
  19. dnsmasq (ต่อ) ● Secure shell connect จาก host เข้าไปยัง server แล้วเรียกใช้คำาสัง host หรือ dig ่ $ host www.google.com localhost $ dig @localhost www.google.com a ● ขอ ip address ของเครืองทีนงข้างๆ แล้วทดลอง ่ ่ ั่ ใช้เครืองข้างๆเป็ น server ่
  20. dnsmasq (ต่อ) ● dnsmasq มีความสามารถในการให้บริการ ทัง DNS และ ้ DHCP (อ่านจาก man page) และมี feature สำาหรับการใช้ งานแบบ อย่างรวดเร็ว แต่สำาหรับการให้บริการแบบ heavy weight จะนิยมใช้ ISC bind9 สำาหรับ DNS และ isc-dhcp-server สำาหรับ DHCP
  21. ISC BIND9 ● เป็ น DNS Server สำาหรับให้บริการ resolve name ● ติดตังโดยการใช้คำาสัง ้ ่ $ sudo apt-get install bind9
  22. BIND9 ● อ่านบทที ่ 6 ใน รายงาน Sabbatical Report ของผมก่อน ● แล้วมาคุยต่อคาบต่อไป
Anúncio