Routing

last person joined: 3 days ago 

Ask questions and share experiences about ACX Series, CTP Series, MX Series, PTX Series, SSR Series, JRR Series, and all things routing, including portfolios and protocols.
  • 1.  How to use script in Putty to send command line by line?

    Posted 01-10-2017 08:52

    Hi In order to send a batch of commands correctly to router, we could use script to send command line by line in Putty. Anyone can give some suggestions how to do that? The below is link for CRT. Do you think Putty has similar way to do that? Thank you
    https://www.vandyke.com/support/tips/echoflowctrl.html



  • 2.  RE: How to use script in Putty to send command line by line?
    Best Answer

    Posted 01-10-2017 09:54

    Hi eesunj,

     

     

    I don't know anything regarding this for Putty, but an alternative solution could be using "load set terminal" instead of just pasting commands in configuration mode. That way commands are only evaluated after finished the load via the ctrl+D. Example with only two commands but it can easily be 100 of set commands.

     

    jh@fw# load set terminal
    [Type ^D at a new line to end input]
    delete security
    delete interfaces
    <hit ctrl+d>
    load complete
    
    [edit]
    jh@fw#

    This way you avoid issues with flow control 🙂

     

    Hope this helps.



  • 3.  RE: How to use script in Putty to send command line by line?

    Posted 01-10-2017 10:22

    Great! Thank you



  • 4.  RE: How to use script in Putty to send command line by line?

    Posted 01-10-2017 10:47

    it improve a lot that way, but occassionally it does not work well. It means it still send some error commands. 



  • 5.  RE: How to use script in Putty to send command line by line?

     
    Posted 01-10-2017 10:54

    Try adding  crt.sleep <>

     

    I used to add 1000's of lines without any issues.



  • 6.  RE: How to use script in Putty to send command line by line?

    Posted 01-10-2017 17:33

    "Try adding  crt.sleep <> .."

    Can you explain it in detail? Thanks 



  • 7.  RE: How to use script in Putty to send command line by line?

     
    Posted 01-10-2017 19:40

    I was trying to say; please add sleep in the script used to push the config. Example,

     

    crt.sleep 3000000 <---- VBScript.
    sleep NUMBER[SUFFIX] <---- Bash Script Sleep

     

    Moreover this is a flow control issue. To overcome this if the config changes are much big; please change the script to ftp the config changes to the box and later merge it with

     

    [edit]
    user@host# load merge filename relative

    -------------------------------------------

    SAMPLE SCRIPT

     

    #$language = "VBScript"
    #$interface = "1.0"


    Sub main

    Dim i
    i = 1000000


    Do While i > 10

    crt.Screen.WaitForString ">"
    crt.Screen.Send "show arp no-resolve expiration-time " & chr(124) & " match " & chr(34) & " 10.67.5.33 " & chr(124) & " 10.67.5.34 " & chr(124) & " 10.74.13.144 " & chr(124) & " 10.74.13.145 " & chr(124) & " 10.74.13.147 " & chr(124) & " 10.84.6.34 " & chr(124) & " 10.84.37.20 " & chr(124) & " 10.84.128.20 " & chr(124) & " 10.84.136.36 " & chr(124) & " 10.166.36.4 " & chr(124) & " 10.166.36.12 " & chr(124) & " 10.166.36.20 " & chr(124) & " 10.166.36.28 " & chr(124) & " 10.166.36.36 " & chr(124) & " 10.166.36.44 " & chr(124) & " 10.166.36.52 " & chr(124) & " 10.166.36.60 " & chr(124) & " 10.166.36.68 " & chr(124) & " 10.166.36.76 " & chr(124) & " 10.166.36.84 " & chr(124) & " 10.166.36.92 " & chr(34) & " " & chr(124) & " no-more " & chr(13)

    crt.sleep 3000000

    i = i - 1



    Loop

    crt.Screen.WaitForString "#"
    crt.Screen.Send "commit" & VbCr

    MsgBox "Done" & VbCr

    End Sub



  • 8.  RE: How to use script in Putty to send command line by line?

    Posted 01-10-2017 23:48

    You can also refer to this KB article on how to run VBScript using secure CRT:

     

    https://kb.juniper.net/KB16365

     

    Thanks

    Sarathi



  • 9.  RE: How to use script in Putty to send command line by line?

     
    Posted 01-10-2017 10:31