chuong1 tcl script

Upload: humg91

Post on 14-Apr-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/27/2019 Chuong1 Tcl Script

    1/4

    Gio trnh thc hnh BSCI Chng 1 TCL Script

    21

    CChhnngg 11 -- TTCCLL SSccrriipptt

    BBii 11..11 TTCCLL SSccrriipptt

    11..11..11 SS lluunn ll

    R1 R2S0/0/0 S0/0/0

    Lo1 : 10.1.1.1/30

    Lo2 : 10.1.2.1/30

    Lo3 : 10.1.3.1/30

    Lo4 : 10.1.4.1/30

    Lo1 : 10.2.1.1/30

    Lo2 : 10.2.2.1/30

    Lo3 : 10.2.3.1/30

    Lo4 : 10.2.4.1/30

    Hnh 1.1.1-1: Hnh v s lun l

    11..11..22 MMcc ttiiuu bbii tthhcc hhnnhh

    S dng Tcl Script kim tra ton b kt niPht hin ra nhng lin kt li

    11..11..33 CCuu hhnnhh vv hhnnhh vv mmiinnhh hhaa

    Bc 1:Cu hnh c bn cho R1, R2R1

    Router(config)#hostname R1

    R1(config)#enable password cisco

    R1(config)#no ip domain-lookup

    R1(config)#banner motd ^C R1^C

    R1(config)#line console 0

    R1(config-line)# logging synchronous

    R1(config-line)# password cisco

    R1(config-line)# login

    R1(config)#line vty 0 4

    R1(config-line)# password cisco

    R1(config-line)# login

    R1(config)#interface Serial 0/0/0

    R1(config-if)#ip address 10.100.12.1 255.255.255.252

  • 7/27/2019 Chuong1 Tcl Script

    2/4

    Gio trnh thc hnh BSCI Chng 1 TCL Script

    22

    R1(config-if)#clock rate 64000

    R1(config-if)#no shutdown

    R1(config-if)#exit

    R1(config)#interface loopback 1

    R1(config-if)#ip address 10.1.1.1 255.255.255.252R1(config-if)#exit

    R1(config)#interface loopback 2

    R1(config-if)#ip address 10.1.2.1 255.255.255.252

    R1(config-if)#exit

    R1(config)#interface loopback 3

    R1(config-if)#ip address 10.1.3.1 255.255.255.252

    R1(config-if)#exit

    R1(config)#interface loopback 4

    R1(config-if)#ip address 10.1.4.1 255.255.255.252

    R1(config-if)#exit

    R2

    Router(config)#hostname R2

    R2(config)#enable password cisco

    R2(config)#no ip domain-lookup

    R2(config)#banner motd ^C R2^C

    R2(config)#line console 0

    R2(config-line)# logging synchronousR2(config-line)# password cisco

    R2(config-line)# login

    R2(config)#line vty 0 4

    R2(config-line)# password cisco

    R2(config-line)# login

    R2(config)#interface serial 0/0/0

    R2(config-if)#ip address 10.100.12.2 255.255.255.252

    R2(config-if)#no shutdownR2(config-if)#exit

    R2(config)#interface loopback 1

    R2(config-if)#ip address 10.2.1.1 255.255.255.252

    R2(config-if)#exit

    R2(config)#interface loopback 2

    R2(config-if)#ip address 10.2.2.1 255.255.255.252

    R2(config-if)#exit

    R2(config)#interface loopback 3

    R2(config-if)#ip address 10.2.3.1 255.255.255.252

  • 7/27/2019 Chuong1 Tcl Script

    3/4

    Gio trnh thc hnh BSCI Chng 1 TCL Script

    23

    R2(config-if)#exit

    R2(config)#interface loopback 4

    R2(config-if)#ip address 10.2.4.1 255.255.255.252

    R2(config-if)#exit

    Bc 2:Cu hnh nh tuyn RIP cho R1, R2Cu hnh RIPv2 t rn R1

    R1(config)#router rip

    R1(config-router)#version 2

    R1(config-router)#network 10.0.0.0

    R1(config-router)#no auto-summary

    R1(config-router)#exit

    Cu hnh RIPv2 t rn R2

    R2(config)#router rip

    R2(config-router)#version 2

    R2(config-router)#network 10.0.0.0

    R2(config-router)#no auto-summary

    R2(config-router)#exit

    Bc 3:S dng Tcl Scipt kim tra kt niR1# tclsh

    R1(tcl)# foreach address {+>(tcl)#10.1.1.1

    +>(tcl)#10.1.2.1

    +>(tcl)#10.1.3.1

    +>(tcl)#10.1.4.1

    +>(tcl)#10.100.12.1

    +>(tcl)#10.2.1.1

    +>(tcl)#10.2.2.1

    +>(tcl)#10.2.3.1

    +>(tcl)#10.2.4.1

    +>(tcl)#10.100.12.2

    +>(tcl)#} {

    +>(tcl)#ping $address

    +>(tcl)#}

    Type escape sequence to abort.

    Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:

    !!!!!

    Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 msType escape sequence to abort.

  • 7/27/2019 Chuong1 Tcl Script

    4/4

    Gio trnh thc hnh BSCI Chng 1 TCL Script

    24

    Sending 5, 100-byte ICMP Echos to 10.1.2.1, timeout is 2 seconds:

    !!!!!

    Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms

    Type escape sequence to abort.

    Sending 5, 100-byte ICMP Echos to 10.1.3.1, timeout is 2 seconds:!!!!!

    Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms

    Type escape sequence to abort.

    Sending 5, 100-byte ICMP Echos to 10.1.4.1, timeout is 2 seconds:

    !!!!!

    Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms

    Type escape sequence to abort.

    Sending 5, 100-byte ICMP Echos to 10.100.12.1, timeout is 2 seconds:

    !!!!!

    Success rate is 100 percent (5/5), round-trip min/avg/max = 56/57/64 ms

    Type escape sequence to abort.

    Sending 5, 100-byte ICMP Echos to 10.2.1.1, timeout is 2 seconds:

    !!!!!

    Success rate is 100 percent (5/5), round-trip min/avg/max = 28/28/32 ms

    Type escape sequence to abort.

    Sending 5, 100-byte ICMP Echos to 10.2.2.1, timeout is 2 seconds:

    !!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 28/28/28 ms

    Type escape sequence to abort.

    Sending 5, 100-byte ICMP Echos to 10.2.3.1, timeout is 2 seconds:

    !!!!!

    Success rate is 100 percent (5/5), round-trip min/avg/max = 28/28/32 ms

    Type escape sequence to abort.

    Sending 5, 100-byte ICMP Echos to 10.2.4.1, timeout is 2 seconds:

    !!!!!

    Success rate is 100 percent (5/5), round-trip min/avg/max = 28/28/28 msType escape sequence to abort.

    Sending 5, 100-byte ICMP Echos to 10.100.12.2, timeout is 2 seconds:

    !!!!!

    Success rate is 100 percent (5/5), round-trip min/avg/max = 28/28/32 ms

    R1(tcl)#tclquit