Community discussions

MikroTik App
 
Vooray
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 73
Joined: Mon Feb 23, 2015 3:34 pm

IP on Bridge and RIB behaviour

Fri Mar 16, 2018 1:41 pm

Hey!

Im trying to figure out why RouterOS behave in such way:
I have a bridge:
/interface bridge port> /interface bridge print where name =LAN
Flags: X - disabled, R - running
 0 R ;;; LAN
     name="LAN"

And interfaces in it:
/interface bridge port print where bridge =LAN
Flags: X - disabled, I - inactive, D - dynamic, H - hw-offload
 #     INTERFACE                                    BRIDGE                                   HW  PVID PRIORITY  PATH-COST INTERNAL-PATH-COST    HORIZON
 0 I H ether2                                       LAN                                      yes    1     0x80         10                 10       none
 1 I H ether3                                       LAN                                      yes    1     0x80         10                 10       none
 2   H ether4                                       LAN                                      yes    1     0x80         10                 10       none
 3   H ether1                                       LAN                                      yes    1     0x80         10                 10       none

And interface ether2 is not connected (not active) and is slave

So, i assign ip address to it
/interface bridge port> /ip address print where interface =ether2
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         INTERFACE
 0   192.168.200.1/24   192.168.200.0   ether2
And ip address is valid! :?

Now i will disable interface:
/interface ethernet print where name =ether2
Flags: X - disabled, R - running, S - slave
 #    NAME                                                  MTU MAC-ADDRESS       ARP             SWITCH
 0 XS ether2                                               1500 6C:3B:6B:27:1C:EF enabled         switch1

And ip address is still working! And routing is working to this network! :shock:
/ip route print where dst-address =192.168.200.0/24
Flags: X - disabled, A - active, D - dynamic, C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
 #      DST-ADDRESS        PREF-SRC        GATEWAY            DISTANCE
 0 ADC  192.168.200.0/24   192.168.200.1   LAN                       0


Why RouterOS is not removing this ip address when assigned interface is disabled? What logic is behind this?
 
2frogs
Forum Veteran
Forum Veteran
Posts: 713
Joined: Fri Dec 03, 2010 1:38 am

Re: IP on Bridge and RIB behaviour

Fri Mar 16, 2018 3:10 pm

If you check your logs you will see an entry that states the ip has been moved to the bridge and to update your settings. When a port belongs to a bridge, the ip should be on that bridge and not the port.
 
Vooray
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 73
Joined: Mon Feb 23, 2015 3:34 pm

Re: IP on Bridge and RIB behaviour

Fri Mar 16, 2018 4:04 pm

Thanks for your answer!

Logs are clear (im on 6.41.3).
I definitely see how it works, i can not get _why_ it works that way? Why im even able to assign ip address to slave interface in bridge?
Little bit confusing, isn't it? May be there are special cases when i need to assign addresses this way? I wish to know.
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: IP on Bridge and RIB behaviour

Fri Mar 16, 2018 6:16 pm

Assigning IP address to bridge port is sort of wrong, that's true. On the other hand, bridge joins ports together, so it doesn't really matter that much where exactly the address is. In the end, it always ends up on bridge.

Previously it was even possible to add dhcp client to bridged port and use it as hack to receive two addresses. It no longer works with new RouterOS. And when you add interface with existing dhcp client as new bridge port, it temporarily moves dhcp client to bridge, to avoid loss of connectivity.

Addresses could probably do something similar. But there's no harm having them on slave port. And it gives you more options. E.g. if I'm connected to router via bridged port and I need to remove this port from bridge, now I can assign IP address to port before I remove it and won't lose connectivity when I do. Not that I do something like that very often, but it's nice to know that such option exists.
 
Vooray
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 73
Joined: Mon Feb 23, 2015 3:34 pm

Re: IP on Bridge and RIB behaviour

Fri Mar 16, 2018 7:27 pm

Thanks for your answer, Sob!

I have to think on it little bit more.

Who is online

Users browsing this forum: HeA9, jaisal, jason9456402, stef70, stratonetworks and 86 guests