How to configure mikrotik network equipment » History » Version 32
Nico Schottelius, 08/03/2020 06:56 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 | 32 | Nico Schottelius | *** Specifically this: https://wiki.mikrotik.com/wiki/Manual:Layer2_misconfiguration#VLAN_in_bridge_with_a_physical_interface |
| 95 | 31 | Nico Schottelius | |
| 96 | Instead use the following procedure outlined in https://wiki.mikrotik.com/wiki/Manual:Basic_VLAN_switching#CRS3xx_series_switches |
||
| 97 | |||
| 98 | 32 | Nico Schottelius | |
| 99 | 31 | Nico Schottelius | <pre> |
| 100 | /interface bridge add name=bridgevlans |
||
| 101 | |||
| 102 | # Tagged interfaces need to go in like this: |
||
| 103 | /interface bridge port add bridge=bridgevlans interface=sfp-sfpplus1 hw=yes |
||
| 104 | |||
| 105 | # Untagged interfaces need to go in like this: |
||
| 106 | /interface bridge port add bridge=bridgevlans interface=ether2 hw=yes pvid=20 |
||
| 107 | /interface bridge port add bridge=bridgevlans interface=ether3 hw=yes pvid=20 |
||
| 108 | ... |
||
| 109 | |||
| 110 | # Then add them to "bridge vlan" |
||
| 111 | /interface bridge vlan add bridge=bridgevlans tagged=ether1 untagged=ether2,ether3 vlan-ids=20 |
||
| 112 | /interface bridge vlan add bridge=bridgevlans tagged=ether1,bridge1 vlan-ids=99 |
||
| 113 | |||
| 114 | # Management |
||
| 115 | /interface vlan add interface=bridgevlans vlan-id=99 name=MGMT |
||
| 116 | /ipv6 address add eui-64=yes advertise=no address=2a0a:e5c0:... interface=MGMT |
||
| 117 | |||
| 118 | # Last step |
||
| 119 | /interface bridge set bridge1 vlan-filtering=yes |
||
| 120 | |||
| 121 | # Might need reboot for activating the IPv6 address |
||
| 122 | /system reboot |
||
| 123 | </pre> |
||
| 124 | 7 | Nico Schottelius | |
| 125 | h2. Configuring a Mikrotik switch for integration into the network |
||
| 126 | |||
| 127 | Depending on the usage scenario, we will define a variety of bridges and assign ports to it. |
||
| 128 | |||
| 129 | * In almost all cases the uplink port will be the *sfp-sfpplus1* port. |
||
| 130 | * In almost all cases we want to apply vlan tagging to that port |
||
| 131 | * For server networks, we configure the MTU to the highest value the switch supports |
||
| 132 | ** Devices are configured with a 9200 MTU |
||
| 133 | ** So the MTU on the switch ports needs to be at least 9200 |
||
| 134 | |||
| 135 | h3. First step for all integrations |
||
| 136 | |||
| 137 | 8 | Nico Schottelius | Setup MTU of all *sfp-sfpplus* ports (plural) to 9200 and the L2MTU to 9204: |
| 138 | 1 | Nico Schottelius | |
| 139 | 8 | Nico Schottelius | Use @/interface print@ to find out the maximum MTU: |
| 140 | |||
| 141 | <pre> |
||
| 142 | [admin@mikrotik-crs326-1] > /interface print |
||
| 143 | Flags: D - dynamic, X - disabled, R - running, S - slave |
||
| 144 | # NAME TYPE ACTUAL-MTU L2MTU MAX-L2MTU MAC-ADDRESS |
||
| 145 | 0 S ether1 ether 9200 9204 10218 B8:69:F4:8E:AC:BA |
||
| 146 | 1 S ether2 ether 9200 9204 10218 B8:69:F4:8E:AC:BB |
||
| 147 | ... |
||
| 148 | 24 R sfp-sfpplus1 ether 9200 9204 10218 B8:69:F4:8E:AC:D2 |
||
| 149 | 25 sfp-sfpplus2 ether 9200 9204 10218 B8:69:F4:8E:AC:D3 |
||
| 150 | </pre> |
||
| 151 | |||
| 152 | Above is already setup, but the values differ, use the following to set it correctly: |
||
| 153 | |||
| 154 | <pre> |
||
| 155 | /interface set sfp-sfpplus1 mtu=9200 l2mtu=9204 |
||
| 156 | /interface set sfp-sfpplus2 mtu=9200 l2mtu=9204 |
||
| 157 | </pre> |
||
| 158 | |||
| 159 | 7 | Nico Schottelius | h3. Use case 1: coworking network |
| 160 | 1 | Nico Schottelius | |
| 161 | 9 | Nico Schottelius | To use the switch in a coworking network, we keep the MTU |
| 162 | |||
| 163 | 16 | Samuel Hailu | * Create a vlan interface named *vlan-coworking*: @/interface vlan add vlan-id=15 name=vlan-coworking interface=sfp-sfpplus1@ |
| 164 | ** Verify that it is created: @/interface vlan print@ |
||
| 165 | 1 | Nico Schottelius | ** Lookup the vlan-id from https://netbox.ungleich.ch/ipam/vlans/ |
| 166 | 9 | Nico Schottelius | ** The vlan will be added to *sfp-sfpplus1* |
| 167 | 16 | Samuel Hailu | * Create a bridge named *bridge-coworking*: @/interface bridge add name=bridge-coworking@ |
| 168 | ** Verify that it is created: @/interface print@ |
||
| 169 | * Add the interface *vlan-coworking* to the *bridge-coworking* as a port: @/interface vlan add interface=vlan-coworking@ |
||
| 170 | ** Verify that the port is added: @/interface vlan print@ |
||
| 171 | 15 | Nico Schottelius | * Add all ethernet ports that you need for coworking to the *bridge-coworking* |
| 172 | 16 | Samuel Hailu | ** For instance to add port 7: @/interface bridge port set bridge=bridge-coworking numbers=6@ |
| 173 | *** Find the number of the interface with @/interface bridge port print@ |
||
| 174 | 15 | Nico Schottelius | ** Verify again like you did above |
| 175 | 8 | Nico Schottelius | |
| 176 | 17 | Nico Schottelius | h3. Use case 2: server or internal network |
| 177 | |||
| 178 | Steps similar to above, BUT ensure that the MTU is set correctly on all interfaces. |
||
| 179 | |||
| 180 | * Ensure that the mtu is correct on the *sfp-sfplus* interfaces (see above) |
||
| 181 | ** This is important |
||
| 182 | * We create a bridge named |
||
| 183 | 20 | Samuel Hailu | ** *bridge-server*: @/interface bridge add name=bridge-server@ |
| 184 | ** *bridge-internal*: @/interface bridge add name=bridge-internal@ |
||
| 185 | 17 | Nico Schottelius | * We create a new vlan interface on *sfp-sfpplus1* named |
| 186 | 21 | Samuel Hailu | ** *vlan-server*: @/interface vlan add name=vlan-server interface=sfp-sfpplus1 mtu=9200@ |
| 187 | 22 | Samuel Hailu | ** *vlan-internal*: @/interface vlan add name=vlan-internal interface=sfp-sfpplus1 mtu=9200@ |
| 188 | 17 | Nico Schottelius | * Add the |
| 189 | 20 | Samuel Hailu | ** *vlan-server* interface as a port to *bridge-server*: @/interface bridge port add interface=vlan-server bridge=bridge-server@ |
| 190 | ** *vlan-internal* interface as a port to *bridge-internal*: @/interface bridge port add interface=vlan-internal bridge=bridge-internal@ |
||
| 191 | 17 | Nico Schottelius | * Verify that the MTU is correct |
| 192 | 23 | Nico Schottelius | ** On the VLAN interface: @/interface vlan print@ |
| 193 | ** On the bridge: @/interface bridge print@ |
||
| 194 | ** On the sfp-sfpplus interfaces: @/interface print@ |
||
| 195 | 17 | Nico Schottelius | |
| 196 | |||
| 197 | 19 | Nico Schottelius | <pre> |
| 198 | If the MTUs are wrong, you can encounter hanging connections, while ping (small packet) still works. Be careful to do it right. |
||
| 199 | </pre> |
||
| 200 | 17 | Nico Schottelius | |
| 201 | 25 | Nico Schottelius | h2. Typical setup for a new mikrotik-crs326 in place6 |
| 202 | |||
| 203 | You need to insert a GBIC module *BEFORE* seting mtu on the sfp-sfpplus interface |
||
| 204 | |||
| 205 | <pre> |
||
| 206 | /interface set sfp-sfpplus1 mtu=10216 l2mtu=10218 |
||
| 207 | |||
| 208 | /interface bridge add name=bridge-server |
||
| 209 | /interface vlan add name=vlan-server interface=sfp-sfpplus1 mtu=10214 vlan-id=11 |
||
| 210 | /interface bridge port add interface=vlan-server bridge=bridge-server |
||
| 211 | |||
| 212 | /interface bridge add name=bridge-internal |
||
| 213 | /interface vlan add name=vlan-internal interface=sfp-sfpplus1 mtu=10214 vlan-id=10 |
||
| 214 | /interface bridge port add interface=vlan-internal bridge=bridge-internal |
||
| 215 | |||
| 216 | 26 | Nico Schottelius | /ipv6 address add eui-64=yes advertise=no interface=bridge-internal address=2a0a:e5c0:2::/64 |
| 217 | /ipv6 address print |
||
| 218 | 25 | Nico Schottelius | |
| 219 | 26 | Nico Schottelius | </pre> |
| 220 | 25 | Nico Schottelius | |
| 221 | 8 | Nico Schottelius | h2. Update the switch to the latest version |
| 222 | |||
| 223 | (TBD for IPv6 only networks) |
||
| 224 | 30 | Nico Schottelius | |
| 225 | |||
| 226 | h2. Make switch accept router advertisements! |
||
| 227 | |||
| 228 | <pre> |
||
| 229 | [admin@mikrotik-crs236-2] > /ipv6 settings set accept-router-advertisements=yes |
||
| 230 | </pre> |
||
| 231 | |||
| 232 | FINALLY! |