วันอังคารที่ 7 เมษายน พ.ศ. 2558

Basic Config Cisco Switch

เริ่มจาการตั้ง password
 # password จะมี 2 mode ตามความเข้าใจ เรียกสัน ๆ ว่า user mode และ admin mode (privileged  mode) แตกต่างกันตรง user mode จะแก้ไข config ไม่ได้ สังเกตุได้จากเครื่องหมาย ">" อยู่หน้าคำสั่ง แต่ถ้าอยู่ใน admin mode จะมีเครื่องหมาย "#" หน้าคำสัง

เริ่มกันเลย...

ตั้ง Password สำหรับ Line Console
switch(config)# line console 0
switch(config-line)#password password  // ใช้ password คือ password สำหรับเชื่อมต่อผ่านสาย Console //
switch(config-line)# login  // จะต้องเปิดใช้งาน line console หากไม่มี command "login" password ที่ใช้บน line console จะไม่ทำงาน

ตั้ง Password สำหรับ admin mode/priviledge exec mode
.. เราสร้าง Password ให้แก่ priviledge exec mode หรือ admin mode ซึ่งเป็นการ security ต่อจาก Line Console อีกหนึ่งชั้น
switch#config terminal
switch(config)# enable password @password // password สำหรับ admin mode คือ @password //

ตั้ง Password สำหรับ Line vty (telnet)
switch(config)#line vty 0 4  // ( maximum is 0 15 ซึ่งเท่ากับสามารถรับได้สูงสุดพร้อมกัน 16 คน )
switch(config-line)#password @passwor0rd // password สำหรับ user mode คือ @passw0rd //
switch(config)#login
 ** เมื่อทำการ Telnet ไปยังอุปกรณ์ จะถาม password นี้ก่อนหนึ่งขั้นตอน หลังจากนั้นจึงถาม password privilege mode ต่อไป **

*Trick* ! หากเชื่อมต่อผ่าน browser ให้ใช้ user login = admin และใช้ password = password admin mode !

การ Config interface หลาย interface พร้อมกัน(ragne)
switch# config terminal
switch(config)# interface range GigabitEthernet 0/3-4  // กำหนดเป็น port ที่ 3 และ 4 //
switch(config)# switch mode access  // เป็น mode access หรือ trunk ตามต้องการ //
switch(config)# switch access vlan 2 // กำหนดให้รองรับ vlan 2 (หมายถึง vid 2) //

Command Cisco ควรรู้
switch#no logging console ==> ไม่ให้แสดง status ของ port ขณะทำการ config ผ่าน Console
switch#show ip interface brief ==> แสดงรายละเอียดของ Interface
switch(config) # snmp-server communication public RO ==> กำหนดให้ snmp ทำงานภายใต้เงื่อนไข ReadOnly
switch(config)#reload ==>  คือการสั่ง reload config หรือว่ามองว่าเป็นการ reboot switch ก็น่าจะได้
switch#sh interface status ==> คือการแสดงสถานะการเชื่อมต่อแต่ละ port ว่าเชื่อมต่อที่ vlan ใด และมี speed เท่าใด
switch#switchport trunk allowed vlan 1,91-108,192 ==> หมายถึง ยอมให้ vlan ตามที่แสดงส่งผ่านข้อมุลได้ ถึงแม้ว่า port ดังกล่าวจะเป็น mode trunk ก็ตาม (จะต้องกำหนด port เป็น mode trunk ด้วย)

!* บทความน่าสนใจ*!

** บนความน่าสนใจเพิ่มเติม
1.trunk encapsulation dot1q คือ คำสั่งนี้จะอยู่บน Router นะครับ จะถูก config ในตัวของ Sub-interface  จะใช้ในกรณีที่ router ต้องการให้หลายๆๆ vlan วิ่งผ่าน จะคล้ายๆ การทำ trunk บน switch sub-interface แต่ละ sub ก็สามารถ encap ได้หลายๆ  vlan นะครับ   ส่วนคำสั่ง encapsulation dot1q xxx native  ก้อเกิดมาจากในเครือข่ายของเราได้ทำการ config switch เอาไว้ ให้เป็น native ซึ่งโดยปกติ port ที่เป็น trunk เมื่อมี frame ของ vlan ต่างๆผ่านเข้ามา มันจะทำการติด tag เข้าไปที่ header แ ต่ถ้าเมื่อ frame ที่เป็นของ native vlan เข้ามาทาง trunk port จะไม่ทำการติด tag ที่ header และเมื่อ frame ไปถึงปลายทางแล้วมันแกะดูใน header ไม่พบ tag ดังกล่าวมันก็จะทราบทันทีว่าเป็น frame ของ native vlan ซึ่งโดย default นะครับ native vlan จะถูกกำหนดไว้เป็น vlan 1 แต่เราสามารถเปลี่ยนได้  ดังนั้นเมื่อที่ switch มีการสร้าง native ที่ router จึงต้องทำการ encapsulation ตัว native ด้วย  ประโยชน์จริงๆแล้วของ native ก็เอาไว้เพื่อทำการ mange ตัว device ต่างๆนั่นเอง (ที่มา:www.thaiadmin.org) 
2. port channel หากต่อกับ server mode active แต่ถ้าต่อกับ switch mode on


ขอขอบคุณความรู้จาก http://www.jodoi.com