How to configure mikrotik network equipment » History » Version 31
Nico Schottelius, 08/03/2020 06:16 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 | 29 | Nico Schottelius | [15:21] bridge:~% ssh admin@fe80::c6ad:34ff:fe88:832b%eth1 |
37 | 28 | Nico Schottelius | admin@fe80::c6ad:34ff:fe88:832b%eth1's password: |
38 | </pre> |
||
39 | |||
40 | </pre> |
||
41 | |||
42 | 1 | Nico Schottelius | h2. Setting up a newly arrived Mikrotik switch |
43 | |||
44 | This part is specific for mikrotik-crs326 devices and should |
||
45 | |||
46 | After arriving within 1 work day do: |
||
47 | |||
48 | * Unpack |
||
49 | * Find out which name the switch should have |
||
50 | ** go to https://netbox.ungleich.ch |
||
51 | ** search for crs326 |
||
52 | ** identify the last used number |
||
53 | ** Create a new device |
||
54 | *** go to devices |
||
55 | *** devices |
||
56 | *** add |
||
57 | **** name: "mikrotik-crs326-XX" |
||
58 | **** device-role: a device role |
||
59 | **** device-type: CRS326 |
||
60 | **** serial-number: <from the device> |
||
61 | **** site: placeX - |
||
62 | **** create |
||
63 | * Add a physical label with its name |
||
64 | ** Do not continue before you have done that! |
||
65 | * configure your notebook with the ipv4 address 192.168.88.23/24 |
||
66 | * connect to the crs326: @ssh admin@192.168.88.1@ |
||
67 | * Configure the switch |
||
68 | ** Set identity: @/system identity set name=mikrotik-crs326-XX@ # use the correct name |
||
69 | ** Set password: @/user set admin password=@ # use the password for mikrotik in the place that you are, use password store |
||
70 | ** Enable IPv6: @/system package enable ipv6@ |
||
71 | ** Reboot so that IPv6 is enabled: @/system reboot@ |
||
72 | 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@ |
73 | ** Get the assigned IPv6 address: @/ipv6 address print@ |
||
74 | ** Disconnect from the switch |
||
75 | * Assign your notebook the IPv6 address *2a0a:e5c0:1:c::23/64* |
||
76 | 1 | Nico Schottelius | * Connect to the switch via IPv6 |
77 | 3 | Nico Schottelius | ** Remove the IPv4 address 192.168.88.1 to avoid collisions with other switches: @/ip address remove numbers=0@ |
78 | *** Verify: @/ip address print@ |
||
79 | * Verify / update entries in netbox: |
||
80 | ** Verify that the serial number is correct: @:put [ /system routerboard get serial-number ]@ |
||
81 | 4 | Nico Schottelius | ** Netbox |
82 | *** go to the ipv6 prefix https://netbox.ungleich.ch/ipam/prefixes/216/ |
||
83 | **** create a new ipv6 address |
||
84 | **** set the DNS name to *mikrotik-crs326-XX* |
||
85 | 5 | Nico Schottelius | **** role = loopback |
86 | 6 | Nico Schottelius | * Ensure all steps are taken correctly |
87 | * Move the device to our inventory / stock if not directly used |
||
88 | 7 | Nico Schottelius | |
89 | 31 | Nico Schottelius | h2. How to configure VLANs on the Mikrotik CRS326 series |
90 | |||
91 | * Do not use the standard Linux approach of putting vlan interfaces into bridges |
||
92 | * Switches can suddenly stop working |
||
93 | ** Compare https://wiki.mikrotik.com/wiki/Manual:Layer2_misconfiguration |
||
94 | |||
95 | Instead use the following procedure outlined in https://wiki.mikrotik.com/wiki/Manual:Basic_VLAN_switching#CRS3xx_series_switches |
||
96 | |||
97 | <pre> |
||
98 | /interface bridge add name=bridgevlans |
||
99 | |||
100 | # Tagged interfaces need to go in like this: |
||
101 | /interface bridge port add bridge=bridgevlans interface=sfp-sfpplus1 hw=yes |
||
102 | |||
103 | # Untagged interfaces need to go in like this: |
||
104 | /interface bridge port add bridge=bridgevlans interface=ether2 hw=yes pvid=20 |
||
105 | /interface bridge port add bridge=bridgevlans interface=ether3 hw=yes pvid=20 |
||
106 | ... |
||
107 | |||
108 | # Then add them to "bridge vlan" |
||
109 | /interface bridge vlan add bridge=bridgevlans tagged=ether1 untagged=ether2,ether3 vlan-ids=20 |
||
110 | /interface bridge vlan add bridge=bridgevlans tagged=ether1,bridge1 vlan-ids=99 |
||
111 | |||
112 | # Management |
||
113 | /interface vlan add interface=bridgevlans vlan-id=99 name=MGMT |
||
114 | /ipv6 address add eui-64=yes advertise=no address=2a0a:e5c0:... interface=MGMT |
||
115 | |||
116 | # Last step |
||
117 | /interface bridge set bridge1 vlan-filtering=yes |
||
118 | |||
119 | # Might need reboot for activating the IPv6 address |
||
120 | /system reboot |
||
121 | </pre> |
||
122 | |||
123 | 7 | Nico Schottelius | |
124 | h2. Configuring a Mikrotik switch for integration into the network |
||
125 | |||
126 | Depending on the usage scenario, we will define a variety of bridges and assign ports to it. |
||
127 | |||
128 | * In almost all cases the uplink port will be the *sfp-sfpplus1* port. |
||
129 | * In almost all cases we want to apply vlan tagging to that port |
||
130 | * For server networks, we configure the MTU to the highest value the switch supports |
||
131 | ** Devices are configured with a 9200 MTU |
||
132 | ** So the MTU on the switch ports needs to be at least 9200 |
||
133 | |||
134 | h3. First step for all integrations |
||
135 | |||
136 | 8 | Nico Schottelius | Setup MTU of all *sfp-sfpplus* ports (plural) to 9200 and the L2MTU to 9204: |
137 | 1 | Nico Schottelius | |
138 | 8 | Nico Schottelius | Use @/interface print@ to find out the maximum MTU: |
139 | |||
140 | <pre> |
||
141 | [admin@mikrotik-crs326-1] > /interface print |
||
142 | Flags: D - dynamic, X - disabled, R - running, S - slave |
||
143 | # NAME TYPE ACTUAL-MTU L2MTU MAX-L2MTU MAC-ADDRESS |
||
144 | 0 S ether1 ether 9200 9204 10218 B8:69:F4:8E:AC:BA |
||
145 | 1 S ether2 ether 9200 9204 10218 B8:69:F4:8E:AC:BB |
||
146 | ... |
||
147 | 24 R sfp-sfpplus1 ether 9200 9204 10218 B8:69:F4:8E:AC:D2 |
||
148 | 25 sfp-sfpplus2 ether 9200 9204 10218 B8:69:F4:8E:AC:D3 |
||
149 | </pre> |
||
150 | |||
151 | Above is already setup, but the values differ, use the following to set it correctly: |
||
152 | |||
153 | <pre> |
||
154 | /interface set sfp-sfpplus1 mtu=9200 l2mtu=9204 |
||
155 | /interface set sfp-sfpplus2 mtu=9200 l2mtu=9204 |
||
156 | </pre> |
||
157 | |||
158 | 7 | Nico Schottelius | h3. Use case 1: coworking network |
159 | 1 | Nico Schottelius | |
160 | 9 | Nico Schottelius | To use the switch in a coworking network, we keep the MTU |
161 | |||
162 | 16 | Samuel Hailu | * Create a vlan interface named *vlan-coworking*: @/interface vlan add vlan-id=15 name=vlan-coworking interface=sfp-sfpplus1@ |
163 | ** Verify that it is created: @/interface vlan print@ |
||
164 | 1 | Nico Schottelius | ** Lookup the vlan-id from https://netbox.ungleich.ch/ipam/vlans/ |
165 | 9 | Nico Schottelius | ** The vlan will be added to *sfp-sfpplus1* |
166 | 16 | Samuel Hailu | * Create a bridge named *bridge-coworking*: @/interface bridge add name=bridge-coworking@ |
167 | ** Verify that it is created: @/interface print@ |
||
168 | * Add the interface *vlan-coworking* to the *bridge-coworking* as a port: @/interface vlan add interface=vlan-coworking@ |
||
169 | ** Verify that the port is added: @/interface vlan print@ |
||
170 | 15 | Nico Schottelius | * Add all ethernet ports that you need for coworking to the *bridge-coworking* |
171 | 16 | Samuel Hailu | ** For instance to add port 7: @/interface bridge port set bridge=bridge-coworking numbers=6@ |
172 | *** Find the number of the interface with @/interface bridge port print@ |
||
173 | 15 | Nico Schottelius | ** Verify again like you did above |
174 | 8 | Nico Schottelius | |
175 | 17 | Nico Schottelius | h3. Use case 2: server or internal network |
176 | |||
177 | Steps similar to above, BUT ensure that the MTU is set correctly on all interfaces. |
||
178 | |||
179 | * Ensure that the mtu is correct on the *sfp-sfplus* interfaces (see above) |
||
180 | ** This is important |
||
181 | * We create a bridge named |
||
182 | 20 | Samuel Hailu | ** *bridge-server*: @/interface bridge add name=bridge-server@ |
183 | ** *bridge-internal*: @/interface bridge add name=bridge-internal@ |
||
184 | 17 | Nico Schottelius | * We create a new vlan interface on *sfp-sfpplus1* named |
185 | 21 | Samuel Hailu | ** *vlan-server*: @/interface vlan add name=vlan-server interface=sfp-sfpplus1 mtu=9200@ |
186 | 22 | Samuel Hailu | ** *vlan-internal*: @/interface vlan add name=vlan-internal interface=sfp-sfpplus1 mtu=9200@ |
187 | 17 | Nico Schottelius | * Add the |
188 | 20 | Samuel Hailu | ** *vlan-server* interface as a port to *bridge-server*: @/interface bridge port add interface=vlan-server bridge=bridge-server@ |
189 | ** *vlan-internal* interface as a port to *bridge-internal*: @/interface bridge port add interface=vlan-internal bridge=bridge-internal@ |
||
190 | 17 | Nico Schottelius | * Verify that the MTU is correct |
191 | 23 | Nico Schottelius | ** On the VLAN interface: @/interface vlan print@ |
192 | ** On the bridge: @/interface bridge print@ |
||
193 | ** On the sfp-sfpplus interfaces: @/interface print@ |
||
194 | 17 | Nico Schottelius | |
195 | |||
196 | 19 | Nico Schottelius | <pre> |
197 | If the MTUs are wrong, you can encounter hanging connections, while ping (small packet) still works. Be careful to do it right. |
||
198 | </pre> |
||
199 | 17 | Nico Schottelius | |
200 | 25 | Nico Schottelius | h2. Typical setup for a new mikrotik-crs326 in place6 |
201 | |||
202 | You need to insert a GBIC module *BEFORE* seting mtu on the sfp-sfpplus interface |
||
203 | |||
204 | <pre> |
||
205 | /interface set sfp-sfpplus1 mtu=10216 l2mtu=10218 |
||
206 | |||
207 | /interface bridge add name=bridge-server |
||
208 | /interface vlan add name=vlan-server interface=sfp-sfpplus1 mtu=10214 vlan-id=11 |
||
209 | /interface bridge port add interface=vlan-server bridge=bridge-server |
||
210 | |||
211 | /interface bridge add name=bridge-internal |
||
212 | /interface vlan add name=vlan-internal interface=sfp-sfpplus1 mtu=10214 vlan-id=10 |
||
213 | /interface bridge port add interface=vlan-internal bridge=bridge-internal |
||
214 | |||
215 | 26 | Nico Schottelius | /ipv6 address add eui-64=yes advertise=no interface=bridge-internal address=2a0a:e5c0:2::/64 |
216 | /ipv6 address print |
||
217 | 25 | Nico Schottelius | |
218 | 26 | Nico Schottelius | </pre> |
219 | 25 | Nico Schottelius | |
220 | 8 | Nico Schottelius | h2. Update the switch to the latest version |
221 | |||
222 | (TBD for IPv6 only networks) |
||
223 | 30 | Nico Schottelius | |
224 | |||
225 | h2. Make switch accept router advertisements! |
||
226 | |||
227 | <pre> |
||
228 | [admin@mikrotik-crs236-2] > /ipv6 settings set accept-router-advertisements=yes |
||
229 | </pre> |
||
230 | |||
231 | FINALLY! |