How can you Remove an IP or IPs in MikroTik VPS by CLI(Command Line Interface)?

How can you Remove an IP or IPs in MikroTik VPS by CLI(Command Line Interface)?

In Mikrotik

We can use the ‘remove’ command to remove a certain configuration. But, we need ‘Item Number’ to use the ‘remove’ command. To get ‘Item Number,’ we have to use another command, ‘print.’

Or else, we can use the ‘find’ command. This will not be ‘OK’ for newbies.

In Cisco,

Just use ‘no’ to remove the configuration.

Example,

In Cisco,

interface FastEthernet 0/0

IP address 192.168.1.1 255.255.255.0

we want to remove IP address, and then no IP address 192.168.1.1 255.255.255.0

In Mikrotik,

/ip address

add address=192.168.1.1/24 interface=ether1

we want to remove IP address, then,

/ip address

print

# ADDRESS NETWORK INTERFACE

0 192.168.1.1/24 192.168.1.0 ether1

/ip address

remove 0

so, why can’t we use remove Like,

/ip address

remove address=192.168.1.1/24 interface=ether1

If yes,

It will be a lot easy to remove configuration scripting.

Cisco works differently from MikroTik.

These routers are both not for newbies. There are enough routers on the market that are much easier to configure than Cisco or MikroTik.I don’t think either of these manufacturers focuses on the newbies market.

One thing that could be interesting was to remove the rule with the opposite command of its creation.

Example:

add chain=AP_intra comment=”AP USA DNS Intranet” DST-port=53 protocol=udp -> This one create this rule

removechain=AP_intra comment=”AP USA DNS Intranet” DST-port=53 protocol=udp -> This one would remove the rule. The number system is good and should be kept. But this could simplify some scripts and whatnot.

How to edit and delete added IP address

So let’s learn about this issue’s main problems of the user Encounter.

nowadays, we are using

C# as my way of communicating to the rourterOS, we use the Api example there at the wiki api documentation and it works, our Issue is how to edit and remove the added IP Address, this is how we add new IP

router.Send(“/ip/address/add”);

router.Send(“=address=192.168.1.1/24”);

router.Send(“=network=10.10.10.0”);

router.Send(“=broadcast=10.10.10.255”);

router.Send(“=interface=ether1”);

router.Send(“=disabled=no”);

router.Send(“.tag=aaa”, true);

we attempted this statement for removing IP but an error happened

router.Send(“/ip/address/remove”);

router.Send(“=address=192.168.1.1/24”);

and for updating something like this

router.Send(“/ip/address/set”);

router.Send(“=address=192.168.1.1/24”);

by the way we are using the latest version of the routerOS

and for Solving The Problem you should

router.Send(“/ip/address/print”);

after that it will give you the IP address and the value number on the left most side, usually it is “0”

you can try this

router.Send(“/ip/address/remove/0”);

As you see, we have solved some of the users’ problems, so at the end of the Article, we Put a Video for Understanding better to Remove an IP or IPs in MikroTik VPS by CLI(Command Line Interface).