Community discussions

MikroTik App
 
skermode
just joined
Topic Author
Posts: 11
Joined: Thu May 21, 2009 9:17 pm

Setting Interface to blank

Thu May 21, 2009 9:26 pm

I am currently attempting to set the in-interface (and out-interface) of a Firewall NAT rule to blank. In WinBox, all you have to do is set the combobox to the blank option to achieve this. My solution requires using the api/terminal so I don't have the luxury of WinBox.

For example's sake, to set a port to blank, you send the value "0," and the router stores "" as the port. In addition, to set an ip-address to blank, you would pass "0.0.0.0," and the router often stores that as blank. Any time unit stored as a blank is set by passing a "0."

What is the "blank" keyword for interfaces (or in-interface, out-interface)? I have tried:
0, -1, all, none, null, no, n

All results return the same "input does not match any value of interface" error. If I submit a blank value, I get an "ambiguous" error. All I want to do is intentionally set in-interface/out-interface to blank.

The only way to leave it blank is to never send a value. I want to use an automated process to create firewall rules and I don't want to have to fine tune eight functions (4 for add, 4 for edit) when I can use just one.

Thanks for the help in advance,
Scott
 
changeip
Forum Guru
Forum Guru
Posts: 3830
Joined: Fri May 28, 2004 5:22 pm

Re: Setting Interface to blank

Thu May 21, 2009 10:57 pm

unset ?
 
skermode
just joined
Topic Author
Posts: 11
Joined: Thu May 21, 2009 9:17 pm

Re: Setting Interface to blank

Thu May 21, 2009 11:04 pm

That's what I'm using for my workaround at this time. I have a function that adds/edits rules and does not modify the sensitive ones (like in-interface). If applying a value, set it, otherwise unset. Seems like the only solution at this point.

Good minds think alike, eh?
Thank you for your input on this.
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: Setting Interface to blank

Fri May 22, 2009 10:46 am

unset is not a workaround.

either you set your value, that you think is default, or unset variable.
 
skermode
just joined
Topic Author
Posts: 11
Joined: Thu May 21, 2009 9:17 pm

Re: Setting Interface to blank

Fri May 22, 2009 5:30 pm

Janisk, so you're saying:
There is not way to set the in-interface to blank, only to set it to an actual interface (ex. ether1), or just never set it at all. Should I want to clear it, I still cannot set it to blank, I can only unset. It's not a workaround, it's the only way.

Sorry, but your comment was short so I needed to clarify :D
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Setting Interface to blank

Sat May 23, 2009 9:09 pm

what is API syntax for 'unset'?
 
skermode
just joined
Topic Author
Posts: 11
Joined: Thu May 21, 2009 9:17 pm

Re: Setting Interface to blank

Tue May 26, 2009 4:28 pm

If the menu allows for unset, here is the api structure for it:
/.../unset=numbers=[api id numbers sep. by comma]=value-name=[field to unset]

for example
/ip/firewall/nat/unset=numbers=*1=value-name=dst-address
/ip/firewall/nat/unset=numbers=*1,*4=value-name=hotspot

Some menus will not allow it. For example, the /ip/address/ section does not contain a definition for unset.

Hope this helps.

(EDITED- Forgot to include "unset" command in my example)
Last edited by skermode on Tue Jun 02, 2009 4:32 pm, edited 1 time in total.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Setting Interface to blank

Wed May 27, 2009 12:02 am

wow! It's working, thanks =)
 
taduikis
Member
Member
Posts: 436
Joined: Sat Jul 07, 2007 12:09 pm

Re: Setting Interface to blank

Thu Dec 07, 2017 2:58 pm

Sorry for bringing up this topic, but I’m currently trying to do the same: set in-interface to none for many dstnat rules via console. set X in-interface=“” doesn’t work. Is there still no way unsetting it without using api style workarounds?
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Setting Interface to blank

Thu Dec 07, 2017 3:09 pm

/ip firewall nat unset 123 in-interface
where 123 is rule number from 'print' command
 
taduikis
Member
Member
Posts: 436
Joined: Sat Jul 07, 2007 12:09 pm

Re: Setting Interface to blank

Thu Dec 07, 2017 3:24 pm

I've accidentally found it on my own, but anyway thanks Chupaka. You're as always helpful :)
 
eezzaatt
just joined
Posts: 1
Joined: Sun Jun 28, 2020 11:57 am

Re: Setting Interface to blank

Sun Jun 28, 2020 12:02 pm

Just put ! before the element that you want to be blank

check out this example where here I want to put blank value to "check-gateway" so it will be like this "!check-gateway" :
/ip route set [find dst-address=1.1.1.1/32] [u]![/u]check-gateway 
Last edited by eezzaatt on Sun Jun 28, 2020 12:06 pm, edited 2 times in total.

Who is online

Users browsing this forum: jookraw, torchify, Valerio5000, zabloc and 81 guests