Community discussions

MikroTik App
 
Rudios
Forum Veteran
Forum Veteran
Topic Author
Posts: 973
Joined: Mon Mar 11, 2013 12:58 pm
Location: The Netherlands

Firewall connections overview

Thu Sep 29, 2016 3:10 pm

I bounced into something very strange.

Imagine the following scenario

1 Routerboard with ADSL modem behind it.
Doing NAT towards the modem and internally connected to a second routerboard.
3 additional routerboards are connected, each handling a dedicated network segment (192.168.11.0/24, 192.168.12.0/24 and 192.168.13.0/24) on the 'inside'.
The connections between the various routerboards is done by /29 IP segments and OSPF is in place.
On the subnets of the 3 routerboards a variety of Ubiquiti devices is connected. For management purposes, a CRM Point is connected to the second router (dedicated port and IP segment, address 192.168.110.253)

Now the strange thing I noticed.

When looking on the first routerboard, the one doing NAT, I came across various entries looking at the firewall -> connections tab related to an internal Ubiquiti device eg. 192.168.11.5 and the CMR point (192.168.110.253)
How come that the external router is even aware of this traffic?
 
Rudios
Forum Veteran
Forum Veteran
Topic Author
Posts: 973
Joined: Mon Mar 11, 2013 12:58 pm
Location: The Netherlands

Re: Firewall connections overview

Fri Sep 30, 2016 8:15 am

I tried to add a small drawing of the situation multiple times, but for some reason it keeps failing.
Hereby a link to the drawing.
https://www.dropbox.com/s/7ja71gc105q8q ... p.jpg?dl=0
 
magchiel
Member Candidate
Member Candidate
Posts: 131
Joined: Mon Jan 06, 2014 2:13 pm

Re: Firewall connections overview

Fri Sep 30, 2016 9:18 am

I came across various entries looking at the firewall -> connections tab related to an internal Ubiquiti device eg. 192.168.11.5 and the CMR point (192.168.110.253). How come that the external router is even aware of this traffic?
Is this LAN or WAN bound traffic?
If it's WAN bound it's only logical as the NATting only takes place at that Router.
If it's LAN bound I find it strange indeed (you'd think this routing would happen at the MT2) and would have a look at the routing tables / OSPF config.
 
Rudios
Forum Veteran
Forum Veteran
Topic Author
Posts: 973
Joined: Mon Mar 11, 2013 12:58 pm
Location: The Netherlands

Re: Firewall connections overview

Fri Sep 30, 2016 10:26 am

It indeed is normal, internal traffic and I have made the same assumption you did.
When doing a trace route from any given MT (3,4 or 5) towards the CMR Point the result shows a direct connection with only the IP address of MT2 router at connection point of chosen MT3,4 or 5.
 
magchiel
Member Candidate
Member Candidate
Posts: 131
Joined: Mon Jan 06, 2014 2:13 pm

Re: Firewall connections overview

Sat Oct 01, 2016 8:57 am

Does torch also show the traffic that you see in the connection table? Could you post some examples?
 
Rudios
Forum Veteran
Forum Veteran
Topic Author
Posts: 973
Joined: Mon Mar 11, 2013 12:58 pm
Location: The Netherlands

Re: Firewall connections overview

Mon Oct 03, 2016 8:42 am

Doing a torch on the incoming port of the central MT1 is not showing any traffic from the management device 192.168.110.253
 
magchiel
Member Candidate
Member Candidate
Posts: 131
Joined: Mon Jan 06, 2014 2:13 pm

Re: Firewall connections overview

Mon Oct 03, 2016 9:45 am

Doing a torch on the incoming port of the central MT1 is not showing any traffic from the management device 192.168.110.253
Just to check if I fully understand: while still listing connections from/to 192.168.110.253 to/from 192.168.x.x?
 
Rudios
Forum Veteran
Forum Veteran
Topic Author
Posts: 973
Joined: Mon Mar 11, 2013 12:58 pm
Location: The Netherlands

Re: Firewall connections overview

Mon Oct 03, 2016 10:59 am

I have to come back to my previous statement.
I have looked at the torch a little while longer I have seen a short period where there were indeed entries with connections between 192.168.110.253 and 172.18.x.x
Althought I only have seen it twice.

See my attachments below
Firewall connections overview.png
Torch overview.png
You do not have the required permissions to view the files attached to this post.
 
magchiel
Member Candidate
Member Candidate
Posts: 131
Joined: Mon Jan 06, 2014 2:13 pm

Re: Firewall connections overview

Mon Oct 03, 2016 12:53 pm

To me this looks like the CMR software is trying to discover controllable access points hosts by scanning for open SSH ports at least in the 172.18.3.0/24 and 172.18.16.0/24 subnets, but because of the (default) routing configuration is then inadvertently internet-routed when this traffic reaches MT2. The 172.18.0.0/16 (?) subnet would then be a management subnet under which the accesspoints communicate the with CMR? Or is it maybe a subnet used between MT1 and ISP modem? Or is it otherwise familiar in your subnet configuration?

EDIT: to add, the connections showing up in Torch could be connections to update or time servers. Check through port numbers.
 
Rudios
Forum Veteran
Forum Veteran
Topic Author
Posts: 973
Joined: Mon Mar 11, 2013 12:58 pm
Location: The Netherlands

Re: Firewall connections overview

Mon Oct 03, 2016 3:49 pm

The IP Addresses shown by the firewall connections are indeed Ubiquiti devices that are managed by the CRM point.
However, these devices are all situated behind either MT3, MT4 or MT5.
So I would assume that this traffic flows via MT2 (Central router) towards MT3,4 or 5, and not towards the border router MT1.

PS. The connections on the torch are actually me and somebody else accessing the CRM Point over internet.
 
magchiel
Member Candidate
Member Candidate
Posts: 131
Joined: Mon Jan 06, 2014 2:13 pm

Re: Firewall connections overview

Tue Oct 04, 2016 3:11 am

The IP Addresses shown by the firewall connections are indeed Ubiquiti devices that are managed by the CRM point.
However, these devices are all situated behind either MT3, MT4 or MT5.
So I would assume that this traffic flows via MT2 (Central router) towards MT3,4 or 5, and not towards the border router MT1.
Yet somehow they're getting marked as ISP connections in your mangle rules...

At this point I think it would be helpful to start sharing your routing tables as I feel we might get an answer there. Also, confirm gateway of CRM is actually referencing MT2 to begin with.
 
Rudios
Forum Veteran
Forum Veteran
Topic Author
Posts: 973
Joined: Mon Mar 11, 2013 12:58 pm
Location: The Netherlands

Re: Firewall connections overview

Tue Oct 04, 2016 8:08 am

The IP Addresses shown by the firewall connections are indeed Ubiquiti devices that are managed by the CRM point.
However, these devices are all situated behind either MT3, MT4 or MT5.
So I would assume that this traffic flows via MT2 (Central router) towards MT3,4 or 5, and not towards the border router MT1.
Yet somehow they're getting marked as ISP connections in your mangle rules...

At this point I think it would be helpful to start sharing your routing tables as I feel we might get an answer there. Also, confirm gateway of CRM is actually referencing MT2 to begin with.
The CRM Point is getting it's IP (and related info) from the MT2 router by DHCP. I checked and it is using the interface of MT2 as it's gateway (192.168.110.1 for that matter)
Below is the route table of the main Router MT2 (where the CMR point is connected to)
RouteList MT2.png
Below is the route table of one of the attached MT's (MT3, the one handling the 172.18.2.0/23 range, so including the entries shown earlier 172.18.3.x)
RouteList MT3.png
You do not have the required permissions to view the files attached to this post.
 
magchiel
Member Candidate
Member Candidate
Posts: 131
Joined: Mon Jan 06, 2014 2:13 pm

Re: Firewall connections overview

Fri Oct 07, 2016 9:35 pm

Apologies for the late reply; it has been a busy week.

Just to make sure I have established the correct picture of your situation (as it's not your everyday SOHO setup you have running there):
  • Traffic originating from 192.168.110.253 destined for 172.18.3.4 is coming in on MT2:eth10|192.168.110.1/24.
  • One would expect traffic destined to 172.18.3.x to leave MT2:eth2|192.168.2.9/29 to MT3:eth5|192.168.2.14/29 as per routing table entry for subnet 172.18.2.0/23.
  • Instead it shows up in MT1 firewall thus leaving MT2:eth1|192.168.2.6/29 towards MT1:eth?|192.168.2.1/29
  • According to routing table of MT2, MT1 however would normally only route subnets 192.168.[11-14].0/24 as well as the default route 0.0.0.0/0
  • In MT1, this traffic this then being marked as internet bound traffic given the ISP1_conn, ISP2_conn and ISP3_conn marks?
  • Nevertheless, traffic eventually arrives through MT3 allowing control of the access points.
Indeed, not immediately obvious where things are going wrong.
Some questions:
  • Is it just traffic from the CMR and/or to this subnet where you're seeing this behaviour or is it more wide-spread?
  • Is there any filtering going on at MT2 that would prevent a direct route to MT3 without looping through MT1?
  • I see some VLAN and bridge configurations. No strange loops introduced here?
  • Wild guess: Ubiquiti discovery is taking place through L2 UDP broadcast 255.255.255.255:10001 / multicast 233.89.188.1:10001. Could it be that things are going "wrong" here, i.e. untagged multicast traffic traveling through MT1 as rendezvouz point?
 
Rudios
Forum Veteran
Forum Veteran
Topic Author
Posts: 973
Joined: Mon Mar 11, 2013 12:58 pm
Location: The Netherlands

Re: Firewall connections overview

Mon Oct 10, 2016 8:19 am

Apologies for the late reply; it has been a busy week.
No worries for late replies.
Just to make sure I have established the correct picture of your situation (as it's not your everyday SOHO setup you have running there):
  • Traffic originating from 192.168.110.253 destined for 172.18.3.4 is coming in on MT2:eth10|192.168.110.1/24.
  • One would expect traffic destined to 172.18.3.x to leave MT2:eth2|192.168.2.9/29 to MT3:eth5|192.168.2.14/29 as per routing table entry for subnet 172.18.2.0/23.
  • Instead it shows up in MT1 firewall thus leaving MT2:eth1|192.168.2.6/29 towards MT1:eth?|192.168.2.1/29
  • According to routing table of MT2, MT1 however would normally only route subnets 192.168.[11-14].0/24 as well as the default route 0.0.0.0/0
  • In MT1, this traffic this then being marked as internet bound traffic given the ISP1_conn, ISP2_conn and ISP3_conn marks?
  • Nevertheless, traffic eventually arrives through MT3 allowing control of the access points.
Indeed, not immediately obvious where things are going wrong.
Your assumptions are all right. The path off communication is indeed as you described.
Some questions:
  • Is it just traffic from the CMR and/or to this subnet where you're seeing this behaviour or is it more wide-spread?
  • Is there any filtering going on at MT2 that would prevent a direct route to MT3 without looping through MT1?
  • I see some VLAN and bridge configurations. No strange loops introduced here?
  • Wild guess: Ubiquiti discovery is taking place through L2 UDP broadcast 255.255.255.255:10001 / multicast 233.89.188.1:10001. Could it be that things are going "wrong" here, i.e. untagged multicast traffic traveling through MT1 as rendezvouz point?
I have seen this for actuall all my Ubiquiti devices managed by the CRM Point.
During the writing of the post I did check again and found NOTHING of this behaviour anymore!!!
Now here is my thought.
Last week I found out that, specifically when I would do a scan for multiple 192.168.x.0/24 or 172.18.x.0/23 segments from the UCRM, a lot of traffic is generated towards IP segments I do not use. For lowering the load on the CPU and block useless traffic I added unreachable routes to my routing table (I started with blackholes but found out later that unreachables were better in terms of trouble shooting).
My unreachable rules look like
add dst-address=10.0.0.0/8 type=unreachable
add dst-address=172.16.0.0/12 type=unreachable
add dst-address=192.168.0.0/16 type=unreachable
The routing tables on my routers are distilled from this, the OSPF information and directly connected networks.
Could it be that sometimes the OSPF routes get ditched for a short amount of time, and that this caused the traffic to end up at MT1?
Because before I added the unreachables, when an OSPF neighbor goes down, the 0.0.0.0/0 towards MT1 would have taken over the route for the 172.18.2.0/23 network and traffic towards the 172.18.3.x clients would endup on MT1.
Now since I have the unreachables, when an OSPF goes down, the network goes to unreachable., right?
 
magchiel
Member Candidate
Member Candidate
Posts: 131
Joined: Mon Jan 06, 2014 2:13 pm

Re: Firewall connections overview

Sat Oct 15, 2016 11:27 am

During the writing of the post I did check again and found NOTHING of this behaviour anymore!!!
OK, that's good as a result, less so as still being unexplained.
For lowering the load on the CPU and block useless traffic I added unreachable routes to my routing table (I started with blackholes but found out later that unreachables were better in terms of trouble shooting).
So as shown in your post above, these are statically configured on all the individual routers yes?
The routing tables on my routers are distilled from this, the OSPF information and directly connected networks.
Could it be that sometimes the OSPF routes get ditched for a short amount of time, and that this caused the traffic to end up at MT1?
Because before I added the unreachables, when an OSPF neighbor goes down, the 0.0.0.0/0 towards MT1 would have taken over the route for the 172.18.2.0/23 network and traffic towards the 172.18.3.x clients would endup on MT1.
Now since I have the unreachables, when an OSPF goes down, the network goes to unreachable., right?
Sure, if it loses the more specific routing information it'll take the default route. But assuming these blackholes were statically configured at MT2, even without the OSPF routing information the packets would still be discarded at MT2.

As for the ditching of OSPF routes: how often does that connection go down? OSPF has quite fast convergence, so the impact would only be minimal (almost: coincidental). When I look at the age of the connections shown in one of your previous posts, it's not a single occasion (e.g.: we see connections timing out 17 hours, but also 19, 23 and 14).
 
Rudios
Forum Veteran
Forum Veteran
Topic Author
Posts: 973
Joined: Mon Mar 11, 2013 12:58 pm
Location: The Netherlands

Re: Firewall connections overview

Mon Oct 17, 2016 8:35 am

During the writing of the post I did check again and found NOTHING of this behaviour anymore!!!
OK, that's good as a result, less so as still being unexplained.
Indeed glad they're gone, still unclear why
For lowering the load on the CPU and block useless traffic I added unreachable routes to my routing table (I started with blackholes but found out later that unreachables were better in terms of trouble shooting).
So as shown in your post above, these are statically configured on all the individual routers yes?
Yes all my routers are having the three unreachable routes now.
The routing tables on my routers are distilled from this, the OSPF information and directly connected networks.
Could it be that sometimes the OSPF routes get ditched for a short amount of time, and that this caused the traffic to end up at MT1?
Because before I added the unreachables, when an OSPF neighbor goes down, the 0.0.0.0/0 towards MT1 would have taken over the route for the 172.18.2.0/23 network and traffic towards the 172.18.3.x clients would endup on MT1.
Now since I have the unreachables, when an OSPF goes down, the network goes to unreachable., right?
Sure, if it loses the more specific routing information it'll take the default route. But assuming these blackholes were statically configured at MT2, even without the OSPF routing information the packets would still be discarded at MT2.
The screenshots of the firewall connections were taken before I added the blackhole/unreachable routes, so in that way it makes sense the packets will be routed to the 0.0.0.0/0 route.
As for the ditching of OSPF routes: how often does that connection go down? OSPF has quite fast convergence, so the impact would only be minimal (almost: coincidental). When I look at the age of the connections shown in one of your previous posts, it's not a single occasion (e.g.: we see connections timing out 17 hours, but also 19, 23 and 14).
Ditching the OSPF is not happening that much. Connections between all RouterBoards are wireless, so it does happen.

Who is online

Users browsing this forum: Ahrefs [Bot], Amazon [Bot], Bing [Bot] and 139 guests