วันเสาร์ที่ 13 สิงหาคม พ.ศ. 2559

config cisco

==== Day 2 ====

- Mode ในการติดตั้งเราเตอร์
1. User Execute Mode - เราเตอร์พร้อมในการทำงาน -> Router>
2. Privilege Mode (Enable Mode) - เราสามารถดูสถานะการทำงานต่างๆ ของเราเตอร์ได้จากโหมดนี้ -> Router#
3. Global Configuration Mode - เราสามารถใส่คำสั่งต่างๆ เพื่อให้เราเตอร์ทำงานได้ -> Router(config)#
4. Interface Confuguration Mode - เราสามารถใส่ ip, subnet mask ให้กับ interface หรือพอร์ตของเราเตอร์ -> 
Router(config-if)#

- วิธีการเปิด telnet ให้กับเราเตอร์
R1>enable
R1#config terminal
R1(config)#line vty 0 4
R1(config-line)#password xxx - กำหนด password telnet ให้กับเราเตอร์
R1(config-line)#login

- วิธีการกำหนด password ก่อนเข้า Privilege mode (Enable Mode)
R1#config terminal
R1(config)#enable password xxx
R1(config)#enable secret xxx - เข้ารหัสแบบ MD5 

R1(config)#service password-encryption - เข้ารหัส password ทุกตัวที่เราเตอร์เป็นแบบ password 7

http://www.kazmier.com/computer/cisco-cracker.html - crack password 7

- วิธีสร้าง username และ password เพื่อให้ admin สามารถบริหาร จัดการเราเตอร์ได้
Switch(config)#username admin privilege 15 secret 0 cisco
Switch(config)#line vty 0 4
Switch(config-line)#login local

R1(config)#boot system flash c1841-ipbasek9-mz.124-12.bin - เปลี่ยนให้เราเตอร์ไปทำการเรียก ios ตัวใหม่ (ios ที่เราระบุไว้เบื้องต้น)

=========================================

=== Day 3 ====

สรุปคำสั่ง show ต่างๆ ซึ่งทำที่ Privilege mode (Enable mode)

R1#show cdp neighbors - ดูรายละเอียดอุปกรณ์ข้างเคียง
R1#show startup-config - ดู configure ภายใน nvram
R1#show running-config - ดู configure ภายใน ram
R1#show clock - ไว้แสดงวัน และเวลา ต้อง set ไว้เพื่อประโยชน์สำหรับการดู log 
R1#show user - ดูว่าใครเข้ามาใช้งานเราเตอร์อยู่บ้าง 
R1#show history - ดูคำสั่งที่เคยพิมพ์มา
R1#show hosts - ดู port, address ว่าใครเข้ามา telnet, http, ssh หรืออื่นๆ 
R1#show flash - ดู file ที่ถูกเก็บไว้ใน flash
R1#show arp - ไว้สำหรับดู mac address ของเราเตอร์ หรือรายการ mac address ที่เคยผ่านมายังเราเตอร์
R1#show ip protocol - ดู routing ที่เราใช้ว่าเป็น protocol อะไร 
R1#show interface (พอร์ตของเราเตอร์) - ดู traffic ที่ผ่านมายัง interface นั้นๆ 
R1#show ip interface brief - ดูสถานะของ ip และ interface บนตัวเราเตอร์
R1#show process cpu - ดูสถานะของ cpu 

ไว้สำหรับเว้นบรรทัดเมื่อมี log มาแจ้งเตือนบนหน้าจอ monitor
R1#conf t
R1(config)#line con 0
R1(config)#logging synchronous

R1(config)#no ip domain-lookup ใช้เวลาเราพิมพ์คำสั่งผิดพลาด มันจะไม่ส่ง broadcast ไปถาม name server เพื่อ save เวลา 

R1#show tech-support จะแสดง ทุกสิ่ง ทุกอย่างของเราเตอร์ 

---------------------------------------------------------
วิธีการติดตั้ง Static route

R1>enable
R1#config terminal
R1(config)#ip route (network ปลายทาง) (subnet mask ของ network ปลายทาง) (next hop ip/Gateway interface)

วิธีการดู routing table 
R1#sh ip route

- RIP (Routing Information Protocol)
1. มีค่า AD = 120
2. RIP มี 2 version คือ v.1, v.2
3. RIP จะเลือกเส้นทางผ่านทาง hop ที่น้อยที่สุด 
4. RIP จะมีการ update routing table ระหว่างเราเตอร์ด้วยกัน ทุกๆ 30 วินาที 

- วิธีติดตั้ง RIP

R1#config terminal
R1(config)#router rip
R1(config-router)#network (network address ที่อยู่ติดกับเราเตอร์)

- วิธีการตรวจสอบ RIP
R1#sh ip route
R1#sh ip pro
R1#debug ip rip

--------------------------------------------------------------------------

- OSPF (Open Shortest Path First)
1. ไม่จำกัด hop (RIP จะจำกัด hop ไม่เกิน 30 hop)
2. ใช้ area ในการควบคุมขนาดของเครือข่าย 
3. ใช้ค่า interface cost เป็นหลักในการเลือกเส้นทาง 
interface cost = (10^8)/Bandwidth
4. รองรับเครือข่ายแบบ VLSM 

- วิธีการติดตั้ง OSPF

R1#config terminal
R1(config)#router ospf (process id)
R1(config-router)#network (network address ที่อยู่ติดกับเราเตอร์) (Wildcard Mask ของ network address) area (area id)

==========================================

EIGRP (Enhanced Interior Gateway Routing Protocol) เป็น routing protocol ของ Cisco 

1. EIRGP จะ update routing table ก็ต่อเมื่อมีการเปลี่ยนแปลงของเครือข่ายขึ้นจริงเท่านั้น ซึ่งจะแตกต่างกับ RIP (update routing protocol ทุกๆ 30 วินาที)

วิธีการส่งข้อมูลบนระบบเครือข่าย
- unicast ส่งไประบุปลายทางแค่ 1 ปลายทางเท่านั้น
- multicast ส่งระบุกลุ่มปลายทาง 
- broadcast ไม่ระบุปลายทาง

2. ค่า Metric ของ EIRGP ได้มาจากการคำนวณ เราเรียกว่า Feasible Distance 
Bad - B -> Bandwidth 
Dog - D -> Delay คือ First bit in Last bit out
Really - R -> Reliability คือ ความน่าเชื่อถือของเส้นทาง 
Like - L -> Load คือความคับคั่งของข้อมูล
Meat -> M -> MTU คือ Maximum Transfer Unit

----------------------------------------------------------

DHCP (Dynamic Host Configuration Protocol)

R1#config terminal
R1(config)#ip dhcp pool (xxxx) สร้างชื่อของวง dhcp ที่เราต้องการแจกให้กับเครื่อง host
R1(config-dhcp)#network x.x.x.x (NA) y.y.y.y (SNM) สร้างเครือข่ายที่เราต้องการแจก ip ให้กับเครื่อง host
R1(config-dhcp)#default-router x.x.x.x สร้าง gateway
R1(config-dhcp)#dns-server x.x.x.x สร้าง dns server
R1(config-dhcp)#exit
R1(config)#ip dhcp excluded-address x.x.x.x (ip) y.y.y.y (ip) ยกเว้น ip ไม่ให้แจกไปเครื่อง host จาก ip x.x.x.x ไปจนถึง ip y.y.y.y

ที่เครื่อง client ก็จะใช้คำสั่ง
c:/ipconfig /release เคลียร์ ip ที่รับมาเดิม
c:/ipcofig /renew ขอ ip ใหม่จาก dhcp server

--------------------------------------------------------------------------

วิธี configure ให้ switch เป็น root bridge

SW#config terminal
SW(config)#spanning-tree vlan 1 priority 4096 

SW(config)#spanning-tree vlan 1 root primary
SW(config)#spanning-tree vlan 1 root secondary


----------------------------------------------------------------------------- 

VLAN (Virtual Local Area Network)

VLAN คือ การแบ่งกลุ่มของ client ออกจากกัน ไม่ให้ติดต่อสื่อสารถึงกันได้ ถึงแม้ว่า
- จะอยู่บนสวิตซ์ตัวเดียวกัน
- IP Address เครือข่ายเดียวกัน

ประโยชน์จากการแบ่ง VLAN
1. Security เนื่องจากบางกลุ่มไม่จำเป็นต้องติดต่อสื่อสารกัน
2. Network Design/ Perfomance ของเครือข่าย ประสิทธิภาพในเครือข่าย เป็นการแยก broadcast เป็นกลุ่มเล็กๆ 

- วิธีการ configure vlan สามารถทำได้ 2  แบบ คือ
1. ทำที่ privilege mode 

SW>enable
SW#vlan database
SW(vlan)#vlan 2 name engineering
SW(vlan)#vlan 3 name marketing
SW(vlan)#vlan 4 name human

2. ทำที่ Global Configuration Mode
SW>enable
SW#config terminal
SW(config)#vlan 5
SW(config-vlan)#name nurse
SW(config-vlan)#vlan 10
SW(config-vlan)#name education

SW#show vlan brief

-----------------------------------------------------------------------------

ชนิดของพอร์ต (Port Type) มีด้วยกัน 2 แบบคือ

1. Access Port คือพอร์ตที่จะทำการสื่อสารกับอุปกรณ์ปลายทางได้เพียง vlan เดียวเท่านั้น ใช้สำหรับเชื่อมต่ออุปกรณ์คอมพิวเตอร์, IP Phone, IP Camera, printer และอื่นๆ 

SW#config terminal
SW(config)#int fa0/1
SW(config-if)#switchport mode access
SW(config-if)#switchport access vlan (vlan id)

2. Trunk Port คือพอร์ตที่จะอนุญาตให้ทุก VLAN สามารถสื่อสารผ่านพอร์ตนี้ได้ ใช้สำหรับเชื่อมกันระหว่างสวิตซ์กับสวิตซ์

SW#config terminal
SW(config)#int gi0/1
SW(config-if)#switchport mode trunk

=================================================

*** Day 5 ***

VTP (VLAN Trunking Protocol) เป็น protocol ที่ทำการใช้สื่อสารฐานข้อมูล vlan (vlan id, vlan name) ผ่านทาง Link ที่เป็น trunking ไปให้กับ switch ที่อยู่ภายใต้โดเมนเดียวกัน จะแบ่งได้เป็น 3 mode คือ

1. Server 
- เราสามารถสร้าง/ลบ/เปลี่ยนแปลง ฐานข้อมูล VLAN ไปให้กับ switch ที่ทำงานภายใต้โดเมนเดียวกัน
- โดย default ของ switch จะเป็นโหมด Server 
- ใน 1 ระบบ ไม่ควรมี VTP Server เกิน 1 ตัว ควรจะมี switch เพียงตัวเดียวเท่านั้นที่ทำหน้าที่เป็น Server

2. Client 082-8184653
- จะรับฐานข้อมูล VLAN และส่งต่อไปให้กับ switch อื่นๆ ได้ 
- เราไม่สามารถ สร้าง/ลบ/เปลี่ยนแปลง ฐานข้อมูล VLAN บน client ได้

3. Transparent 
- จะส่งฐานข้อมูล VLAN ไปให้กับ switch อื่นๆ โดยไม่เก็บฐานข้อมูล VLAN ไว้ที่ตัวมันเอง 
- เราสามารถสร้าง/ลบ/เปลี่ยนแปลง ฐานข้อมูล VLAN

วิธีการติดตั้งตัว VTP สามารถทำได้โดย

SW>enable 
SW#config terminal
SW(config)#vtp domain (xxxx) กำหนดโดเมนให้กับสวิตซ์
SW(config)#vtp mode (server, client, transparet)
SW(config)#vtp password (xxxx) กำหนด password ให้กับ vtp domain นี้


---------------------------------------------

Lab 23 Port Security

SW#config terminal
SW(config)#int fa0/1
SW(config-if)#switchport mode access
SW(config-if)#spanning-tree portfast
SW(config-if)#switchport port-security
SW(config-if)#switchport port-security mac-address sticky
SW(config-if)#switchport port-security mac-address x.x.x - ระบุ mac address ให้กับ intreface นี้

วิธีการจำกัด mac-address มากที่สุดที่สามารถเข้ามาที่ switch ได้
SW(config-if)#switchport port-security maximum 9

SW#clear mac-address-table dynamic

------------------------------------------------------------------------

Route on stick คือ การทำให้ vlan แต่ละ vlan สามารถสื่อสารถึงกันได้ ซึ่งจำเป็นต้องใช้อุปกรณ์ Router เข้ามาช่วย 

- วิธีการติดตั้ง Route on stick 
1. ทำสายที่ต่อเข้าระหว่าง switch กับ router เป็น trunking
SW#config terminal
SW(config)#int fa0/1
SW(config-if)#switchport mode trunk

2. ที่เราเตอร์ต้องสร้าง sub interface ในแต่ละ vlan ขึ้นมา และสร้าง trunk, กำหนด ip address, subnet mask ให้กับ sub interface ที่สร้างขึ้นมาใหม่นี้

R1#config terminal
R1(config)#int fa0/0.2 สร้าง sub interface ของ vlan 2
R1(config-if)#encapsulation dot1q 2
R1(config-if)#ip address 192.168.2.1 255.255.255.0
R1(config-if)#no shut

R1(config)#int fa0/0.3 สร้าง sub interface ของ vlan 3
R1(config-if)#encapsulation dot1q 3
R1(config-if)#ip address 192.168.3.1 255.255.255.0
R1(config-if)#no shut

3. ที่ PC เราต้องกำหนด gateway ให้ชี้ไปยัง ip ของ sub interface ที่สร้างขึ้นมา เช่น 
PC อยู่ที่ VLAN 2 : 192.168.2.0/24
PC - 192.168.2.11
SNM - 255.255.255.0
GW - 192.168.2.1 

-------------------------------------------------------------------------

Inter Vlan Routing คือ การทำให้ vlan แต่ละ vlan สามารถสื่อสารถึงกันได้  ซึ่งจำเป็นต้องใช้อุปกรณ์ Layer 3 Switch เข้ามาช่วย 

- วิธีการติดตั้ง Inter Vlan Routing สามารถทำได้โดย 

1. ที่ L3 Switch เราต้องสร้าง interface vlan ขึ้นมา และกำหนด ip, snm ให้กับ interface vlan นั้นๆ 

CORE>enable
CORE#config terminal
CORE(config)#int vlan 2
CORE(config-vlan)ip address 192.168.2.1 255.255.255.0
CORE(config-vlan)#no shut

CORE(config)#int vlan 3
CORE(config-vlan)ip address 192.168.3.1 255.255.255.0
CORE(config-vlan)#no shut

2. ที่ PC เราต้องกำหนด gateway ให้ชี้ไปยัง ip ของ interface vlan ที่สร้างขึ้นมา
PC อยู่ที่ VLAN 2 : 192.168.2.0/24
PC - 192.168.2.11
SNM - 255.255.255.0
GW - 192.168.2.1 

--------------------------------------------------------------------------
Access Control List มี 2 แบบ คือ Standard และ Exteded ACL

Lab 26

1. ไม่อนุญาตให้วง 172.16.10.0/24 สามารถ access วง 172.16.40.0/24 ได้
RedDeer(config)#access-list 10 deny 172.16.10.0 0.0.0.255
RedDeer(config)#access-list 10 permit any
RedDeer(config)#int fa0/1
RedDeer(config-if)#ip access-group 10 out

2. ไม่อนุญาตให้ ip 172.16.10.5/24 สามารถใช้บริการที่เซิร์ฟเวอร์ 172.16.50.7/24 ได้
Edmonton(config)#access-list 100 deny ip host 172.16.10.5 host 172.16.50.7
Edmonton(config)#access-list 100 permit ip any any
Edmonton(config)#int fa0/1
Edmonton(config-if)#ip access-group 100 in

3. อนุญาตให้ admin ip 172.16.20.163 ให้ telnet เข้ามาที่ router RedDeer ได้เพียงเครื่องเดียวเท่านั้น
RedDeer(config)#access-list 20 permit host 172.16.20.163
RedDeer(config)#line vty 0 4
RedDeer(config-line)#access-class 20 in

------------------------------------------------------------------------------

Link Aggreagation คือการรวม Link ต่างๆ เพื่อให้มี bandwidth ที่เยอะขึ้น จะช่วยแก้ปัญหาในเรื่องคอขวด 

Link Aggreagate (802.3ad) cisco จะใช้คำว่า Etherchannel สามารถใช้งานได้มากสุด 8 พอร์ต จะแบ่งเป็น 2 แบบ 

1. Pagp เป็น propietary ของ cisco 
2. Lacp เป็นมาตรฐานกลาง


--------------------------------------------------------------------

ไม่มีความคิดเห็น:

แสดงความคิดเห็น