Hi Vasilis,
Let’s take it step by step…
If you can’t configure your LHG-LTE18 in modem/passthrough mode you should at least be able to configure port forwarding, right? If so we’ll use that to get access to certain servers behind the RB5009UG+S+IN router and to certain services (e.g. VPN server) on the RB5009UG+S+IN router. With port forwarding configured on your LHG-LTE18 it becomes “transparant” on the related ports and your router becomes accessible as if it was connected directly to the WAN. You will be stuck with double NATing but that shouldn’t be a major problem (it will just add an additional “HOP” in the routing that’s all).
If your RB5009UG+S+IN router comes pre-configured out of the box that should already be a good starting point to start with. If not (my CCR1016-12G comes completely ‘empty’ out of the box, but most smaller routers do have a default config that includes a WAN, LAN, DHCP client for WAN, DHCP server for LAN, NATing and basic Firewall rules pre-installed) you’ll have to do the basic configuring yourself. If however the router is pre-configured it should already work correctly behind your LHG-LTE18 (just make sure you use the correct WAN port!).
If not, here’s step by step how you can configure your RB5009UG+S+IN router for BARE ESSENTIALS config that gives you:
- A WAN port with a fixed (WAN) IP address <= needs to be from the subnet on the LAN side of your LHG-LTE18!
- A Flat LAN (w/o any VLANs or other advanced L2./L3 features) just to allow you to get the basic stuff up and and running like:
- L2 communication between all the devices connected to the LAN ports
- DHCP service to distribute IP addresses and DNS references for non-server clients
- Internet access via standard NATing
- A basic Firewal Rule Set based on the ‘Define what is allowed and drop all the rest’ approach
- Port forwarding
- An “Off Bridge Management Port” that allows you to connect to your router if you somehow locked yourself out after making some error in the config <= via the port’s MAC address
I used the following configuration on a MT CCR1036-12G-4S behind my regular MT CCR1016-12G to simulate your situation (router behind a router). The subnet behind the first router is 192.168.88.0/24 so I choose for a 10.0.1.0/24 LAN subnet behind the second router. I also choose to use a fixed IP address on the WAN port of the 2nd router, such that this one never changes, This is needed in order to allow ‘fixed’ port forwarding on the first router (=LHG-LTE18 in your case). It’s also possible to configure a DHCP client on the WAN port (of the 2nd router) and normally this should result in always receiving the same IP address, which is (theoretically) as good as a fixed IP address <= the 'dynamic IP address will be linked with the MAC address of the WAN port of the 2nd router and should remain unchanged (unless you change the LHG-LTE18 into something else, replace it with a new one, update the firmware(?)… <= so there’s always a risk that it would change). This would actually be easier to configure compared to a real fixed IP address, as the latter requires extra config on different locations: besides configuring a fixed IP address on the WAN port you also need to add DNS references on the DHCP server for the LAN and an explicit route pointing to the Default Gateway of the subnet between the two routers (= 192.168.88.1) for 0.0.0.0/0 <= all this is done automatically when using a DHCP client on the WAN port…
Step 1: Define the WAN, LAN and (Off Bridge) Management Ports. It’s good practice to change the name of the eth/sfp(+) ports such that it’s clear:
- How the port is configured
- What device is attached to it
- With which port (on that device) it connects
In my example below I choose as follows:
- sfp1 = WAN port <= I suggest you use ether8 on your RB5009UG+S+IN router
- sfp2-4 = NOT USED <= N/A on your RB5009UG+S+IN router
- ether1-11 = LAN ports <= I suggest you use sfp1 and ether1-6 on your RB5009UG+S+IN router
- ether12 = Off Bridge Management Port <= I suggest you use ether7 on your RB5009UG+S+IN router
/interface ethernet
set [ find default-name=ether1 ] l2mtu=1590 name="Ether 01 - LAN Port 01 | NAS - Port 1"
set [ find default-name=ether2 ] l2mtu=1590 name="Ether 02 - LAN Port 02 | Server XYZ - LAN 2"
set [ find default-name=ether3 ] l2mtu=1590 name="Ether 03 - LAN Port 03 | My Notebook - Ethernet Port"
set [ find default-name=ether4 ] l2mtu=1590 name="Ether 04 - LAN Port 04 | WiFi Acces Point \"Living Room\" - Eth 01"
set [ find default-name=ether5 ] l2mtu=1590 name="Ether 05 - LAN Port 05 | "
set [ find default-name=ether6 ] l2mtu=1590 name="Ether 06 - LAN Port 06 | "
set [ find default-name=ether7 ] l2mtu=1590 name="Ether 07 - LAN Port 07 | "
set [ find default-name=ether8 ] l2mtu=1590 name="Ether 08 - LAN Port 08 | "
set [ find default-name=ether9 ] l2mtu=1590 name="Ether 09 - LAN Port 09 | "
set [ find default-name=ether10 ] l2mtu=1590 name="Ether 10 - LAN Port 10 | "
set [ find default-name=ether11 ] l2mtu=1590 name="Ether 11 - LAN Port 11 | "
set [ find default-name=ether12 ] l2mtu=1590 name="Ether 12 - Off Bridge Management Port 01 | Management PC - Ethernet Port"
set [ find default-name=sfp1 ] advertise=10M-full,100M-full,1000M-full l2mtu=1590 name="SFP 01 - WAN Port 01 | LHG-LTE18 - LAN Port 1"
set [ find default-name=sfp2 ] advertise=10M-full,100M-full,1000M-full disabled=yes l2mtu=1590 name="SFP 02 - NOT USED"
set [ find default-name=sfp3 ] advertise=10M-full,100M-full,1000M-full disabled=yes l2mtu=1590 name="SFP 03 - NOT USED"
set [ find default-name=sfp4 ] advertise=10M-full,100M-full,1000M-full disabled=yes l2mtu=1590 name="SFP 04 - NOT USED"
Step 2: Create a LAN Bridge, add all the LAN ports and create a WAN and LAN Interface List (we will use them in the FW rules)
/interface bridge
add name="Bridge 01 - LAN"
/interface bridge port
add bridge="Bridge 01 - LAN" hw=no interface="Ether 01 - LAN Port 01 | NAS - Port 1"
add bridge="Bridge 01 - LAN" hw=no interface="Ether 02 - LAN Port 02 | Server XYZ - LAN 2"
add bridge="Bridge 01 - LAN" hw=no interface="Ether 03 - LAN Port 03 | My Notebook - Ethernet Port"
add bridge="Bridge 01 - LAN" hw=no interface="Ether 04 - LAN Port 04 | WiFi Acces Point \"Living Room\" - Eth 01"
add bridge="Bridge 01 - LAN" hw=no interface="Ether 05 - LAN Port 05 | "
add bridge="Bridge 01 - LAN" hw=no interface="Ether 06 - LAN Port 06 | "
add bridge="Bridge 01 - LAN" hw=no interface="Ether 07 - LAN Port 07 | "
add bridge="Bridge 01 - LAN" hw=no interface="Ether 08 - LAN Port 08 | "
add bridge="Bridge 01 - LAN" hw=no interface="Ether 09 - LAN Port 09 | "
add bridge="Bridge 01 - LAN" hw=no interface="Ether 10 - LAN Port 10 | "
add bridge="Bridge 01 - LAN" hw=no interface="Ether 11 - LAN Port 11 | "
add bridge=*12 interface="Ether 12 - Off Bridge Management Port 01 | Management PC - Ethernet Port"
/interface list
add name=WAN
add name=LAN
/interface list member
add interface="Bridge 01 - LAN" list=LAN
add interface="SFP 01 - WAN Port 01 | LHG-LTE18 - LAN Port 1" list=WAN
Step 3: Add IP addresses on the bridge (= LAN Default Gateway address) and the WAN Port:
- LAN Default Gateway address = 10.0.1.1 <= choose according to your preference, but keep it different from the LAN subnet of your LHG-LTE18!
- WAN Port address = 192.168.88.50 <= needs to be from the LAN subnet of your LHG-LTE18! <= change accordingly!
/ip address
add address=10.0.1.1/24 comment=LAN interface="Bridge 01 - LAN" network=10.0.1.0
add address=192.168.88.50/24 comment=WAN interface="SFP 01 - WAN Port 01 | LHG-LTE18 - LAN Port 1" network=192.168.88.0
Step 4: Add DHCP for LAN (<= change according to your preference for LAN subnet AND the actual DNS servers from your provider!)
I specified following DNS server addresses:
- 10.0.1.1 <= the Default Gateway of the LAN subnet
- 192.168.88.1 <= The Default Gateway for the WAN subnet (= the Default Gateway for the LAN of the LHG-LTE18)
- 195.130.130.4 <= DNS Server #1 of my Internet Provider <= change according to yours!
- 195.130.131.4 <= DNS Server #2 of my Internet Provider <= change according to yours!
/ip pool
add name="DHCP Pool 01 - LAN" ranges=10.0.1.64/27
/ip dhcp-server
add address-pool="DHCP Pool 01 - LAN" interface="Bridge 01 - LAN" lease-time=1d name="DHCP Server 01 - LAN"
/ip dhcp-server network
add address=10.0.1.0/24 comment=LAN dns-server=10.0.1.1,192.168.88.1,195.130.130.4,195.130.131.4 gateway=10.0.1.1 netmask=24
Step 5: Configure Firewall according to the ‘Define what is allowed and drop all the rest’ approach
/ip firewall address-list
add address=10.0.1.0/24 list=LAN
/ip firewall filter
add action=accept chain=input comment="MikroTik Default Firewall Configuration - Allow Input for \"established\", \"related\" and \"untracked\" traffic" connection-state=established,related,untracked
add action=drop chain=input comment="MikroTik Default Firewall Configuration - Drop Input for \"invalid\" traffic" connection-state=invalid
add action=accept chain=input comment="MikroTik Default Firewall Configuration - Accept ICMP (Ping)" protocol=icmp
add action=accept chain=input comment="Allow access to any services from router like DNS and NTP" in-interface-list=LAN
add action=drop chain=input comment="Drop anything else..." log-prefix=DROP_INPUT
add action=fasttrack-connection chain=forward comment="MikroTik Default Firewall Configuration - Fasttrack" connection-state=established,related hw-offload=yes
add action=accept chain=forward comment="MikroTik Default Firewall Configuration - Allow Forward for \"established\", \"related\" and \"untracked\" traffic" connection-state=established,related,untracked
add action=drop chain=forward comment="MikroTik Default Firewall Configuration - Drop Forward for \"invalid\" traffic" connection-state=invalid
add action=accept chain=forward comment="Allow Internet traffic" in-interface-list=LAN out-interface-list=WAN
add action=accept chain=forward comment="Allow port forwarding" connection-nat-state=dstnat
add action=drop chain=forward comment="Drop anything else..." log-prefix=DROP_FORWARD
Step 6: add NAT and an example for port forwarding <= change according to your needs
/ip firewall nat
add action=masquerade chain=srcnat comment="MikroTik Default Firewall Configuration - Masquerade" out-interface-list=WAN
add action=dst-nat chain=dstnat comment="Example of Port Forwarding for FTP Server on IP Address 10.0.1.100" dst-port=989 in-interface="Ether 12 - Off Bridge Management Port 01 | Management PC - Ethernet Port" protocol=tcp to-addresses=10.0.1.100 to-ports=989
Step 7: add a default route that points to the Default Gateway of the LHG-LTE18 LAN subnet! <= modify accordingly!
/ip route
add disabled=no dst-address=0.0.0.0/0 gateway=192.168.88.1 routing-table=main suppress-hw-offload=no
Here’s a copy of such a basic router config on my CCR1016. You can use it as a reference to create yours.
Basic Router - Bare Essentials.rsc (6.9 KB)
Do not connect the switch yet, just connect some clients to the bridged Ethernet ports on the router (<= we will configure the switch in the next steps)
Once you have Internet working behind your router on a normal PC that gets its IP and DNS addresses via DHCP from the router let me know and we’ll go to the next steps.
Please also configure some port forwarding on BOTH your LHG-LTE18 AND your RB5009UG+S+IN router and check if you can reach your server (behind the RB5009UG+S+IN router) <= that should theoretically work w/o any problem. In the final solution I propose to use a VPN that terminates on the RB5009UG+S+IN router via port forwarding on the LHG-LTE18 <= this will require some other ports to be forwarded, but the principle remains the same. <= this will allow you to use DynDNS and connect a ‘management VPN’ from your remote location, “through” the port forwarded LHG-LTE18, AND terminates on your RB5009UG+S+IN router. From there you will be able to access any VLAN that is configured on the router (via FW rule that allows access to ALL VLAN). You can then configure a different VPN for your friends that puts them in a different VLAN compared to your ‘management VPN’ for which you can limit access to only certain VLANs (and corresponding devices) and even certain destination ports…
I checked out what possibilities there are on the LHG-LTE18 and according to https://help.mikrotik.com/docs/display/ROS/LTE#LTE-PassthroughExample it should be possible to configure it in Passthrough on ether1 and use ether2 to retain access via a second link to your router. The connecting port on your B5009UG+S+IN router for the passthrough should then be configured as DHCP client and will receive the actual public IP on it, resulting in the ideal config! I would think it should also be possible to inject the passthrough on a VLAN interface (on ether1). It shouldthen be possible to add additionnal VLANs for a second passtrough from a second APN and a Management link. As I don’t have an LHG-LTE18 I can’t configure / test it though…
Here is a YouTube video https://www.youtube.com/watch?v=cij5d42232w&ab_channel=MikrotikIndonesia-Citraweb where they explain how you can re-gain access to your LHG-LTE18 (for management/configuration) from WinBox AFTER you have enabled/configured passthrough on the LHG-LTE18. There are actually 3 posibilities:
- Connect to the LHG-LTE18 via the 2nd ether2 port <= this is unpractical as it will require a second ethernet cable/port on your B5009UG+S+IN or access to your LHG-LTE18 if you connect directly with your PC…
- Using the RoMON tool (you need to activate it on both the LHG-LTE18 AND the B5009UG+S+IN router <= works good, but requires some extra steps to connect
- Using a dedicated (Management) VLAN <= looks like the best option!
Good luck!
Bruno