proc setOneDest { a } { set a [string tolower $a] set b [string first "/dyndest:" $a] if {$b < 0} return set c [string last "/" $a] set b [expr $b+9] set c [expr $c-1] set c [string range $a $b $c] set b [expr [string first " " $a]-1] set b [string range $a 0 $b] set a [exec ping $c tim 0 rep 1] set a [string tolower $a] set d [expr [string first "echos to" $a]+9] if {$d < 0} return set e [string length $a] set a [string range $a $d $e] set e [expr [string first "," $a]-1] set a [string range $a 0 $e] puts "setting if=$b adr=$a dom=$c..." ios_config "int $b" "tunnel destination $a" } proc setAllDests {} { set a [exec show interfaces description] set a [split $a "\n"] foreach c $a {setOneDest $c} } setAllDests