Junos Automation (Scripting)
Highlighted
Junos Automation (Scripting)

MX80 Disable/Enable Interface at Specific Times

‎05-19-2015 05:52 AM

Does anyone have an example of a way to automate disable/enable of a specific interface on an MX80 at certain times of the day? Maybe some variation of toggle-interface.slax?

 

We would like to use this to curtail IP transit costs from a particular provider by shutting down the interface say between 1am and 6am to force traffic to a cheaper transit provider during that timeframe to reduce 95th percentile billing.

2 REPLIES 2
Highlighted
Junos Automation (Scripting)

Re: MX80 Disable/Enable Interface at Specific Times

‎05-20-2015 12:19 AM

running a script from a cron on a management server that disable and enable the interfaces at the specific times.

you could also build a script that is doing a prepend on that transit and running from a cron from time to time.

 

Their are some scripts in the world that can help you with this

 

https://gist.github.com/jeremyschulman/6728381

Marc



-----------------------------------------------------------------
Please Mark My Solution Accepted if it Helped, Kudos are Appreciated Too
-----------------------------------------------------------------
Highlighted
Junos Automation (Scripting)

Re: MX80 Disable/Enable Interface at Specific Times

‎05-23-2015 03:00 PM

It should also be possible to use an event policy with a configuration change too.

 

The following links should assist in the approach to take if you're running 12.1 or higher

 

http://www.juniper.net/documentation/en_US/junos14.2/topics/topic-map/junos-script-automation-event-...

 

http://www.juniper.net/techpubs/en_US/junos14.2/topics/reference/configuration-statement/change-conf...

 

Coupled with the time-of-day feature to generate an event.

 

http://www.juniper.net/documentation/en_US/junos14.2/topics/reference/configuration-statement/time-o...

 

Of course a script approach could still be taken, but for something like scheduling an interface to be down (or up) at specific periods during the day, this looks like an easier approach.

 

Shout if you need any further help on this.

Regards,

Andy

Feedback