Problem with selective routing

Hi everyone,

I am a little at loss here. I managed to get my new Mikrotik router to connect to a wireguard server on the internet (interface=wireguard1) and now I want to route all traffice from VLAN 99 (which is 192.168.99.0/24) exclusively through this tunnel. While this works (somehow), I am getting really poor network speeds (with both the router and the wireguard server with little CPU load) and some websites on the internet will not open when accessing them from within the 192.168.99.0/24 network. Potentially, this is a misconfiguration and/or routing problem, since that is very new to me.
Also, when I create DHCP server for the 192.168.99.0/24 network, all computers connected to it (wifi1, wifi2, eth4) do not get IP addresses asigned, however, manual IP configuration works.

I have attached my current configuration - if someone can point out my mistake(s) I would greatly appreciate it!

Best,

Peter
myconfig.rsc (8.17 KB)

I would hope you are not actually connected to the internet with such UNSAFE settings.
You have opened port 80 and your winbox port to the world which is a security NO NO.
Pull the plug and change your config before proceeding.

Assuming you mean to a third party provider of VPN services.
Would have to see what the third party provider gave you for setup ( minus of course the actual external IP of their site, and actual keys, use fake numbers etc.. ) including any DNS.
Also you are half using vlans. Should not mix apples and oranges so once you go vlans go all vlans and bridge does no dhcp etc…

Mostly changes:

  • missing pool for vlan99 and other things.
    -REMOVE this static dns setting old default that needs to go…
    /ip dns static
    add address=192.168.88.1 comment=defconf name=router.lan

-missing persistent keep alive on allowed Ip settings.
-firewall rules make no sense and WHY are you allowing the whole WWW access to your router by making winbox port open???

  • by including wireguard in WAN interface list we dont need an extra Sourcenat rule, just the default rule.


    model = C53UiG+5HPaxD2HPaxD
    /interface vlan
    add interface=bridge name=vlan10 vlan-id=10
    add interface=bridge name=vlan99 vlan-id=99

    /ip pool
    add name=default-dhcp ranges=192.168.88.10-192.168.88.254
    add name=v99-dhcp ranges=192.168.99.10-192.168.99.254

    /interface bridge port
    add bridge=bridge ingress-filtering=yes frame-types=admit-priority-and-untagged interface=ether2 pvid=10
    add bridge=bridge ingress-filtering=yes frame-types=admit-priority-and-untagged interface=ether3 pvid=10
    add bridge=bridge ingress-filtering=yes frame-types=admit-priority-and-untagged interface=ether4 pvid=99
    add bridge=bridge ingress-filtering=yes frame-types=admit-priority-and-untagged interface=ether5 pvid=10
    add bridge=bridge ingress-filtering=yes frame-types=admit-priority-and-untagged interface=wifi1 pvid=99
    add bridge=bridge ingress-filtering=yes frame-types=admit-priority-and-untagged interface=wifi2 pvid=99


    /interface bridge vlan
    add bridge=bridge tagged=bridge untagged=ether2,ether3,ether5 vlan-ids=10
    add bridge=bridge tagged=bridge untagged=wifi1,wifi2,ether4 vlan-ids=99


    /interface list member
    add comment=defconf interface=vlan10 list=LAN
    add comment=defconf interface=vlan99 list=LAN
    add comment=defconf interface=ether1 list=WAN
    add interface=wireguard1 list=WAN

/interface wireguard peers
add allowed-address=0.0.0.0/0 endpoint-address=X.X.X.X endpoint-port=
51822 interface=wireguard1 name=peer1 public-key=
“XXX” persistent-keep-alive=35s

/ip address
add address=192.168.88.1/24 comment=defconf interface=vlan10 network=
192.168.88.0
add address=10.11.10.5**/24** comment=wireguard interface=wireguard1 network=
10.11.10.0
add address=192.168.99.1/24 interface=vlan99 network=192.168.99.0

/ip dhcp-server
add address-pool=default-dhcp interface=bridge name=defconf
add address-pool=v99-dhcp interface=bridge name=v99-serverf

/ip firewall nat
add action=masquerade chain=srcnat comment=“defconf: masquerade”
ipsec-policy=out,none out-interface-list=WAN

/ip route
add dst-address=0.0.0.0/0 gateway=wireguard1 routing-table=wg-de
/ip routing rule
add src-address=192.168.99.0/24 action=lookup table=wg-de

note1: Assuming you have default route enabled on IP DHCP CLIENT settings and if not will require to enter one manually.
note2: If you never want vlan99 users to use local WAN, in case the wireguard tunnel is not working then change action to: action=lookup-only-in-table

/tool mac-server
set allowed-interface-list=NONE
/tool mac-server mac-winbox
set allowed-interface-list=LAN

Final piece of the puzzle, ( perhaps more when we learn the third party advised settings ) is something that may help browsing consistency…
/ip firewall mangle
add action=change-mss chain=forward comment=“Clamp MSS to PMTU for Outgoing packets” new-mss=clamp-to-pmtu out-interface=wireguard1 passthrough=yes protocol=tcp tcp-flags=syn

Basic safe firewall ruleset.

/ip firewall filter
{ default rules to keep }
add action=accept chain=input comment=
“defconf: accept established,related,untracked” connection-state=
established,related,untracked
add action=drop chain=input comment=“defconf: drop invalid” connection-state=
invalid
add action=accept chain=input comment=“defconf: accept ICMP” protocol=icmp
add action=accept chain=input comment=
“defconf: accept to local loopback (for CAPsMAN)” dst-address=127.0.0.1

{ admin rules }
add action=drop chain=input comment=“defconf: drop all not coming from LAN”
in-interface-list=!LAN

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
{default rules to keep}
add action=fasttrack-connection chain=forward comment=“defconf: fasttrack”
connection-state=established,related hw-offload=yes
add action=accept chain=forward comment=
“defconf: accept established,related, untracked” connection-state=
established,related,untracked
add action=drop chain=forward comment=“defconf: drop invalid”
connection-state=invalid

{admin rules}
add action=accept chain=forward comment=“internet traffic” in-interface-list=LAN out-interface-list=WAN
add action=accept chain=forward comment=V99 to WG" src-address=192.168.99.0/24 out-interface=wireguard1
add action=drop chain=forward comment=“drop all else”

Thank you so much!

I have integrated your suggestions into the configuration, however, when I try to add the second DHCP server, it fails with a note, that there is already a dhcp server active for this interface.
Something I should have mentioned: the router is currently a dhcp client on my other internal network, so the ports are open for me to get in once I shoot myself in the foot, but these rules will be removed once the router is connected to the internet (which will also be as a dhcp client on metroethernet).

Unfortunately, I am still having trouble with perfromance (100 Mbit on a 1Gbit line when doing fast.com) and some pages (e.g. ookla speedtest) always give back a err_conn_reset.

See attached for the updated config.

Thanks!!
myconfig2.rsc (8.67 KB)