Jump to content

This is the support site for Andrews & Arnold Ltd, a UK Internet provider. Information on these pages is generally for our customers but may be useful to others, enjoy!

User:TomJepp/RouterOS L2TP: Difference between revisions

 
(12 intermediate revisions by the same user not shown)
* firewalling
 
This guide was written by the A&A community & was tested using RouterOS 7.16.1 on a [https://mikrotik.com/product/hap_ax2 hAP ax2]. It should also work well with other affordableseveral Mikrotik routers - such as the [https://mikrotik.com/product/hap_ac2 hAP ac2], the [https://mikrotik.com/product/RB750Gr3 hEX], or the [https://mikrotik.com/product/hex_2024 hEX Refresh]. Very low end routers such as the [https://mikrotik.com/product/RB941-2nD hAP Lite] may work, but are not recommended.
 
It was tested with the following routers:
* '''[https://mikrotik.com/product/rb4011igs_rm RB4011]'''
* '''[https://mikrotik.com/product/hap_ax2 hAP ax2]'''
* '''[https://mikrotik.com/product/hap_ac2 hAP ac2]'''
 
This config should also work well with other affordable Mikrotik routers - such as the [https://mikrotik.com/product/RB750Gr3 hEX], or the [https://mikrotik.com/product/hex_2024 hEX Refresh]. Very low end routers such as the [https://mikrotik.com/product/RB941-2nD hAP Lite] may work, but are not recommended.
 
The RouterOS documentation is available at: https://help.mikrotik.com/docs/
 
If you get stuck, feel free to ask for help on A&A's IRC channel: https://www.aa.net.uk/etc/contact/#irc
 
== TODO ==
* v4 blocks?
 
== Before you start ==
# Go to '''IP, Firewall''' and select the '''Filter Rules''' tab.
# Add a new rule using the '''+''' button. Set the following fields:
## For '''General, Chain''', select: "input".
## For '''General, ProtocolConnection State''',: tick "established" selectand "icmprelated".
## For '''Action, Action''', select: "accept".
## Use the '''Comment''' button to add a comment saying "input: allow allestablished ICMP& related traffic".
## Save the rule with '''OK'''
# Add a new rule:
## '''General, Chain''': "forward"
## '''General, Connection State''': tick "established" and "related"
## '''Action, Action''': "accept"
## '''Comment''': "forward: allow established & related traffic"
## Save the rule with '''OK'''.
# Add a new rule:
## '''General, Chain''': "input".
## '''General, Protocol''': "icmp".
## '''Action, Action''': "accept".
## '''Comment''': "input: allow all ICMP".
## Save the rule with '''OK'''.
# Add a new rule:
## '''Action, Action''': "accept"
## '''Comment''': "forward: allow all from L2TP LAN"
## Save the rule with '''OK'''.
# Add a new rule:
## '''General, Chain''': "input"
## '''General, Connection State''': tick "established" and "related"
## '''Action, Action''': "accept"
## '''Comment''': "input: allow established & related traffic"
## Save the rule with '''OK'''
# Add a new rule:
## '''General, Chain''': "forward"
## '''General, Connection State''': tick "established" and "related"
## '''Action, Action''': "accept"
## '''Comment''': "forward: allow established & related traffic"
## Save the rule with '''OK'''.
# Add a new rule:
 
# Go to '''IPv6, Firewall''' and select the '''Filter Rules''' tab.
# Add a new rule using the '''+''' button. Set the following fields:
## '''General, Chain''': "input"
## '''General, Connection State''': tick "established" and "related"
## '''Action, Action''': "accept"
## Use the '''Comment''' button to add a comment saying "input: allow established & related traffic"
## Save the rule with '''OK'''
# Add a new rule:
## '''General, Chain''': "forward"
## '''General, Connection State''': tick "established" and "related"
## '''Action, Action''': "accept"
## '''Comment''': "forward: allow established & related traffic"
## Save the rule with '''OK'''.
# Add a new rule:
## '''General, Chain''': "input".
## '''Action, Action''': "accept"
## '''Comment''': "forward: allow all from L2TP LAN"
## Save the rule with '''OK'''.
# Add a new rule:
## '''General, Chain''': "input"
## '''General, Connection State''': tick "established" and "related"
## '''Action, Action''': "accept"
## '''Comment''': "input: allow established & related traffic"
## Save the rule with '''OK'''
# Add a new rule:
## '''General, Chain''': "forward"
## '''General, Connection State''': tick "established" and "related"
## '''Action, Action''': "accept"
## '''Comment''': "forward: allow established & related traffic"
## Save the rule with '''OK'''.
# Add a new rule:
# Click '''Enable'''.
# Change to the '''Status''' tab, and you should see your L2TP tunnel connect. You should see your assigned IPv4 address in the '''Local Address''' field, and "81.187.81.187" in '''Remote Address'''.
 
If your tunnel came up successfully you should now be connected. Devices plugged into ether2, ether3, ether4, and ether5 should be able to get IP addresses automatically, and their traffic should be sent down the L2TP tunnel.
 
If you have an IPv4 block to use, then continue on to the next section - otherwise, you're done!
 
== Using a public IPv4 block ==
set allow-remote-requests=yes
/ip firewall filter
add action=accept chain=input comment="input: allow all ICMP" protocol=icmp
add action=accept chain=input comment="input: allow all from L2TP LAN" \
in-interface=bridge-l2tp-lan
add action=accept chain=forward comment="forward: allow all from L2TP LAN" \
in-interface=bridge-l2tp-lan
add action=accept chain=input comment=\
"input: allow established & related traffic" connection-state=\
"forward: allow established & related traffic" connection-state=\
established,related
add action=accept chain=input comment="input: allow all ICMP" protocol=icmp
add action=accept chain=input comment="input: allow all from L2TP LAN" \
in-interface=bridge-l2tp-lan
add action=accept chain=forward comment="forward: allow all from L2TP LAN" \
in-interface=bridge-l2tp-lan
add action=drop chain=input comment="input: drop all remaining traffic"
add action=drop chain=forward comment="forward: drop all remaining traffic"
add address=2001:8b0:db8:acb1::1 interface=bridge-l2tp-lan
/ipv6 firewall filter
add action=accept chain=input comment=\
"input: allow established & related traffic" connection-state=\
established,related
add action=accept chain=forward comment=\
"forward: allow established & related traffic" connection-state=\
established,related
add action=accept chain=input comment="input: allow all ICMP" protocol=icmpv6
add action=accept chain=forward comment="forward: allow all ICMP" protocol=\
add action=accept chain=forward comment="forward: allow all from L2TP LAN" \
in-interface=bridge-l2tp-lan
add action=accept chain=input comment=\
"input: allow established & related traffic" connection-state=\
established,related
add action=accept chain=forward comment=\
"forward: allow established & related traffic" connection-state=\
established,related
add action=drop chain=input comment="input: drop all remaining traffic"
add action=drop chain=forward comment="forward: drop all remaining traffic"
set auto-upgrade=yes
</pre>
 
== Performance tests ==
 
There are many factors that affect the throughput you'll achieve, but I have tested the following devices using the 600mbit Business L2TP service over a gigabit fibre connection with several different speed tests, including:
* A&A's librespeed tester at https://speedtest.aa.net.uk/
* iperf3 to A&A's iperf3 server
* Steam downloads
* HTTP downloads from major CDNs such as Fastly
* speedtest.net
* ThinkBroadband's speed tester
 
Please note that these tests all use large packet sizes, and if your use cases use small packets you can expect lower performance. There is no substitute for testing with your own usecase!
 
Using these tests, I achieved the following results:
* '''[https://mikrotik.com/product/rb4011igs_rm RB4011]''': typically hits the 600mbit service cap with single or multiple connections
* '''[https://mikrotik.com/product/hap_ax2 hAP ax2]''': approx 450mbit max with a single connection, 500-600mbit with multiple connections
* '''[https://mikrotik.com/product/hap_ac2 hAP ac2]''': approx 350-400mbit max with a single connection, approx 450mbit max with multiple connections
94

edits