10-25-2012 05:24 AM
Hi all,
I development the script tcl for syncronize the settings two router in mode hsrp. Follow bellow
proc gerar_configuracoes {
set confs_nat [ exec "show running-config | include nat" ]
set confs_acl [ exec "show running-config | include access-list" ]
set confs_hsrp_outside [ exec "show running-config interface fastEthernet 0/0 | inc standby" ]
set confs_hsrp_inside [ exec "show running-config interface fastEthernet 0/1 | inc standby" ]
set acl_confs "access-lists_confs.txt"
set nat_confs "nat_confs.txt"
set hsrp_confs "hsrp_confs.txt"
set FileAclId [open $acl_confs "w"]
set FileNatId [open $nat_confs "w"]
set FileHsrpId [open $hsrp_confs "w"]
puts $FileAclId $confs_acl
puts $FileNatId $confs_nat
puts $FileHsrpId $confs_nat
close $FileAclId
close $FileNatId
close $FileHsrpId
}
My idea is generate file with commands, with this script the file with commands is generate. Now how go sync the settings?
I thought of using rcmd rsh but with running the command "rsh 192.168.0.3 /user command" does not allow me to run the command "configure terminal" then run the commands themselves. any ideas
Regards.
Solved! Go to Solution.
10-25-2012 07:57 AM
To do configurtation in tclsh, use "ios_config". For example:
ios_config "int fa0/0" "shut" "end"
11-02-2012 12:21 AM
The ios_config command is a Tcl function, not an IOS command. So, you need to wrap it within a Tcl script. For example, assume you have a Tcl script like (call it config.tcl):
ios_config "int fa0/0" "shut" "end"
Then your rsh command would be:
rsh 192.168.0.3 /user cisco tclsh config.tcl
10-25-2012 07:57 AM
To do configurtation in tclsh, use "ios_config". For example:
ios_config "int fa0/0" "shut" "end"
10-25-2012 09:26 AM
Hi,
I trying the command.
R1#rsh 192.168.0.3 /user cisco ios_config "int fa0/0" "shut" "end"
Line has invalid autocommand "ios_config "int fa0/0" "shut" "end""
R1#
the command worked
R1#rsh 192.168.0.3 /user cisco show arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 192.168.1.1 41 0000.0c07.ac01 ARPA FastEthernet0/1
Internet 192.168.0.2 58 ca00.0ef8.0008 ARPA FastEthernet0/0
Internet 192.168.1.3 - ca02.0ef8.0006 ARPA FastEthernet0/1
Internet 192.168.1.2 31 ca00.0ef8.0006 ARPA FastEthernet0/1
Internet 192.168.0.3 - ca02.0ef8.0008 ARPA FastEthernet0/0
Internet 192.168.1.20 - ca02.0ef8.0006 ARPA FastEthernet0/1
R1#
Any idea
11-02-2012 12:21 AM
The ios_config command is a Tcl function, not an IOS command. So, you need to wrap it within a Tcl script. For example, assume you have a Tcl script like (call it config.tcl):
ios_config "int fa0/0" "shut" "end"
Then your rsh command would be:
rsh 192.168.0.3 /user cisco tclsh config.tcl
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide