Community discussions

MikroTik App
 
eugenejazz
just joined
Topic Author
Posts: 6
Joined: Wed Apr 11, 2012 10:37 am

Disable port over snmp

Wed Apr 11, 2012 11:06 am

Is it possible to disable interface over snmp?

# snmpset -v2c -c 192.168.88.1 1.3.6.1.2.1.2.2.1.7.1 i 2
IF-MIB::ifAdminStatus.1 = INTEGER: down(2)

but interface anyway in running state:
[admin@TEST] > int pr
Flags: D - dynamic, X - disabled, R - running, S - slave
# NAME
0 ether1-gateway

snmp settings:
/snmp set enabled=yes
/snmp community add name=test read-access=yes security=none write-access=yes

version: 5.14
board-name: RB750
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: Disable port over snmp

Wed Apr 11, 2012 11:52 am

snmp-write in routeros is very limited and it is not possible to disable port in this way. If you require some automation, you can create script, or if you are using some server to monitor routers using SNMP you can use API, to do configuration changes.
 
eugenejazz
just joined
Topic Author
Posts: 6
Joined: Wed Apr 11, 2012 10:37 am

Re: Disable port over snmp

Wed Apr 11, 2012 12:14 pm

[quote="janisk"]snmp-write in routeros is very limited and it is not possible to disable port in this way. If you require some automation, you can create script, or if you are using some server to monitor routers using SNMP you can use API, to do configuration changes.[/quote]

Thank you.
Do you plan to add full snmp-write access in future releases?
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26322
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: Disable port over snmp

Wed Apr 11, 2012 12:22 pm

SNMP write can run scripts. If your tasks are known and repeat often, this makes it possible to run almost any configuration:
http://wiki.mikrotik.com/wiki/SNMP#SNMP_write
 
eugenejazz
just joined
Topic Author
Posts: 6
Joined: Wed Apr 11, 2012 10:37 am

Re: Disable port over snmp

Wed Apr 11, 2012 12:58 pm

SNMP write can run scripts. If your tasks are known and repeat often, this makes it possible to run almost any configuration:
http://wiki.mikrotik.com/wiki/SNMP#SNMP_write
Ok, thank you for help. I think I will choose the API for my task.
 
ropebih
Member Candidate
Member Candidate
Posts: 113
Joined: Tue May 22, 2007 5:35 pm

Re: Disable port over snmp

Sun Jun 21, 2020 4:06 pm

Can you please let me know when will you implement the option of port disabling via SNMP?
MikroTik switches cannot be used in data centers that rent dedicated servers only because of the impossibility of disabling the port via SNMP, because this is the main function when suspending the server via DCIm software. So far, I have refused to implement Mikrotik CRS in dozens of data centers just because of the lack of this very important function (more then 4k switches). So, MikroTik loses millions of dollars because CRS has no basic SNMP function implemented.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3291
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Disable port over snmp

Mon Jun 22, 2020 12:20 am

Here is how to do it on a Cisco device:

Interface UP:
snmpset -v1 -c community hostname IF-MIB::ifAdminStatus.interface i 1
Interface DOWN:
snmpset -v1 -c community hostname IF-MIB::ifAdminStatus.interface i 2
 
ropebih
Member Candidate
Member Candidate
Posts: 113
Joined: Tue May 22, 2007 5:35 pm

Re: Disable port over snmp

Mon Nov 23, 2020 11:27 am

Here is how to do it on a Cisco device:

Interface UP:
snmpset -v1 -c community hostname IF-MIB::ifAdminStatus.interface i 1
Interface DOWN:
snmpset -v1 -c community hostname IF-MIB::ifAdminStatus.interface i 2
Yes, this is for Cisco, but MikroTik don't have that simple option. There is no possibility to disable port via SNMP. I believe MikroTik is the only vendor who does not that option and they are not aware that they are loosing millions $ because of that...
 
Praktimarc
just joined
Posts: 1
Joined: Wed Jun 15, 2011 12:24 pm

Re: Disable port over snmp

Tue Apr 20, 2021 3:33 pm

Is it still impossible via snmp?

I need to reset cusomers ports ... as I implemendet my software product some years ago, I had to switch to the api to do that but that solution is not elegant. I really would prefer to reset a port via snmp....
 
bentogoa
just joined
Posts: 8
Joined: Sat Apr 28, 2018 6:48 pm

Re: Disable port over snmp

Mon Jul 04, 2022 9:55 am

This works 1.3.6.1.2.1.2.2.1.7.{PORT Number} INTERGER (i) 1 for enable, 2 for disable

Tested on CRS305
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3291
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Disable port over snmp

Mon Jul 04, 2022 11:08 am

Working on hAP ac^2 :)

You need to specify i for integer. And 1 is up and 2 is down.
snmpwalk -v2c -c public 192.168.1.14 1.3.6.1.2.1.2.2.1.7
IF-MIB::ifAdminStatus.1 = INTEGER: up(1)
IF-MIB::ifAdminStatus.2 = INTEGER: up(1)
IF-MIB::ifAdminStatus.3 = INTEGER: up(1)
IF-MIB::ifAdminStatus.4 = INTEGER: up(1)
IF-MIB::ifAdminStatus.5 = INTEGER: up(1)
IF-MIB::ifAdminStatus.6 = INTEGER: up(1)
IF-MIB::ifAdminStatus.7 = INTEGER: up(1)
IF-MIB::ifAdminStatus.8 = INTEGER: up(1)

snmpset -v2c -c private 192.168.1.14 1.3.6.1.2.1.2.2.1.7.6 i 2
IF-MIB::ifAdminStatus.6 = INTEGER: down(2)

snmpwalk -v2c -c public 10.10.10.14 1.3.6.1.2.1.2.2.1.7
IF-MIB::ifAdminStatus.1 = INTEGER: up(1)
IF-MIB::ifAdminStatus.2 = INTEGER: up(1)
IF-MIB::ifAdminStatus.3 = INTEGER: up(1)
IF-MIB::ifAdminStatus.4 = INTEGER: up(1)
IF-MIB::ifAdminStatus.5 = INTEGER: up(1)
IF-MIB::ifAdminStatus.6 = INTEGER: down(2)
IF-MIB::ifAdminStatus.7 = INTEGER: up(1)
IF-MIB::ifAdminStatus.8 = INTEGER: up(1)
Take care 1: Adding a virtual interface or other interface change, may change the interface numbering.
So to us this in a script, use snmpwalk to find interface number for the interface you like to set, then set it based on that.

Take care 2: These action are not logged in command log history, not in system change. So MT please add this, and for all, only enable SNMP write from specific IP
Last edited by Jotne on Mon Jul 04, 2022 12:20 pm, edited 1 time in total.

Who is online

Users browsing this forum: Ahrefs [Bot], rogerioqueiroz and 112 guests