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

    Recipe for Pfsense becoming a static router for a /28 subnet

    Scheduled Pinned Locked Moved Routing and Multi WAN
    19 Posts 4 Posters 1.4k 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.
    • F
      frater
      last edited by frater

      My Pfsense router receives through PPPoE the subnet 20.0.0.1/28 with an external gateway to the the Internet.
      I would like Pfsense to route all traffic, coming and going, to devices in the 20.0.0.0/28 network to the Internet.

      What's the recipe for that?
      Configuring the PPPoE-interface is no problem and Pfsense has Internet and is a NAT-router for the LAN-interface.

      I have devices on 20.0.0.2 and 20.0.0.3 connected to a switch and I want them to have Internet using the Pfsense as its gateway.
      I don't need a firewall for the static routing part.
      I do not want to use network translation, so I want those devices configured on their WAN-address..

      The WAN-IP 20.0.0.1 is not exposed on an ethernet interface.
      How do I expose it?

      1 Reply Last reply Reply Quote 0
      • M
        m-electronics
        last edited by

        Hi, you must configure "NO-NAT" Rules for that :)

        That is managed under "Firewall -> NAT -> Outbound"

        https://docs.netgate.com/pfsense/en/latest/nat/outbound.html#working-with-manual-outbound-nat-rules

        1 Reply Last reply Reply Quote 0
        • F
          frater
          last edited by frater

          I need a bit more info than that.

          For starters the WAN-IP isn't present on any physical interface.

          Let's say I have 3 interfaces

          Physical:
          igc0 - connected to ISP, no IP present
          igc1 - LAN 192.168.10.1
          igc2 - unconfigured

          virtual:
          pppoe0 - 20.0.0.1/28

          I think it is possible to connect a switch to igc2 on which I have several devices configured with WAN-addresses in the 20.0.0.0/28 network and connect them to the Internet.
          I do NOT want to use 1:1 NAT

          I was looking for a way to bridge igc2 to pppoe0, but I can't use igc2 if it's not configured for an IP

          M 2 Replies Last reply Reply Quote 0
          • M
            m-electronics @frater
            last edited by m-electronics

            @frater Yes, it´s possible you must select the WAN (pppoe0) Interface in the NAT rule :)

            Better article: https://docs.netgate.com/pfsense/en/latest/recipes/route-public-ip-addresses.html

            1 Reply Last reply Reply Quote 0
            • M
              m-electronics @frater
              last edited by

              @frater You don´t/mustn´t need to bridge it. Thats not the correct way. You need to route the traffic and disable NAT for that.

              F 1 Reply Last reply Reply Quote 0
              • F
                frater @m-electronics
                last edited by frater

                @m-electronics

                **At least two public IP subnets must be assigned by the ISP.**
                

                The recipe you gave is not the same scenario.
                I do not have a gateway on a physical interface.

                I am assigned only 1 /29 subnet.
                The WAN-IP that I get through the PPP-interface should be the gateway to the Internet.

                It's a quite common and simple scenario from the ISP's point-of-view.
                I can do it with other routers quite easily.

                S 1 Reply Last reply Reply Quote 0
                • S
                  SteveITS Galactic Empire @frater
                  last edited by

                  @frater If I followed, to use IPs in the same subnet you would set up a virtual IP:
                  https://docs.netgate.com/pfsense/en/latest/firewall/virtual-ip-addresses.html

                  Then can use 1:1 NAT or port forward from pfSense.

                  You can't use the same subnet on two interfaces, a router doesn't know where to send the traffic.

                  Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                  When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
                  Upvote 👍 helpful posts!

                  F 1 Reply Last reply Reply Quote 0
                  • F
                    frater @SteveITS
                    last edited by frater

                    @SteveITS

                    You can't use the same subnet on two interfaces, a router doesn't know where to send the traffic.
                    

                    It's not what I'm asking.
                    I merely want the subnet I have to be linked to an ethernet interface.
                    The PPPoE-interface needs to be bridged with a classless interface. 20.0.0.1 then comes available for other devices.

                    I have 1 subnet 20.0.0.1/29
                    Pfsense takes IP 20.0.0.1

                    I know I can also take 20.0.0.2~6 with the Pfsense using Virtual IP's on the PPP-interface.
                    These different WAN-IP's can be used for catering multiple LANs.

                    I have no problem setting up all that.
                    But I now have a scenario where I want something different.
                    Something even more simple than that and it's what a lot cable modems/routers are already doing.

                    Some ISP's give you a modem/router that has, for instance 40.0.0.1/29 IP.
                    You can can connect 5 devices to that modem/router 40.0.0.2~6

                    I want a Pfsense to do exactly the same thing.
                    It receives 20.0.0.1/29 through PPPoE and I want to to connect 5 devices to it on a switch.
                    The Pfsense needs to route them to the Internet, just like an ISP modem/router with bridged subnet would.

                    I merely need to bring out the logical interface pppoe0 to a physical interface igcx, so I have 20.0.0.1 on an ethernet interface and set a static route.

                    If Pfsense can't do it, it can't. I can accept that.
                    But from a network point of view it's a totally normal scenario.

                    I have no problem setting up this (with virtual IP)

                    igc0 -> connected to fibre modem
                    igc0.6 -> created vlan6
                    pppoe -> login using pppoe on igc0.6 (20.0.0.1/29 + virtual IP 20.0.0.2)

                    igc1 -> lan1 192.168.188.1/24 (use NAT rules to use WAN IP 20.0.0.1)
                    igc2 -> lan2 192.168.168.1/24 (use NAT rules to use WAN IP 20.0.0.2)

                    Now I want to use 20.0.0.3~6 for foreign devices, but I have nothing to connect it to.

                    S M 3 Replies Last reply Reply Quote 0
                    • S
                      SteveITS Galactic Empire @frater
                      last edited by

                      @frater Sharing a subnet on two interfaces would be a bridge:
                      https://docs.netgate.com/pfsense/en/latest/bridges/index.html

                      Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                      When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
                      Upvote 👍 helpful posts!

                      F 1 Reply Last reply Reply Quote 0
                      • M
                        m-electronics @frater
                        last edited by

                        @frater I don´t understand now what you want. It is the same result when you do it with VIPs.

                        1 Reply Last reply Reply Quote 0
                        • F
                          frater @SteveITS
                          last edited by frater

                          @SteveITS

                          I can't bridge classless interfaces.

                          Tell me which interfaces I need to bridge given my last scenario!

                          I can create a logical interface with the name bridge on igc3 and give it a bogus IP IP 172.20.1.1/30
                          I can then bridge it with PPPPOE0 and connect foreign devices to igc3.

                          If it works, it works.
                          I just can't test it now as I only have remote connections with pfsenses in that scenario and it's all production.

                          And where do I tell it to route all traffic from those subnets directed to 20.0.0.1 to the Internet?

                          1 Reply Last reply Reply Quote 0
                          • S
                            SteveITS Galactic Empire @frater
                            last edited by

                            @frater said in Recipe for Pfsense becoming a static router for a /28 subnet:

                            igc1 -> lan1 192.168.188.1/24 (use NAT rules to use WAN IP 20.0.0.1)
                            igc2 -> lan2 192.168.168.1/24 (use NAT rules to use WAN IP 20.0.0.2)

                            Rereading this again, you do want NAT for the internal interface but want it to use 20.0.0.2 instead of the default 20.0.0.1? (you wrote "do not want to use network translation" originally). That would be the outbound NAT mentioned in the first reply. Add the IPs as VIPs on the WAN/PPPOE connection, and add an outbound NAT rule to translate using that IP. Here's an outbound rule translating a 192.168.x.x network to a VIP Alias on WAN:
                            a751982f-4885-4e28-9d6f-f473e48ae1fb-image.png

                            Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                            When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
                            Upvote 👍 helpful posts!

                            F 1 Reply Last reply Reply Quote 0
                            • F
                              frater @SteveITS
                              last edited by frater

                              @SteveITS

                              Rereading this again, you do want NAT for the internal interface but want it to use 20.0.0.2 instead of the default 20.0.0.1?
                              

                              No I do not want NAT.
                              I just gave that example to make clear that THAT scenario was no problem for me and I implemented quite often.
                              The 20.0.0.3~6 for foreign devices is my only problem.

                              I want static routing

                              Even a simple Fritz!Box can do it.
                              Given a /30 subnet I have 2 IP's.
                              A Fritz!Box does NAT on 1 IP and a Cisco that is connected to the Fritz!Box has the 2nd IP and routes everything through the Fritz!Box.

                              M 1 Reply Last reply Reply Quote 0
                              • M
                                m-electronics @frater
                                last edited by

                                @frater No, surely not! The FB use one address and the provider router the other! You must have a GW to send traffic to the provider!

                                F 1 Reply Last reply Reply Quote 0
                                • F
                                  frater @m-electronics
                                  last edited by frater

                                  @m-electronics

                                  Surely YES

                                  the router gets a /30 using PPPoE on a fibre connection
                                  The 2nd IP is for the Cisco.

                                  The provider's gateway is outside the /30 network
                                  The Cisco has a static IP on its WAN and has the FB as its gateway.

                                  fe33aa51-c444-4bc7-aa7d-dfb6f1b7fca7-image.png

                                  M 1 Reply Last reply Reply Quote 0
                                  • M
                                    m-electronics @frater
                                    last edited by

                                    @frater Ok, I had a think failure. Sorry for that. But for what you want static routing?

                                    F 1 Reply Last reply Reply Quote 1
                                    • F
                                      frater @m-electronics
                                      last edited by frater

                                      @m-electronics

                                      In fact I'm not getting a /29 but will be getting a /27 network and I want to give more than 25 companies an Internet connection.
                                      They all want a WAN IP without firewalling.

                                      The ISP gives me that subnet through PPPoE.
                                      I will probably do it with a Mikrotik which needs a simple configuration to do this.

                                      I was wondering if I can do it with a Pfsense.

                                      I also have a few places where I have a /29 subnet and Pfsense is a central router for a few companies (using VIP's)

                                      I would like to be prepared if a company suddenly wants a WAN-IP and do his own firewalling.
                                      I only have the subnet available on the PPPoE-interface.

                                      A 1 Reply Last reply Reply Quote 0
                                      • A
                                        andres-asm @frater
                                        last edited by andres-asm

                                        The simplest solution is to call your ISP and tell them "please I want my solution to be routed, not bridged" then they will give you a private network for the WAN side and route your network through that. Most providers can do that. Then you can configure 20.x.x.x on the "LAN side", just disable NAT altogether and you're set.

                                        Otherwise. You should be able to bridge PPPOE and and eth interface and then set an IP address of that network in the bridge interface, then set other IP addresses on your devices with gateway your pfsense.
                                        It sounds similar to what I have with OVH
                                        OVH gives me a /29 and a gateway outside of that subnet.

                                        So on my WAN I configure my IP address as a /32, and then I add a route to the gateway (yes that is what I said, and a default) and then a default through the actual gateway
                                        For example, I have:

                                        • Network: x.y.z.232/29
                                        • Gateway: x.y.z.254

                                        So I did this:

                                        route add -host x.y.z.254 -iface em0
                                        route add default x.y.z.254
                                        

                                        It's weird.... but it works

                                        A 1 Reply Last reply Reply Quote 0
                                        • A
                                          andres-asm @andres-asm
                                          last edited by

                                          @andres-asm as a follow-up, while at the beginning what I did was bridge two virtual ethernet interfaces so I could give my internal VMs public IP addresses, I ended up switching to virtual IPs attached to the wan interface and 1:1 NAT.

                                          But I get it, clients usually don't want to deal with NAT.

                                          1 Reply Last reply Reply Quote 0
                                          • First post
                                            Last post
                                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.