You are on page 1of 4

Gio trnh thc hnh BSCI

Chng 1 TCL Script

Chng 1 -

TCL Script

Bi 1.1 TCL Script 1.1.1 S lun l


Lo1 : 10.2.1.1/30 Lo2 : 10.2.2.1/30 Lo3 : 10.2.3.1/30 Lo4 : 10.2.4.1/30

Lo1 : 10.1.1.1/30 Lo2 : 10.1.2.1/30 Lo3 : 10.1.3.1/30 Lo4 : 10.1.4.1/30

R1

S0/0/0

S0/0/0

R2

Hnh 1.1.1-1: Hnh v s lun l

1.1.2

Mc tiu bi thc hnh S dng Tcl Script kim tra ton b kt ni Pht hin ra nhng lin kt li

1.1.3

Cu hnh v hnh v minh ha Bc 1: Cu hnh c bn cho R1, R2

R1 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
21

Gio trnh thc hnh BSCI

Chng 1 TCL Script

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.252 R1(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 synchronous R2(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 shutdown R2(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
22

Gio trnh thc hnh BSCI

Chng 1 TCL Script

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, R2 Cu hnh RIPv2 trn 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 trn 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 ni R1# 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 ms Type escape sequence to abort.
23

Gio trnh thc hnh BSCI

Chng 1 TCL Script

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 ms Type 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

24

You might also like