Community discussions

MikroTik App
 
upower3
Member
Member
Topic Author
Posts: 425
Joined: Thu May 07, 2015 11:46 am

Move IP between interfaces

Mon Jul 03, 2017 5:03 pm

If I connect to the Mikrotik and neeed to do something that'll break my connection like move IP between interfaces, which way should I do that?

Say, I have ether2-master port and the IP is set on it. The idea is to "move" IP from ether2-master to bridge1 (the ether2-master included into bridge1).

If I were able to connect to router via MAC then no problem at all but this time I need to work remotely and I in doubts about the steps.
 
User avatar
Cha0s
Forum Guru
Forum Guru
Posts: 1139
Joined: Tue Oct 11, 2005 4:53 pm

Re: Move IP between interfaces

Mon Jul 03, 2017 5:20 pm

If bridge1 interface has the same Admin MAC address as ether2-master then you should be able to move the IP to the bridge without even disconnecting from the router.

You can try hitting the 'Safe Mode' button on the top left corner of Winbox, before doing any configuration changes, so that if you do get disconnected after the change, then MikroTik will revert any changes made after you clicked on safe mode allowing you to login back to the router.

This way you can make sure that if the migration doesn't work you will still be able to reach the router.
 
User avatar
AlainCasault
Trainer
Trainer
Posts: 632
Joined: Fri Apr 30, 2010 3:25 pm
Location: Prévost, QC, Canada
Contact:

Re: Move IP between interfaces

Mon Jul 03, 2017 5:25 pm

Hello,

Ya, I feel for you. I've had this issue in the past. Problem until RoMon!!

I don't know about your setup, but I would suggest to activate RoMon on all routers (with password!). After that, go to your local router in tools -> RoMON. Click on the "Discover" tab (I think it's that, I'm not in front of a router right now). If you can see your remote router on which you want to make the changes, then you'll be OK. You'll have L2 connectivity through RoMon.

HINT: Test RoMon before doing anything. It's VERY simple to configure and equaly simple to use when you know how. Once all configs are done, you open Winbox, select a router, type the password and click on the "Connect through Romon" button. You'll see a list of all routers accessible through RoMon. It doesn't work through certain tunnels if I recall. ALL ROUTERS between point A and point B must have RoMon turned on for it to work.

URL: https://wiki.mikrotik.com/wiki/Manual:RoMON

P.S. If in doubt, activate the "SAFE" button!!!

Cheers,
 
User avatar
Cha0s
Forum Guru
Forum Guru
Posts: 1139
Joined: Tue Oct 11, 2005 4:53 pm

Re: Move IP between interfaces

Mon Jul 03, 2017 5:30 pm

If for whatever reason the router loses connectivity to the outside world how will RoMon help?

If he has multiple MikroTik routers on the same lan then yes, you could use RoMon to connect via another router to the router in question.

But if this is the only router in that lan, RoMon won't help from what I understand.
Winbox connects to RoMon using TCP/IP and then the connected RoMon device will connect using L2 to other Mikrotik (and RoMon enabled) devices.
So if the router loses connection to the outside world, Winbox wont be able to connect to it regardless if it's RoMon or standard Winbox.

Unless I am missing something, so please correct me if I am wrong.
 
User avatar
w177f
newbie
Posts: 27
Joined: Fri Jun 30, 2017 2:21 pm
Location: Dublin, Ire
Contact:

Re: Move IP between interfaces

Mon Jul 03, 2017 5:40 pm

If you're working remotely, are you not connected in from the wan on a different interface? Or are you remote'd into a machine and then accessing the Mikrotik on the LAN?
If you're coming in on the Wan, you shouldn't loose connection with change such as you described.

Alternatively, you could write a script to disable the new address and enable the old one at a certain time, like a scheduled roll-back.
 
User avatar
AlainCasault
Trainer
Trainer
Posts: 632
Joined: Fri Apr 30, 2010 3:25 pm
Location: Prévost, QC, Canada
Contact:

Re: Move IP between interfaces

Mon Jul 03, 2017 6:38 pm

@Cha0s
This is why I said he should test first. But why would he loose connectivity to the world more than with your solution? There's no reboot involved anywhere.
As I've mentionned, I don't know about his setup, is he comming in from a PPP connection? From the WAN port? Is it all on his LAN? I'm only giving suggestions. It's up to him to decide what works best for him. And if all Hell breaks loose, then SAFE MODE was there for him.

I'm so tired and disapointed (being polite here) every time I see someone putting down honest suggestions/answers. Based on the info that was supplied, it's hard to give an exact and perfect solution, so if you think that you answer is the best, good for you. But try to respect other peoples' suggestions otherwise we'll stop answering and this forum will become devoid of value real fast.

Look at w177f's answer: He's got the right approach. Getting more info and forcing the person to question himself and see other alternatives.

Anyway, upower3, you have a bunch of ideas. Have fun!
 
upower3
Member
Member
Topic Author
Posts: 425
Joined: Thu May 07, 2015 11:46 am

Re: Move IP between interfaces

Mon Jul 03, 2017 6:49 pm

Anyway, upower3, you have a bunch of ideas. Have fun!
Alright, guys, I'll have some fun close to night, so it won't affect clients.

I do connects via LAn interface, not WAN, this is sad and old story but I had to start, just to begin.

What I will try is to use scripting. Can't I run two commands at once from telnet, like in linux:
./command1 && ./command2
?
As well, if I put two commands in a script, and run script from telnet, will it run to the end even if the CLI disconnects?
 
User avatar
AlainCasault
Trainer
Trainer
Posts: 632
Joined: Fri Apr 30, 2010 3:25 pm
Location: Prévost, QC, Canada
Contact:

Re: Move IP between interfaces

Mon Jul 03, 2017 8:12 pm

As well, if I put two commands in a script, and run script from telnet, will it run to the end even if the CLI disconnects?
If you go script, you can create an .rsc file and import it through the scheduler. Try it on a lab router 1st for correct syntax and expected results though ;)

To be perfectly honest, if your entry point is totaly unrelated to bridge1 and ether2-master and NOT in their path, I don't see why you should get kicked out. And if you've set SAFE MODE, then you are covered. Don't forget to remove it after :)
As you try whatever you'll try tonight, run a "ping -t" to see what's happening. When the ping comes back, it'll put your mind at rest.

BTW, a piece of advice that many people give on this forum is to use GNS3 with the CHR images. If you should break something, better in a virtual LAN than the real one. AND you'll know what to expect. I honestly couldn't live without it anymore.

Regards,
 
User avatar
w177f
newbie
Posts: 27
Joined: Fri Jun 30, 2017 2:21 pm
Location: Dublin, Ire
Contact:

Re: Move IP between interfaces

Mon Jul 03, 2017 9:51 pm

So..

I don't think you'll get a disconnect moving the IP from the Eth to the bridge.

Just tested myself, and I had no connectivity loss moving my gateway from a bridge, to Eth2 and back again. In the scenario, Eth2 was a master port, and the only port on the bridge.

Do it all in safe mode, and sure if you loose connectivity it'll undo all the changes you made while in Safe mode.
 
upower3
Member
Member
Topic Author
Posts: 425
Joined: Thu May 07, 2015 11:46 am

Re: Move IP between interfaces

Mon Jul 03, 2017 9:58 pm

Just tested myself
Thank you very much, this is something I'm about to do but I planned to run script to apply these steps. That is, I planned to 1) remove IP from ether2 and then 2) assign the same IP on bridge - 2 steps, and "in the middle" the IP is "nowhere".

And you did the reverse, right? You've assign the same IP to bridge and after that remove it from ether2? So "in the middle" you have the same IP assigned twice on different interfaces and it worked?

Will test it in a while!
 
User avatar
w177f
newbie
Posts: 27
Joined: Fri Jun 30, 2017 2:21 pm
Location: Dublin, Ire
Contact:

Re: Move IP between interfaces

Mon Jul 03, 2017 10:52 pm

Opened Winbox, connected to my RB2011 @ home via IP / LAN Gateway.
Clicked "Safe Mode" to activate it.
Navigated to IP > Addresses
Double Clicked on the address in question / LAN Gateway - same address I connected to the router on.
Changed Interface from "bridge-local" to "ether2" & clicked apply. All good.
Changed it back from "ether2" to "bridge-local". All good.

In the scenario, "ether2" was the only interface on "bridge-local"
Different hw could yield a different result.
 
pe1chl
Forum Guru
Forum Guru
Posts: 10195
Joined: Mon Jun 08, 2015 12:09 pm

Re: Move IP between interfaces

Mon Jul 03, 2017 10:53 pm

There is no need at all to unassign it, you can change the interface on the existing address and it will just move.
 
User avatar
w177f
newbie
Posts: 27
Joined: Fri Jun 30, 2017 2:21 pm
Location: Dublin, Ire
Contact:

Re: Move IP between interfaces

Mon Jul 03, 2017 10:56 pm

Also, if the scenario allows, you could add a second IP to the router, connect to it on the second address, then make the change to your main gate.
 
pe1chl
Forum Guru
Forum Guru
Posts: 10195
Joined: Mon Jun 08, 2015 12:09 pm

Re: Move IP between interfaces

Mon Jul 03, 2017 11:17 pm

All I know is that I have (remotely) moved addresses from ethernet to bridge and the other way several times, and it always worked.
E.g. via webfig just click on the address, change the interface, and save it.
Same should be possible using the commandline or winbox.

Using safe mode is safe indeed, but sometimes too safe. E.g. when you change something working over a VPN and it will cause
the VPN to toggle down/up, the safe mode will always see a failure and revert the change.
I would like to see a safe mode that does not revert immediately on disconnect, but only after some time delay.
(when you don't re-connect within x minutes it will revert)

More or less like using "reload in 5" on a Cisco.
 
User avatar
w177f
newbie
Posts: 27
Joined: Fri Jun 30, 2017 2:21 pm
Location: Dublin, Ire
Contact:

Re: Move IP between interfaces

Tue Jul 04, 2017 11:24 am

Just tested myself
Will test it in a while!
How did you get on?
 
upower3
Member
Member
Topic Author
Posts: 425
Joined: Thu May 07, 2015 11:46 am

Re: Move IP between interfaces

Wed Jul 05, 2017 1:01 am

How did you get on?
You'll be surprised but the trick was easy:
the address is assigned to the interface, but at the same time interface is linked to the address. So you can just edit the ip address record changing interface and not the add/remove ip!
Imagine:
> /ip address export 
/ip address
add address=192.168.88.1/24 comment=LAN interface=ether2-master network=192.168.88.0
and this record is #0 in the address table (can see this from following output):
> /ip address print 
Flags: X - disabled, I - invalid, D - dynamic 
 #   ADDRESS            NETWORK         INTERFACE                                                                                             
 0   192.168.88.1/24    192.168.88.0     ether2-master
and the ether2-master is in bridge1, so to fix I just issue:
> /ip address set 0 interface=bridge1
...and that's it!

I just changed the interface in the given record in address list, which effectively moved the IP in one atomic operation.

Isn't this a nice idea? :) Mikrotik keeps surprising me!
 
pe1chl
Forum Guru
Forum Guru
Posts: 10195
Joined: Mon Jun 08, 2015 12:09 pm

Re: Move IP between interfaces

Wed Jul 05, 2017 1:24 am

That's what I said! Just change the interface and it will move.

Who is online

Users browsing this forum: biomesh, GuJack20, korg, mogiretony and 84 guests