Project

General

Profile

How to configure mikrotik network equipment » History » Version 28

Nico Schottelius, 07/28/2020 03:22 PM

1 1 Nico Schottelius
h1. How to configure mikrotik network equipment
2
3 6 Nico Schottelius
{{toc}}
4 1 Nico Schottelius
5
h2. Status
6
7
This document is **PRE PRODUCTION**.
8
9 27 Nico Schottelius
h2. Finding a directly connected Mikrotik switch
10
11
If you don't know the IP address of a Mikrotik switch, just connect a direct cable to it and ping the IPv6 multicast all nodes address:
12
13
<pre>
14
5: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
15
    link/ether 80:1f:02:d6:4c:50 brd ff:ff:ff:ff:ff:ff
16
    inet6 fe80::821f:2ff:fed6:4c50/64 scope link 
17
       valid_lft forever preferred_lft forever
18
bridge:~# ping ff02::1%eth1
19
PING ff02::1%eth1 (ff02::1%5): 56 data bytes
20
64 bytes from fe80::821f:2ff:fed6:4c50: seq=0 ttl=64 time=0.115 ms
21
64 bytes from fe80::c6ad:34ff:fe88:832b: seq=0 ttl=64 time=0.588 ms (DUP!)
22
64 bytes from fe80::821f:2ff:fed6:4c50: seq=1 ttl=64 time=0.109 ms
23
64 bytes from fe80::c6ad:34ff:fe88:832b: seq=1 ttl=64 time=0.432 ms (DUP!)
24
^C
25
--- ff02::1%eth1 ping statistics ---
26
2 packets transmitted, 2 packets received, 2 duplicates, 0% packet loss
27
round-trip min/avg/max = 0.109/0.311/0.588 ms
28
bridge:~# 
29
</pre>
30
31
* One of the ip address is you, the other one is the switch
32
33 28 Nico Schottelius
Connecting to it via ssh:
34
35
<pre>
36
admin@fe80::c6ad:34ff:fe88:832b%eth1's password: 
37
</pre>
38
39
</pre>
40
41 1 Nico Schottelius
h2. Setting up a newly arrived Mikrotik switch
42
43
This part is specific for mikrotik-crs326 devices and should
44
45
After arriving within 1 work day do:
46
47
* Unpack
48
* Find out which name the switch should have
49
** go to https://netbox.ungleich.ch
50
** search for crs326
51
** identify the last used number
52
** Create a new device
53
*** go to devices 
54
*** devices
55
*** add
56
**** name: "mikrotik-crs326-XX"
57
**** device-role: a device role
58
**** device-type: CRS326
59
**** serial-number: <from the device>
60
**** site: placeX -
61
**** create
62
* Add a physical label with its name
63
** Do not continue before you have done that!
64
* configure your notebook with the ipv4 address 192.168.88.23/24 
65
* connect to the crs326: @ssh admin@192.168.88.1@
66
* Configure the switch
67
** Set identity: @/system identity set name=mikrotik-crs326-XX@ # use the correct name
68
** Set password: @/user set admin password=@ # use the password for mikrotik in the place that you are, use password store
69
** Enable IPv6: @/system package enable ipv6@
70
** Reboot so that IPv6 is enabled: @/system reboot@
71 2 Nico Schottelius
** Add a place indendent, unrouted IPv6 address: @/ipv6 address add eui-64=yes advertise=no interface=bridge address=2a0a:e5c0:1:c::/64@
72
** Get the assigned IPv6 address: @/ipv6 address print@
73
** Disconnect from the switch
74
* Assign your notebook the IPv6 address *2a0a:e5c0:1:c::23/64*
75 1 Nico Schottelius
* Connect to the switch via IPv6
76 3 Nico Schottelius
** Remove the IPv4 address 192.168.88.1 to avoid collisions with other switches: @/ip address remove numbers=0@
77
*** Verify: @/ip address print@
78
* Verify / update entries in netbox:
79
** Verify that the serial number is correct: @:put [ /system routerboard get serial-number ]@
80 4 Nico Schottelius
** Netbox
81
*** go to the ipv6 prefix https://netbox.ungleich.ch/ipam/prefixes/216/
82
**** create a new ipv6 address
83
**** set the DNS name to *mikrotik-crs326-XX*
84 5 Nico Schottelius
**** role = loopback
85 6 Nico Schottelius
* Ensure all steps are taken correctly
86
* Move the device to our inventory / stock if not directly used
87 7 Nico Schottelius
88
89
h2. Configuring a Mikrotik switch for integration into the network
90
91
Depending on the usage scenario, we will define a variety of bridges and assign ports to it.
92
93
* In almost all cases the uplink port will be the *sfp-sfpplus1* port.
94
* In almost all cases we want to apply vlan tagging to that port
95
* For server networks, we configure the MTU to the highest value the switch supports
96
** Devices are configured with a 9200 MTU
97
** So the MTU on the switch ports needs to be at least 9200
98
99
h3. First step for all integrations
100
101 8 Nico Schottelius
Setup MTU of all *sfp-sfpplus* ports (plural) to 9200 and the L2MTU to 9204:
102 1 Nico Schottelius
103 8 Nico Schottelius
Use @/interface print@ to find out the maximum MTU:
104
105
<pre>
106
[admin@mikrotik-crs326-1] > /interface print 
107
Flags: D - dynamic, X - disabled, R - running, S - slave 
108
 #     NAME                                TYPE       ACTUAL-MTU L2MTU  MAX-L2MTU MAC-ADDRESS      
109
 0   S ether1                              ether            9200  9204      10218 B8:69:F4:8E:AC:BA
110
 1   S ether2                              ether            9200  9204      10218 B8:69:F4:8E:AC:BB
111
...
112
24  R  sfp-sfpplus1                        ether            9200  9204      10218 B8:69:F4:8E:AC:D2
113
25     sfp-sfpplus2                        ether            9200  9204      10218 B8:69:F4:8E:AC:D3
114
</pre>
115
116
Above is already setup, but the values differ, use the following to set it correctly:
117
118
<pre>
119
/interface set sfp-sfpplus1 mtu=9200 l2mtu=9204
120
/interface set sfp-sfpplus2 mtu=9200 l2mtu=9204
121
</pre>
122
123 7 Nico Schottelius
h3. Use case 1: coworking network
124 1 Nico Schottelius
125 9 Nico Schottelius
To use the switch in a coworking network, we keep the MTU
126
127 16 Samuel Hailu
* Create a vlan interface named *vlan-coworking*: @/interface vlan add  vlan-id=15 name=vlan-coworking interface=sfp-sfpplus1@
128
** Verify that it is created: @/interface vlan print@
129 1 Nico Schottelius
** Lookup the vlan-id from https://netbox.ungleich.ch/ipam/vlans/
130 9 Nico Schottelius
** The vlan will be added to *sfp-sfpplus1*
131 16 Samuel Hailu
* Create a bridge named *bridge-coworking*: @/interface bridge add name=bridge-coworking@
132
** Verify that it is created: @/interface print@
133
* Add the interface *vlan-coworking* to the *bridge-coworking* as a port: @/interface vlan add interface=vlan-coworking@
134
** Verify that the port is added: @/interface vlan print@
135 15 Nico Schottelius
* Add all ethernet ports that you need for coworking to the *bridge-coworking*
136 16 Samuel Hailu
** For instance to add port 7: @/interface bridge port set bridge=bridge-coworking numbers=6@ 
137
*** Find the number of the interface with @/interface bridge port print@
138 15 Nico Schottelius
** Verify again like you did above
139 8 Nico Schottelius
140 17 Nico Schottelius
h3. Use case 2: server or internal network
141
142
Steps similar to above, BUT ensure that the MTU is set correctly on all interfaces.
143
144
* Ensure that the mtu is correct on the *sfp-sfplus* interfaces (see above)
145
** This is important
146
* We create a bridge named
147 20 Samuel Hailu
** *bridge-server*: @/interface bridge add name=bridge-server@
148
** *bridge-internal*: @/interface bridge add name=bridge-internal@
149 17 Nico Schottelius
* We create a new vlan interface on *sfp-sfpplus1* named
150 21 Samuel Hailu
** *vlan-server*: @/interface vlan add name=vlan-server interface=sfp-sfpplus1 mtu=9200@
151 22 Samuel Hailu
** *vlan-internal*: @/interface vlan add name=vlan-internal interface=sfp-sfpplus1 mtu=9200@
152 17 Nico Schottelius
* Add the
153 20 Samuel Hailu
** *vlan-server* interface as a port to *bridge-server*: @/interface  bridge port add interface=vlan-server bridge=bridge-server@
154
** *vlan-internal* interface as a port to *bridge-internal*: @/interface  bridge port add interface=vlan-internal bridge=bridge-internal@
155 17 Nico Schottelius
* Verify that the MTU is correct
156 23 Nico Schottelius
** On the VLAN interface: @/interface vlan print@
157
** On the bridge: @/interface bridge print@
158
** On the sfp-sfpplus interfaces: @/interface print@
159 17 Nico Schottelius
160
161 19 Nico Schottelius
<pre>
162
If the MTUs are wrong, you can encounter hanging connections, while ping (small packet) still works. Be careful to do it right.
163
</pre>
164 17 Nico Schottelius
165 25 Nico Schottelius
h2. Typical setup for a new mikrotik-crs326 in place6
166
167
You need to insert a GBIC module *BEFORE* seting mtu on the sfp-sfpplus interface
168
169
<pre>
170
/interface set sfp-sfpplus1 mtu=10216 l2mtu=10218
171
172
/interface bridge add name=bridge-server
173
/interface vlan add name=vlan-server interface=sfp-sfpplus1 mtu=10214 vlan-id=11
174
/interface bridge port add interface=vlan-server bridge=bridge-server
175
176
/interface bridge add name=bridge-internal
177
/interface vlan add name=vlan-internal interface=sfp-sfpplus1 mtu=10214 vlan-id=10
178
/interface bridge port add interface=vlan-internal bridge=bridge-internal
179
180 26 Nico Schottelius
/ipv6 address add eui-64=yes advertise=no interface=bridge-internal address=2a0a:e5c0:2::/64
181
/ipv6 address print
182 25 Nico Schottelius
183 26 Nico Schottelius
</pre>
184 25 Nico Schottelius
185 8 Nico Schottelius
h2. Update the switch to the latest version
186
187
(TBD for IPv6 only networks)