简介:hostname R1interface Loopback0ip address 2.2.2.2 255.255.255.255 secondaryip address 3.3.3.3 255.255.255.255 secondaryip address 4.4.4.4 255.255.255.255 seco
ndaryip address 1.1.1.1 255.255.25 ...
hostname R1
interface Loopback0
ip address 2.2.2.2 255.255.255.255 secondary
ip address 3.3.3.3 255.255.255.255 secondary
ip address 4.4.4.4 255.255.255.255 seco ndary
ip address 1.1.1.1 255.255.255.255
R1#tclsh
R1(tcl)#proc allens {} {
+>(tcl)#foreach i {
+>(tcl)#1.1.1.1
+>(tcl)#2.2.2.2
+>(tcl)#3.3.3.3
+>(tcl)#4.4.4.4
+>(tcl)#} {puts [ exec "ping $i" ] }
+>(tcl)#}
R1(tcl)#
interface Loopback0
ip address 2.2.2.2 255.255.255.255 secondary
ip address 3.3.3.3 255.255.255.255 secondary
ip address 4.4.4.4 255.255.255.255 seco ndary
ip address 1.1.1.1 255.255.255.255
R1#tclsh
R1(tcl)#proc allens {} {
+>(tcl)#foreach i {
+>(tcl)#1.1.1.1
+>(tcl)#2.2.2.2
+>(tcl)#3.3.3.3
+>(tcl)#4.4.4.4
+>(tcl)#} {puts [ exec "ping $i" ] }
+>(tcl)#}
R1(tcl)#
当输入allens时执行ping命令
R1#allens
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms

