top of page

LAB : Basic Switch Configuration

จาก Network Diagram ทำการตั้งค่าบน Switch ตามหัวข้อดังต่อไปนี้


Network Diagram


1. ตรวจสอบ IOS Software version, System image และ Model ของอุปกรณ์ Switch

2. ตั้งค่าชื่อของ Switch ให้มีชื่อว่า SW1 Hostname : SW1

3. ตั้งค่า password เพื่อป้องกันผู้อื่นเข้าสู่ privileges exec mode (enable password :1234 และ enable secret เป็น cisco)

4. ตั้งค่า IP Address บน Interface VLAN 1 และตั้งค่า Gateway ให้กับ Switch (ให้ดู IP Address จาก Network Diagram ส่วน Gateway คือ 192.168.1.1)

5. ตั้งค่า password เมื่อมีการเรียกใช้งานผ่าน apllication telnet (password : vtycisco)

6. บันทึกค่า Configuration จาก RAM (running-config) ไปสู่ NV RAM (startup-config) ซึ่งเป็นการ save Configuration นั่นเอง

7. ตรวจสอบ MAC Address Table ของ Switch แต่ละตัว

8. Clear Mac Address Table ของ Switch แต่ละตัว


 
 

สิ่งที่ต้องตรวจสอบก่อน

 

1. ตรวจสอบการเชื่อมต่อเป็นไปตาม Network Diagram หรือไม่

2. Notebook1- 4 จะต้องตั้งค่า IP Address ตาม Network Diagram เรียบร้อยแล้ว


 

Task and Configuration

 

1. ตรวจสอบ IOS Software version, System image และ Model ของอุปกรณ์ Switch

พิมพ์คำสั่ง “enable” เพื่อเข้าสู่ Privileges EXEC Mode หรือ Enable Mode (หากคำสั่งไม่ซ้ำกับคำสั่งอื่นๆ สามารถพิมพ์ย่อๆได้ เช่น จาก enable ก็พิมพ์แค่ en เป็นต้น)

 Switch>en
 Switch# 

ใช้คำสั่ง “show version”

Switch#show version 
Cisco IOS Software, C2960 Software (C2960-LANBASE-M), Version 12.2(25)FX, RELEASE SOFTWARE (fc1)

จากบรรทัดด้านบนจะแสดง Software Versiom ของ IOS

-------------ตัดบางส่วน------------------------
Cisco WS-C2960-24TT (RC32300) processor (revision C0) with 21039K bytes of memory.
-------------ตัดบางส่วน------------------------

จากบรรทัดด้านบน จะแสดง Model ของ Switch


 

2. ตั้งค่าชื่อของ Switch ให้มีชื่อว่า SW1 Hostname : SW1


หมายเหตุ: ในการทำงานจริง ควรตั้งชื่อของอุปกรณ์ Network ให้สื่อถึงรุ่น และตำแหน่งที่ตั้งของ Swich เช่น

C29BKK-B1F1-1

C = อุปกรณ์ยี่ห้อ Cisco

29 = รุ่น 2960

BKK = ติดตั้งอยู่ที่ กรุงเทพฯ, B1 = อาคาร 1, F1 = ชั้นที่ 1, 1 = อุปกรณ์ตัวที่ 1

เข้าไปที่ Switch SW1

การตั้งค่า Switch จำเป็นจะต้องเข้าสู่โหมด Global Configuration ก่อน จากนั้นก็ตั้งค่า Hostname ของ Switch ชื่อ SW1

 Switch>en
 Switch#conf t
 Switch(config)#hostname SW1
 SW1(config)#

สังเกตได้ว่าชื่อ Switch จะถูกเปลี่ยนแปลงจาก Switch เป็น SW1 ในทันที

ออกมาจากโหมด Global Configuration

SW1(config)#exit
SW1# 

ตรวจสอบการตั้งค่า Configuration

SW1#show running-config 
Building configuration...
-------------ตัดบางส่วน------------------------
!
hostname SW1
!
-------------ตัดบางส่วน------------------------

 

3. ตั้งค่า password เพื่อป้องกันผู้อื่นเข้าสู่ privileges exec mode (enable password :1234 และ enable secret เป็น cisco)


ทำการตั้งค่า Password ก่อนที่จะเข้าสู่ Privileged EXC Mode หรือก่อนเข้าสู่ Enable Mode

 SW1#conf t
 SW1(config)#enable password 1234
 SW1(config)# 

ทดสอบโดยการออกจากโหมด Global Configuration

 SW1(config)#end
 SW1#exit 

ทำการเข้าสู่โหมด Privileged EXC หรือฌหมด Enable อีกครั้ง แล้วทำการใส่ Password ที่ได้ทำการตั้งค่าไว้ก่อนหน้านี้

SW1>enable 
 Password: 
 SW1# 

ตรวจสอบการตั้งค่า Configuration

SW1#show running-config 
Building configuration...
-------------ตัดบางส่วน------------------------
!
hostname SW1
!
enable password 1234
!
-------------ตัดบางส่วน------------------------ 

การตั้งค่าโดยใช้คำสั่ง enable password เราจะพบว่าเมื่อใช้คำสั่ง “show running-config” ก็จะรู้ได้ทันทีว่า Password คือคำว่า “1234” ถือว่าไม่ปลอดภัย(เป็น Password แบบ Clear Text) แต่ถ้าเราตั้งค่า password โดยคำสั่ง “enable secret” จะมีความปลอดภัยกว่า เพราะจะมีการเข้ารหัสไว้ด้วยอัลกอริทึมที่ชื่อว่า MD5

ทำการตั้งค่า enable secret

 SW1#conf t
 SW1(config)#enable secret cisco
 SW1(config)#
 SW1(config)#exit 
 SW1# 

ตรวจสอบการตั้งค่า Configuration

SW1#show running-config 
Building configuration...
-------------ตัดบางส่วน------------------------
enable secret 5 $1$mERr$hx5rVt7rPNoS4wqbXKX7m0
enable password 1234
!
-------------ตัดบางส่วน------------------------

จะเห็นได้ว่า password ในส่วนของ enable secret มีการเข้ารหัสเอาไว้


 

4. ตั้งค่า IP Address บน Interface VLAN 1 และตั้งค่า Gateway ให้กับ Switch (ให้ดู IP Address จาก Network Diagram ส่วน Gateway คือ 192.168.1.1)

ตั้งค่า IP Address เพื่อใช้ในการ Management (เช่นใช้ในการ Telnet หรือ SSH เข้ามาที่ Switch) แล้วทำการเปิด Port ด้วยคำสั่ง “no shutdown”


 SW1#conf t
 SW1(config)#interface vlan 1
 SW1(config-if)#ip address 192.168.1.6 255.255.255.0
 SW1(config-if)#no shutdown 
 SW1(config-if)# 
 SW1(config-if)#exit 
 SW1(config)# 

ตั้งค่า Gateway ให้กับ Switch “SW1”

สำหรับในส่วนของ Management หากมีการติดต่อสื่อสารกันข้ามวง Network ก็จำเป็นต้องมีการตั้งค่า Gateway

 SW1(config)#ip default-gateway 192.168.1.1
 SW1(config)# 

ออกจากโหมด Global Configuration

 SW1(config)#end 
 SW1# 

ทำการตรวจสอบสถานะและ IP Address ของ Interface Vlan 1


SW1#show ip interface brief 

Interface IP-Address OK? Method Status Protocol 
FastEthernet0/1 unassigned YES manual up up 
-------------ตัดบางส่วน------------------------ 
Vlan1 192.168.1.6 YES manual up up
SW1#

จะเห็นได้ว่า สถานะของ Interface Vlan 1 จะ up และ Protocol ก็ up เช่นกัน

ตรวจสอบการตั้งค่า Configuration


SW1#show running-config 
 
Building configuration... 
-------------ตัดบางส่วน------------------------ 
!
interface Vlan1
 ip address 192.168.1.6 255.255.255.0
!
ip default-gateway 192.168.1.1
!
-------------ตัดบางส่วน------------------------ 
End 

ทดสอบ Ping จาก Switch ไปหา Notebook 1

SW1#ping 192.168.1.101
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.101, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 0/0/0 ms
SW1#

ก็จะพบว่าสามารถ ping ได้ปกติ

จาก Notebook 1 ทดสอบ ping ไปหา SW1


ก็จะพบว่าสามารภ ping ได้ปกติ

 

5. ตั้งค่า password เมื่อมีการเรียกใช้งานผ่าน apllication telnet (password : vtycisco)

เป็นการตั้งค่าให้สามารถ Remote เข้ามาที่ตัวอุปกรณ์ Switch ได้

 SW1#conf t
 SW1(config)#line vty 0 4
 SW1(config-line)#password vtycisco
 SW1(config-line)#login
 SW1(config-line)#
 SW1(config-line)#end
 SW1#

ความหมายเพิ่มเติมของคำสั่ง

Line vty 0 4 - คำว่า 0 4 หมายถึง สามารถ telnet เข้ามาได้พร้อมๆกัย 5 session คือ session 0 – 4

Password vtycisco – เป็นรหัสผ่านใน line vty หาก Remote เข้ามาใน line vty ต้องใส่ password นี้

Login - เป็นการระบุให้มีการ Login ก่อนเข้าถึง Line vty

ทำการทดสอบโดยเข้าไปที่ Notebook 1 แล้วทำการ Telnet เข้ามาที่ SW1 ด้วย command ตามภาพ


 

6. บันทึกค่า Configuration จาก RAM (running-config) ไปสู่ NV RAM (startup-config) ซึ่งเป็นการ save Configuration นั่นเอง


SW1#copy running-config startup-config 
Destination filename [startup-config]? 
Building configuration...
[OK]
SW1#
 
ตรวจสอบการ save Configuration
 
SW1#show startup-config 
 
Using 1127 bytes
-------------ตัดบางส่วน------------------------ 
!
hostname SW1
!
enable secret 5 $1$mERr$hx5rVt7rPNoS4wqbXKX7m0
enable password 1234
!
-------------ตัดบางส่วน------------------------ 

 

7. ตรวจสอบ MAC Address Table ของ Switch แต่ละตัว

ก่อนอื่นต้องทำการทดสอบ Ping หากันระหว่าง Notebook แต่ละเครื่องก่อน เพื่อให้ Switch มีการเรียนรู้ MAC Address ของ Notebook เข้ามาในแต่ละ Port หลังจากนั้นทำการตรวจสอบ MAC Address Table ของ SW1 ด้วยคำสั่งต่อไปนี้


SW1#show mac address-table 
 
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
 1 0001.961b.69ed DYNAMIC Fa0/2
 1 000c.cf4b.3d3a DYNAMIC Gig0/2
 1 0060.70b8.4e00 DYNAMIC  Fa0/1
 1 0090.212c.95c6 DYNAMIC Gig0/2
 1 00d0.9739.3c1a DYNAMIC Gig0/2
SW1#

MAC Address 0001.961b.69ed เรียนรู้เข้ามาทาง Port Fa0/2 ซึ่งเป็น MAC ของ Notebook 1

MAC Address 000c.cf4b.3d3a เรียนรู้เข้ามาทาง Port Gig0/2 ซึ่งเป็น MAC ของ Notebook 3

MAC Address 0060.70b8.4e00 เรียนรู้เข้ามาทาง Port Fa0/1 ซึ่งเป็น MAC ของ Notebook 2

MAC Address 0090.212c.95c6 เรียนรู้เข้ามาทาง Port Gig0/2 ซึ่งเป็น MAC ของ Notebook 4

MAC Address 00d0.9739.3c1a เรียนรู้เข้ามาทาง Port Gig0/2 ซึ่งเป็น MAC ของ Port Gig0/2 ของ SW2

 

8. Clear Mac Address Table ของ Switch แต่ละตัว

 SW1#clear mac address-table 
 SW1# 

หลังจาก Clear MAC Address ใน SW1 แล้ว ทำการตรวจสอบโดยเข้าไปดู MAC Address Table ของ Switch อีกครั้ง

 SW1#show mac address-table 
 Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
SW1#

จะพบว่า MAC Address Table ถูก Clear ออกไปเรียบร้อยแล้ว

 

Final Configure


 


SW1#show running-config 
!
hostname SW1
!
enable secret 5 $1$mERr$hx5rVt7rPNoS4wqbXKX7m0
enable password 1234
!
interface Vlan1
 ip address 192.168.1.6 255.255.255.0
 no shutdown
!
ip default-gateway 192.168.1.1
!
line vty 0 4
 password vtycisco
 login
 end


ดู 487 ครั้ง0 ความคิดเห็น
bottom of page