Firewall high cpu on CRS112-8G-4S

Hello, I recently purchased this nice cloud core switch. But the CPU is high all the time.

This is my config from my router. If someone experienced user can give me some help and hints, thank you all the best.


[admin@MikroTik] > /export compact
# aug/29/2016 12:53:02 by RouterOS 6.34.2
# software id = xxxx
#
/interface bridge
add name=dhcp-bridge
/interface ethernet
set [ find default-name=ether1 ] mac-address=F8:1A:67:xx:xx:xx name=ether1-master
set [ find default-name=ether3 ] arp=disabled
set [ find default-name=sfp9 ] master-port=ether1-master
set [ find default-name=sfp10 ] master-port=ether1-master
set [ find default-name=sfp11 ] master-port=ether1-master
set [ find default-name=sfp12 ] master-port=ether1-master
/ip hotspot profile
set [ find default=yes ] html-directory=flash/hotspot
/ip pool
add name=dhcp_pool1 ranges=192.168.7.1-192.168.7.253
/ip dhcp-server
add address-pool=dhcp_pool1 always-broadcast=yes disabled=no interface=dhcp-bridge name=dhcp1
/interface bridge port
add bridge=dhcp-bridge interface=ether3
add bridge=dhcp-bridge interface=ether2
add bridge=dhcp-bridge interface=ether4
add bridge=dhcp-bridge interface=ether5
add bridge=dhcp-bridge interface=ether6
add bridge=dhcp-bridge interface=ether7
add bridge=dhcp-bridge interface=ether8
/ip address
add address=192.168.88.1/24 comment=defconf interface=ether1-master network=192.168.88.0
add address=10.10.73.52/24 interface=ether1-master network=10.10.73.0
add address=192.168.7.254/24 interface=dhcp-bridge network=192.168.7.0
/ip dhcp-server network
add address=192.168.7.0/24 gateway=192.168.7.254
/ip dns
set servers=10.10.73.1,213.xx.xx.19
/ip firewall nat
add action=masquerade chain=srcnat out-interface=ether1-master
add action=dst-nat chain=dstnat dst-port=1667 in-interface=ether1-master protocol=tcp to-addresses=192.168.7.104 \
    to-ports=1667
add action=dst-nat chain=dstnat dst-port=2312 in-interface=ether1-master protocol=tcp to-addresses=192.168.7.104 \
    to-ports=2312
add action=dst-nat chain=dstnat dst-port=3343 in-interface=ether1-master protocol=tcp to-addresses=192.168.7.104 \
    to-ports=3343
/ip route
add distance=1 gateway=10.10.73.1
/ip service
set telnet disabled=yes
set ftp disabled=yes
set www disabled=yes
set ssh disabled=yes
set api disabled=yes
set api-ssl disabled=yes
/system clock
[admin
@Mikro
Tik] >
[admin@MikroTik] >

HighCpu.JPG

Try this:

Instead of adding the ports to a bridge, set ether3-8 as slave interfaces of ether2.

“Move” any IPs and services (DHCP-Server) assigned to dhcp-bridge to ether2.

That way you’ll be doing switching by hardware switch chip; right now you’re doing it by software, which taxes the CPU.

Yeah, you definitely don’t want to user bridging for what seems to be simple layer 2 operations. Better to not use bridging at all…rely on the switch chip for layer 2, and only use the CPU for routing. The CRS really isn’t meant for CPU intensive tasks like routing or bridging…the layer 3 functionality is really just there for management purposes. Think of the CRS more as a managed switch than a router.

Thank you for helping me , I removed the bridge, but unfortunately it’s worse, the CPU is much higher and the router is very slow. Also I notice if I disconnect my PC on ether8 which is doing upload 16 mbit all the time, the CPU drops to normal usage 10 %.

This is my new config

[admin@MikroTik] > export compact
# aug/29/2016 16:28:17 by RouterOS 6.34.2
# software id = xxxxx
#
/interface ethernet
set [ find default-name=ether1 ] mac-address=F8:1A:67:xx:xx:xx name=ether1-master
set [ find default-name=ether3 ] arp=disabled master-port=ether2
set [ find default-name=ether4 ] master-port=ether2
set [ find default-name=ether5 ] master-port=ether2
set [ find default-name=ether6 ] master-port=ether2
set [ find default-name=ether7 ] master-port=ether2
set [ find default-name=ether8 ] master-port=ether2
set [ find default-name=sfp9 ] master-port=ether1-master
set [ find default-name=sfp10 ] master-port=ether1-master
set [ find default-name=sfp11 ] master-port=ether1-master
set [ find default-name=sfp12 ] master-port=ether1-master
/ip hotspot profile
set [ find default=yes ] html-directory=flash/hotspot
/ip pool
add name=dhcp_pool1 ranges=192.168.7.1-192.168.7.253
/ip dhcp-server
add address-pool=dhcp_pool1 always-broadcast=yes disabled=no interface=ether2 name=dhcp1
/ip address
add address=192.168.88.1/24 comment=defconf interface=ether1-master network=192.168.88.0
add address=10.10.73.52/24 interface=ether1-master network=10.10.73.0
add address=192.168.7.254/24 interface=ether2 network=192.168.7.0
/ip dhcp-server network
add address=192.168.7.0/24 gateway=192.168.7.254
/ip dns
set servers=10.10.73.1,213.xx.xx.xx
/ip firewall nat
add action=masquerade chain=srcnat out-interface=ether1-master
add action=dst-nat chain=dstnat dst-port=1667 in-interface=ether1-master protocol=tcp to-addresses=192.168.7.104 \
    to-ports=1667
add action=dst-nat chain=dstnat dst-port=2312 in-interface=ether1-master protocol=tcp to-addresses=192.168.7.104 \
    to-ports=2312
add action=dst-nat chain=dstnat dst-port=3343 in-interface=ether1-master protocol=tcp to-addresses=192.168.7.104 \
    to-ports=3343
/ip route
add distance=1 gateway=10.10.73.1
/ip service
set telnet disabled=yes
set ftp disabled=yes
set www disabled=yes
set ssh disabled=yes
set api disabled=yes
set api-ssl disabled=yes
/system clock
set time-zone-name=Europe
/system routerboard settings
set protected-routerboot=disabled
[admin@MikroTik] >

HighCpu2.JPG

Looks like your firewall is doing a lot of work - way more than it should have to. Give me some time to rework your config…I think we can come up with something a bit simpler. Can you post a full export instead of a compact? Need to look at the full firewall rules to find out what’s going on.

Quick question - do you intend to manage this switch out-of-band, or is it ok to move the management IP in-band with ports 2-8?

So I’ve made an effort to give you a working config that is also, for the most part, secure. It will need tweaking depending on your exact networking needs. There are also a few parts where you’ll need to insert information, such as defining NTP servers for your switch. Note that I’ve made some changes to make the config a little easier to follow, such as renaming some ports. Also, do you need your SFP ports slave to your WAN/outbound interface? Assuming not, I’ve moved them to be internal and slave to your master internal interface.

Also, I’ve made port 8 part of the Management VLAN, so your PC should pick up a DHCP address in the 192.168.88.x subnet and be able to access the management interface directly. However, I’ve also included a firewall rule that allows forwarding between internal networks, so you ought to be able to plug into any other port (getting a 192.168.7.x address) and reach the Management address as well. This rule can easily be modified to deny the 192.168.7.x subnet access to the management interface, in which case you’ll need to be plugged into port 8.

I’ve also added comments to the firewall rules so you clearly see their purpose. Modify as needed for your environment, but be careful you don’t lock yourself out. I’d recommend configuring the switch via the RJ-45 serial port.

/interface ethernet
set [ find default-name=ether1 ] mac-address=F8:1A:67:xx:xx:xx name=ether1-WAN
set [ find default-name=ether3 ] arp=disabled master-port=ether2
set [ find default-name=ether4 ] master-port=ether2
set [ find default-name=ether5 ] master-port=ether2
set [ find default-name=ether6 ] master-port=ether2
set [ find default-name=ether7 ] master-port=ether2
set [ find default-name=ether8 ] master-port=ether2
set [ find default-name=sfp9 ] master-port=ether2
set [ find default-name=sfp10 ] master-port=ether2
set [ find default-name=sfp11 ] master-port=ether2
set [ find default-name=sfp12 ] master-port=ether2
/interface vlan
add interface=ether2 name=Management vlan-id=100
add interface=ether2 name=Clients vlan-id=200
/interface ethernet switch vlan
add ports=ether2,ether3,ether4,ether5,ether6,ether7,switch1-cpu vlan-id=200
add ports=ether8,switch1-cpu vlan-id=100
/interface ethernet switch ingress-vlan-translation
add customer-vid=0 customer-vlan-format=untagged-or-tagged new-customer-vid=200 ports=\
	ether2,ether3,ether4,ether5,ether6,ether7 sa-learning=yes
add customer-vid=0 customer-vlan-format=untagged-or-tagged new-customer-vid=100 ports=\
	ether8 sa-learning=yes
/interface ethernet switch egress-vlan-tag
add tagged-ports=switch1-cpu vlan-id=100
add tagged-ports=switch1-vpu vlan-id=200
/ip hotspot profile
set [ find default=yes ] html-directory=flash/hotspot
/ip pool
add name=dhcp_pool1 ranges=192.168.7.1-192.168.7.253
add name=dhcp_pool_mgmt ranges=192.168.88.2-192.168.88.254
/ip dhcp-server network
add address=192.168.7.0/24 gateway=192.168.7.254 dns-server=10.10.73.1,213.xx.xx.xx
add address=192.168.88.0/24 gateway=192.168.88.1 dns-server=10.10.73.1,213.xx.xx.xx
/ip dhcp-server
add address-pool=dhcp_pool1 always-broadcast=yes disabled=no interface=Clients name=dhcp1
add address-pool=dhcp_pool_mgmt disabled=no interface=Management name=dhcp_mgmt
/ip address
add address=192.168.88.1/24 comment=defconf interface=Management network=192.168.88.0
add address=10.10.73.52/24 interface=ether1-WAN network=10.10.73.0
add address=192.168.7.254/24 interface=Clients network=192.168.7.0
/ip dns
set servers=10.10.73.1,213.xx.xx.xx
/ip firewall nat
add chain=srcnat action=masquerade out-interface=ether1-WAN
add chain=dstnat in-interface=ether1-master dst-port=1667 protocol=tcp action=dst-nat to-addresses=192.168.7.104 \
    to-ports=1667
add chain=dstnat in-interface=ether1-master dst-port=2312 protocol=tcp action=dst-nat to-addresses=192.168.7.104 \
    to-ports=2312
add chain=dstnat in-interface=ether1-master dst-port=3343 protocol=tcp action=dst-nat to-addresses=192.168.7.104 \
    to-ports=3343
add chain=input in-interface=ether1-WAN connection-state=established,related action=accept \
	comment="Accept inbound related/established"
add chain=input in-interface=ether1-WAN src-address=<n.t.p.server1>,<n.t.p.server2> protocol=udp dst-port=123 action=accept \
	comment="Accept inbound NTP responses from defined NTP Servers"
add chain=input in-interface=ether1-WAN action=drop comment="Drop unsolicited inbound traffic from WAN"
add chain=input in-interface=!ether1-WAN protocol=icmp action=accept comment="Accept icmp on internal interfaces"
add chain=input in-interface=!ether1-WAN dst-address=192.168.88.1 protocol=tcp dst-port=8291 action=accept \
	comment="Accept Winbox Management traffic from internal interfaces only"
add chain=input in-interface=!ether1_WAN protocol=udp dst-port=67 action=accept comment="Accept internal DHCP requests"
add chain=input in-interface=!ether1-WAN action=drop comment="Drop all remaining inbound traffic"
add chain=forward connection-state=related,established action=fasttrack-connection \
	comment="FastTrack Related/Established connections"
add chain=forward connection-state=related,established action=accept comment="Accept non-FastTrack Rel/Est connections"
add chain=forward in-interface=!ether1-WAN out-interface=!ether1-WAN action=accept \
	comment="Accept forwarding between internal networks"
add chain=forward out-interface=ether1-WAN action=accept comment="Accept outbound connection from internal networks"
add chain=forward in-interface=ether1-WAN dst-address=192.168.7.104 dst-port=1667,2312,3343 protocol=tcp action=accept \
	comment="Accept post-nat port forwarding"
add chain=forward action=drop comment="Drop all remaining traffic"
/ip route
add distance=1 gateway=10.10.73.1
/ip service
set telnet disabled=yes
set ftp disabled=yes
set www disabled=yes
set ssh disabled=yes
set api disabled=yes
set api-ssl disabled=yes
/system clock
set time-zone-name=Europe
/system ntp client
set enabled=yes primary-ntp=xx.xx.xx.xx secondary-ntp=xx.xx.xx.xx
/system routerboard settings
set protected-routerboot=disabled

@mpreissner: thank you for your effort, I did not apply your config yet, I am away from home, I notice when I close this port TCP 3343 which is main port for uploading, the CPU drops to normal 10 %. I don’t know why this port cause high CPU usage.

After reading the mikrotik manual I found fasttraction action which solved my problem finally .
Now the CPU drops to 20%.
Thank you all.