• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Simple Problem: Static route not working

Scheduled Pinned Locked Moved Routing and Multi WAN
5 Posts 2 Posters 5.2k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P
    pwnell
    last edited by Oct 24, 2017, 8:40 PM

    I have 4 interfaces: WAN, LAN1, LAN2, LAN3.  Lets ignore LAN2 and LAN3 as they are not relevant.

    WAN is standard interface with gateway to internet.  I am using NAT.

    LAN1 is standard LAN interface, no default GW set.  Subnet 192.168.0.0/24.

    I have a Linux router on LAN1 at IP 192.168.0.50.  It has been configured to forward packets to another network accessible via VPN.  On that machine I establish the VPN, and have packets route to that VPN's subnet.  I know this works perfectly because I just replaced my Unifi USG firewall with a pfSense, and with the USG and a static route it worked fine.

    I added this gateway to pfSense:

    Interface: LAN1, Address: IPv4, Gateway: 192.168.0.50 and everything else unchecked.

    And this static route:

    Destination network:  10.0.0.0/24
    Gateway: 192.168.0.50

    I dial up to VPN on 192.168.0.50.  I can connect from 192.168.0.50 to a machine on the VPN's subnet 10.0.0.10 just fine, and everything works.

    I try to connect to 10.0.0.10 from another machine on my LAN1, say 192.168.0.30.  I can connect fine, and the traffic flows for about 20 seconds or so.  Then it just stops.  Firewall logs show (I have an allow any from LAN1 to any rule):

    Oct 24 13:35:13 LAN1 Default deny rule IPv4 (1000000103) 192.168.0.30:55961 10.0.0.10:22 TCP:R
    Oct 24 13:35:03 LAN1 Default deny rule IPv4 (1000000103) 192.168.0.30:51082 10.0.0.10:22 TCP:A

    etc.  No rules that I add to the firewall seems to fix this.

    Please help?

    1 Reply Last reply Reply Quote 0
    • P
      pwnell
      last edited by Oct 24, 2017, 9:07 PM

      After doing some diagnostic tracing I have an idea what is going on:

      1. Host 192.168.0.30 sends packet to 10.0.0.10 port 22.  Since that subnet is not local, the firewall gets it (i.e. default GW).
      2. The firewall has a routing table and gateway, it forwards the packet out on same interface but to host 192.168.0.50, the GW to the VPN
      3. GW receives it, looks up its masquerading table and sends on the packet to the VPN.
      4. Host on VPN gets packet, and replies to 192.168.0.30 via 192.168.0.50.
      5. Packet arrives on tun0 interface on 192.168.0.50 GW, and GW sees the target (192.168.0.30) is on same subnet, so it does NOT go through firewall, but gets sent via the switch directly to 192.168.0.30.
      6. After 30 seconds or so the state table times out on pfSense and it tears down the connection.  192.168.0.30 can no longer send to 10.0.0.10 until a new connection is established.

      Fine - two questions:

      1. Why did the USG appliance not have this issue?  That is the only variable here - the only item I changed.
      2. How do I fix this?

      1 Reply Last reply Reply Quote 0
      • P
        pwnell
        last edited by Oct 24, 2017, 9:13 PM

        For anyone else as stupid as me - I ran into the same n00b mistake as I did a while ago, the USG clearly handled this some how and hid the truth from me:

        https://forum.pfsense.org/index.php?topic=135256.msg740959

        1 Reply Last reply Reply Quote 0
        • P
          pwnell
          last edited by Oct 25, 2017, 7:53 PM

          PS: For anyone with similar issue - I fixed it by checking the option under Advanced - Firewall and Networking: Bypass firewall rules for traffic on the same interface.

          Not 100% sure whether this is safe for my configuration but it works.

          1 Reply Last reply Reply Quote 4
          • J
            johnpoz LAYER 8 Global Moderator
            last edited by Oct 29, 2017, 9:12 AM

            Wouldn't it be simpler to just create the vpn client connection on pfsense directly… Vs what is a hairpin and asymmetrical routing mess that you have to bypass rules on your interface, etc..

            Other solution is to put this vpn endpoint on transit network connected to pfsense, so you remove the asymmetrical routing..  You could still have hairpins depending on where you put the transit vlan or its own physical interface and what other vlans are using the transit to get to this downstream machine.

            An intelligent man is sometimes forced to be drunk to spend time with his fools
            If you get confused: Listen to the Music Play
            Please don't Chat/PM me for help, unless mod related
            SG-4860 24.11 | Lab VMs 2.8, 24.11

            1 Reply Last reply Reply Quote 0
            5 out of 5
            • First post
              5/5
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
              This community forum collects and processes your personal information.
              consent.not_received