Community discussions

MikroTik App
 
mzanders
just joined
Topic Author
Posts: 6
Joined: Thu May 17, 2018 10:18 am

Remote IPSEC+BGP network not able to use default route on Mikrotik

Fri Mar 08, 2019 4:45 pm

Hello,
I have set up a VPC (virtual private cloud) on amazon with a site-to-site VPN connection to our office using IPSEC and BGP. I have an RB3011 in our office to do this.
This is all working: I can access EC2 instances inside the VPC from the office LAN and vice-versa.
Now, I want to be able to use the internet gateway from our office for the VPC. And it seems that somehow, the NAT is not doing his thing...

The overall configuration on amazon is similar to this:
Image

Mikrotik IP firewall configuration:
/ip firewall filter
add action=accept chain=input comment="Allow OpenVPN" dst-port=1194 protocol=tcp
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=accept chain=input comment="defconf: accept established,related" connection-state=established,related
add action=drop chain=input comment="defconf: drop all from WAN" in-interface=upstream-telenet log-prefix=drop_wan
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" connection-state=established,related
add action=drop chain=forward comment="prevent access from guest network to other networks" dst-address=10.84.0.0/16 src-address=10.0.0.0/24
add action=accept chain=forward comment="defconf: accept established,related" connection-state=established,related
add action=accept chain=forward comment="accept traffic from VPC" log=yes log-prefix=testlog src-address=10.84.0.0/18
add action=drop chain=forward comment="defconf: drop invalid" connection-state=invalid log-prefix="drop invalid forward"
add action=drop chain=forward comment="defconf:  drop all from WAN not DSTNATed" connection-nat-state=!dstnat connection-state=new in-interface=upstream-telenet
/ip firewall nat
add action=accept chain=srcnat dst-address=10.84.0.0/18 out-interface=upstream-telenet src-address=10.84.80.0/24
add action=masquerade chain=srcnat comment="defconf: masquerade" log-prefix=masq out-interface=upstream-telenet
add action=accept chain=srcnat comment="was in AWS doc, not needed appareantly" disabled=yes dst-address=169.254.20.193 src-address=169.254.20.194
Note: add action=accept chain=forward log=yes log-prefix=testlog src-address=10.84.0.0/18 >> has no effect, no counter increase during testing

Routing/BGP:
/routing bgp instance
set default as=65000 comment="was 65530"
/routing bgp network
add network=10.84.80.0/24 synchronize=no
/routing bgp peer
add default-originate=always hold-time=30s keepalive-time=10s name=BGP-vpn-037fb9882c77380f8-0 remote-address=169.254.20.193 ttl=default
The default-originate is properly advertised towards AWS, I see the route to 0.0.0.0/0 appearing in the route table on VPC.

When testing using the packet sniffer on the IP address of the EC2 instance and performing a WGET of a http page on that EC2 instance, I can see the requests appearing in the sniffer but there's no reply from the web server. For me, this proves that the tunnel and VPC configuration is OK and that there must be something going wrong on the mikrotik. But I can't seem to figure out what.
I have (temporarily) tried to disable all forward filters: no result. Adding various kinds of NAT rules also didn't help.
Obviously, I have internet access from my LAN, hence this post.

I'm a novice when it comes to all of this and something that's not clear to me is the order in which firewall filter - NAT - routing etc is performed to allow me to better debug the issue. I'm not even sure where in the chain the packet sniffer is picking up the packets. E.g. is it impacted by firewall filter?

Anybody with an idea?
Thanks!
 
mzanders
just joined
Topic Author
Posts: 6
Joined: Thu May 17, 2018 10:18 am

Re: Remote IPSEC+BGP network not able to use default route on Mikrotik

Mon Mar 11, 2019 12:34 pm

By looking at the packet flow diagram I have narrowed down the issue to the route lookup. I see the packets passing by in the dst-nat chain but they don't appear in the mangle input or mangle forward processing. So routing of the packets is going wrong somohow. Does it make a difference that these packets were received through BGP?
 
mzanders
just joined
Topic Author
Posts: 6
Joined: Thu May 17, 2018 10:18 am

Re: Remote IPSEC+BGP network not able to use default route on Mikrotik

Mon Mar 11, 2019 3:52 pm

After finding this topic: viewtopic.php?t=97626 I tried configuring the VPN connection using static routes (both sides).
The tunnel is working again but still, routing packets to the default route doesn't work.
 
mzanders
just joined
Topic Author
Posts: 6
Joined: Thu May 17, 2018 10:18 am

Re: Remote IPSEC+BGP network not able to use default route on Mikrotik  [SOLVED]

Tue Mar 12, 2019 11:09 am

It turned out that the IPSEC policy was wrong. I used the range of the local LAN addresses as src address (as per AWS instructions) but appareantly this caused trafic to !LAN to get dropped.
Now it's working fine.
 
jrgnwgnr
just joined
Posts: 2
Joined: Thu Mar 11, 2021 10:09 am

Re: Remote IPSEC+BGP network not able to use default route on Mikrotik

Sun Dec 12, 2021 9:25 am

i ham having the issue, that the vpn connection sometimes stops working.. feels random to me.
i also have the local lan range as src address in the policy. is this wrong? what did you configure instead?