Community discussions

MikroTik App
 
mazinsaeed
newbie
Topic Author
Posts: 39
Joined: Wed Oct 16, 2013 4:55 pm

Script for down & up interfaces

Wed Jan 26, 2022 7:47 am

Hi , I want to do a script if interface sfp-sfpplus1 down , enable ether10 and vice versa

My main interface is sfp-sfpplus1 and the backup interface is ether10 , the ( sfp-sfpplus1 coming from fiber optic and ether10 is a backup line from same service provider )

ether10 is disabled and the service is up from sfp-sfpplus1

So I want to do a script if interface sfp-sfpplus1 down , enable ether10 & if sfp-sfpplus1 is up back disable ether10

sfp-sfpplus1 & ether10 are in same bridge1

Best Regards
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3292
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Script for down & up interfaces

Wed Jan 26, 2022 8:25 am

Here you go:

Disable sfp-sfpplus1, enable ether10
{
/interface/ethernet/disable [find where name=sfp-sfpplus1]
/interface/ethernet/enable [find where name=ether10]
}
Disable ether10, enable sfp-sfpplus1
{
/interface/ethernet/disable [find where name=ether10]
/interface/ethernet/enable [find where name=sfp-sfpplus1]
}
Last edited by Jotne on Thu Jan 27, 2022 8:19 am, edited 1 time in total.
 
mazinsaeed
newbie
Topic Author
Posts: 39
Joined: Wed Oct 16, 2013 4:55 pm

Re: Script for down & up interfaces

Thu Jan 27, 2022 7:26 am

Here you go:

Disable sfp-sfpplus1, enable ether10
{
/interface/ethernet/disable [find where name=sfp-sfpplus1]
/interface/ethernet/enable [find where name=ether10]
}
Disable ether10, enable sfp-sfpplus1
{
/interface/ethernet/disable [find where name=sfp-sfpplus1]
/interface/ethernet/enable [find where name=ether10]
}

Hi , both of them have same code ???
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3292
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Script for down & up interfaces

Thu Jan 27, 2022 8:20 am

Fixed in above post.
 
mazinsaeed
newbie
Topic Author
Posts: 39
Joined: Wed Oct 16, 2013 4:55 pm

Re: Script for down & up interfaces

Thu Jan 27, 2022 10:06 am

Fixed in above post.
is it working like Sisco switch as Add Ethernet Flex I/O ?

when spf interface down , enabling ether10 and vice versa ??
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3292
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Script for down & up interfaces

Thu Jan 27, 2022 12:43 pm

Not sure what you mean.
What I posted was a manual change.

Do you like a script that automatically change port? Try Netwatch

Who is online

Users browsing this forum: No registered users and 16 guests