View Single Post
Tuổi 22-03-2016, 10:27 AM   #1
hoctinhoc
Guest
 
Trả Lời: n/a
Tổng hợp 1 số lệnh cơ bản quản lý Switch Cisco
Tổng hợp 1 số lệnh cơ bản quản lý Switch Cisco

1. Download và cài đặt các Driver cần thiết


https://drive.google.com/file/d/1Kuw...P8sK8SUEq/view

- Download Driver dây quản lý - console https://drive.google.com/file/d/0B9f...ew?usp=sharing


- Download HyperTerminal quản lý Switch https://digitizor.com/wp-content/upl...rterminal1.zip

- Download SecureCRT quản lý Switch https://www.fshare.vn/file/PP8OJDW6SAQL

Hướng dẫn kết nối vào Switch bằng dây Console

http://solution.forumvi.com/t82-topic

2. Chuyển đổi tốc độ port switch từ 1000Mbps xuống 100Mbps (thí dụ trên port 22)

Switch>en
Switch#conf t
Switch(config)# interface gigabitethernet 1/0/22
Switch(config-if)# speed 100
Switch(config-if)# exit
Switch # show interfaces status


2.1. Chuyển đổi tốc độ port switch từ 1000Mbps xuống 500Mbps (thí dụ trên port 22)

OutBound

Switch>en
Switch#conf t
mls qos
Switch(config)# interface gigabitethernet 1/0/22
priority-queue out
srr-queue bandwidth limit 50
Switch(config-if)# end
show mls qos
show mls qos interface gigabitEthernet 1/0/22 queueing

InBound

conf t
mls qos
ip access-list extended ACL_SLAP
permit ip any any
class-map match-all CLASS_SLAP
match access-group name ACL_SLAP
policy-map POLICY_SLAP
class CLASS_SLAP
police 500000000 100000 exceed-action drop
interface GigabitEthernet 1/0/22

service-policy input POLICY_SLAP

3. Tắt, mở port (thí dụ trên port 22)

Switch>en
Switch#conf t
Switch(config)# interface gigabitethernet 1/0/22
Switch(config-if)# shutdown ---> tắt port
Switch(config-if)# no shutdown ---> mở port
Switch(config-if)# exit

4. Xem trang thái tất cả các port

Switch # show interfaces status

5. Xem băng thông Port (thí dụ trên port 22)

Switch#show interface gigabitEthernet 1/0/22


6. Kiem tra và clear cache arp
Switch#show mac address-table | include 18:OB
Switch#show mac address-table
clear mac address-table static interface Gi1/0/17
clear mac address-table dynamic interface Gi1/0/17


VLAN


7. Đăt IP cho Vlan , ip cho Switch
interface Vlan1
ip address 192.168.1.15 255.255.255.0
exit
ip default-gateway 192.168.1.1
no ip route-cache
no shutdown


8. Gán Description cho Port


Switch>en
Switch#conf t
Switch(config)# interface gigabitethernet 1/0/22
Switch(config-if)# description "ThegioisoIP.22"
Switch(config-if)# exit or end


8.1 Tạo Vlan


Switch>en
Switch#conf t
Switch(config)# vlan 3

Switch(config)# name test3


9. Switch Port to Vlan


Switch(config)#interface gia 1/0/22

Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 3

9. Switch Port to Vlan

Switch(config)#interface range gia 1/0/22-40
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 3


Disable Vlan

#show vlan status

#conf t
#no vlan 10

Kiểm tra Vlan đang đặt IP và dùng Range IP nào?


Trunk Port

switch# configure terminal
switch(config)# interface giga 1/0/27

switch(config-if)# switchport mode trunk

switch(config-if)# switchport trunk allow vlan 883


c3550(config-if)#switchport trunk encapsulation dot1q

c3550(config-if)#switchport mode trunk

3550(config-if)#switchport trunk allowed vlan remove 5-10,12
c3550(config-if)#switchport trunk allowed vlan add 7


Xem Trunk cho phép vlan nào?

#show interfaces fastEthernet 0/2 trunk

Xem cấu hình Port

#show run fastEthernet 0/2


# show interface vlan 10

10. Access-list chặn port trên switch

10.1. Các lệnh apply vào port 37

TGS#configure t
TGS(config)#interface gigabitEthernet 1/0/37
TGS(config-if)#access-list 102 deny tcp any any eq 53
TGS(config-if)#access-list 102 deny udp any any eq 53
TGS(config-if)#access-list 102 deny udp any eq 53 host 125.212.218.2

(thí dụ muốn chặn tất cả các kết nối từ ngoài vào port 53 của IP : 125.212.218.2 thì dùng lệnh trên)

10.2. Apply access-list vào port

TGS#configure t
TGS(config)#interface gigabitEthernet 1/0/37
TGS(config-if)#ip access-group 102 in



10.3. Xem các rule trong access-list


TGS#show access-lists 102
Extended IP access list 102
10 deny tcp any any eq domain
20 deny udp any any eq domain
30 permit ip any any

10.4. diable Access-list

no access-lists 102

conf t
interface giga 1/0/33
no ip access-group <acl-number> in|out



Destination_Address : IP của server


http://www.cisco.com/c/en/us/support...cesslists.html

10. Lưu cấu hình Switch vào start up

copy running-config startup-config


11. Đặt tên switch

hostname TGS_TanThuan

12. Đặt Password
, tạo User Login
myswitch(config)# username Usertest password Aa123456 và Enable secret (password enable)

myswitch# enable secret Aa123456
http://www.thegeekstuff.com/2013/08/enable-ssh-cisco/?utm_source=feedburner&utm_medium=feed&utm_campaig n=Feed%3A+TheGeekStuff+(The+Geek+Stuff)


http://www.lecuong.info/2011/09/basi...s-command.html


13. Kiem tra port mang co bi policy or gioi hang gi ko?

show interfaces gigabitEthernet 1/0/12
show running-config interface gigabitEthernet 1/0/12

conf t

interfaces gigabitEthenet 1/0/12

Không giới hạng Port mạng

gõ: no srr-queue bandwidth limit 25

Giới hạng port mạng chạy 25% của 100Mb gõ lênh:

srr-queue bandwidth limit 25


Hướng dẫn Backup và restore cấu hình Cisco Switch

1. Xây dựng 1 ftp Server (không cần chứng thực )

2. Và switch gõ lệnh sau

#copy running-config ftp:

Nhập IP ftp server
Nhập Tên File hoặc Enter


** Restore a configuration to a switch from a TFTP server

#copy ftp: startup-config

Nhập IP FPT
Nhập Tên File cần Restore

#wr mem

** Restore switch lại mật định


copy startup-config running-config


20. Kiểm tra IP, chặn Mac Address trên switch Cisco

- Dùng 1 máy tính cùng mạng cài đặt phần mềm sau và để scan MAC ADDRESS
http://www.advanced-ip-scanner.com/

- Vào Switch gõ lệnh sau
show mac address-table

show mac address-table interface Giga 1/0/3

show mac address-table vlan 1


block Mac address không cho chạy trên vlan

mac address-table static 3408.0499.981c vlan 10 drop

Bỏ block

no mac address-table static 3408.0499.981c vlan 10 drop

21. Cho phép IP nào được chạy trên port mạng (chặn IP port mạng)

Trường hợp bạn chỉ cấp cho Server 2 IP tuy nhiên Server này lại đặt chộm các IP khác thì bạn có thể giới hạn như sau:

Thí du: Server của bạn đang cấm vào Port 26 thì bạn sẽ làm như sau:

Trên Switch gõ các lệnh sau:

- Tạo Access-list tên là 26

#conf t
#ip access-list standard 26
#permit 103.11.226.2
#permit 103.11.226.3
#end

- Apply Access-list vào port 26

#conf t
#interface giga 0/26
#ip access-group 26 in

Trường hợp sau này bạn muốn bỏ Access-list cho port 26 thì bạn vào

#conf t
#interface giga 0/26
# no ip access-group 26 in

22. Show IP mac tương ứng



Xác định IP nằm port nào


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

show ip arp | include b199


show mac address-table | include b199


hoặc

show ip arp | include 103.42.57.21
=================




show ip arp | include de5c
show ip arp
show mac address-table | include 18:OB


Cấu hình storm control

storm-control broadcast level pps 50 40
storm-control multicast level pps 50 40
storm-control unicast level pps 50 40
storm-control action shutdown
errdisable recovery cause storm-control
errdisable recovery interval 30

các lệnh disable

no storm-control broadcast level pps 50 40
no storm-control multicast level pps 50 40
no storm-control unicast level pps 50 40
no storm-control action shutdown
no errdisable recovery cause storm-control
no errdisable recovery interval 60




*********Cho phép Truy cập Switch từ 1 vài IP chỉ định*********


conf t

ip access-list standard telnet

permit 103.88.2.72
permit 103.88.3.235
permit 182.4.2.4
permit 192.168.99.2

conf t

line vty 0 15

access-class telnet in

IIII> Giới hạn băng thông port mạng

conf t
mls qos
ip access-list extended ACL_300M
permit ip any any


class-map match-all CLASS_300M
match access-group name ACL_300M


policy-map POLICY_300M
class CLASS_300M
police 300000000 100000 exceed-action drop

conf t
interface giga 0/10

service-policy input POLICY_300M
service-policy output POLICY_300M


srr-queue bandwidth limit 30

**********************




Xem CPU switch Cisco



show processes cpu sorted


Tham khảo: http://www.cisco.com/c/en/us/support...nfig.html#tftp




Disable SNMP-Server

Switch>enable
Switch#show running-config | include snmp-server (verify there are snmp-server entries, if not then SNMP is not running)
Switch#config term
Switch(config)#no snmp-server
hoặc
Switch(config)#no snmp-server community public RO
Switch#wr

Port-Chanel - Bonding

Tạo Port-chanel cho 2 port 7 và 21 chạy 1 Vlan 218

Cách 1: Tạo port bình thường

conf t
interface port-chanel 5
switchport mode access
swichport access vlan 218

- Đưa Interface 7 và 21 vào port-chanel 5

conf t
interface giga 1/0/7
chanel-group 5 mode active
switchport mode access
swichport access vlan 218



conf t
interface giga 1/0/21
chanel-group 5 mode active
switchport mode access
swichport access vlan 218


Cách 2: Tạo port Trunk


conf t
interface port-chanel 5
switchport mode trunk
switchport trunk encapsulation dot1q
switchport trunk allow vlan all

conf t
interface GigabitEthernet1/0/7
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk allow vlan all
channel-group 5 mode on
end


conf t
interface GigabitEthernet1/0/21
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk allow vlan all
channel-group 5 mode on
end



kiểm tra:

Show etherchannel 5 port-channel

Chặn Mac không cho ra internet khi sử dụng mac này

mac address-table static 7486.7ae9.73dc vlan 111 drop

mac address-table static ecb1.d775.f760 vlan 111 drop

Disable web interface on cisco


sh run | i htt When this returns
– ip http server
– ip http secure serve
Next, type
no ip http server no ip http secure server


** Xác định port mạng đang dùng ip nào

sh mac address-table interface gigabitEthernet 0/25



show mac address-table | include Gi0/25


show ip arp | include 2f63.5e00




****Block port trên interface


conf t
ip access-list extended block-http-https
deny tcp any any eq www
deny tcp any any eq 443
permit ip any any

conf t
interface FastEthernet0/30
ip access-group block-http-https in
end
  Trả lời ngay kèm theo trích dẫn này