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

    Connecting Two Subnets with pfSense

    Scheduled Pinned Locked Moved Routing and Multi WAN
    26 Posts 5 Posters 20.9k 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.
    • johnpozJ
      johnpoz LAYER 8 Global Moderator
      last edited by

      Yeah I don't get why you want to use 3 pfsense boxes/vms for just 2 subnets?

      In your setup out of the box pfsense nats, so you wouldn't want that, etc.

      To setup your 3 pfsense scenario your top pfsense would use 2 transit networks to connect to your 2 downstream pfsense boxes, and you would disable nat on them.  You would just setup routing on your top pfsense to your 2 downstream networks.  But again you could have hundreds of networks hanging off 1 pfsense.  The only reason for more than 1 would be a carp setup for redundancy or different geographic locations.

      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.7.2, 24.11

      1 Reply Last reply Reply Quote 0
      • T
        tyh
        last edited by

        @elliotcater:

        So from the PFSense1 Box, there are 2 LAN interfaces? Are they bridged interfaces or is there a hypothetical switch in-between.

        To be honest, it looks like you could do all of this with just 1 pfsense box?

        Your image is almost correct. Please see below:

        I did think that perhaps this would be possible with a single pfSense box. I ended up with three by following a guide on connecting subnets with physical routers, of which there were three. I wanted to emulate that setup before delving further into the possibilities offered with pfSense.

        1 Reply Last reply Reply Quote 0
        • johnpozJ
          johnpoz LAYER 8 Global Moderator
          last edited by

          "following a guide on connecting subnets with physical routers,"

          Yeah that was some moron using some stupid off the shelf user wifi router.. Not even running some sort of 3rd party firmware that supports vlans.

          There is no reason at all do that sort of setup to have 2 networks.  You only need 1 pfsense to do this.  Your making a mess trying to do it the way your doing it.

          You need your 1 pfsense.  Add an opt interface, or as many opt interfaces you want for how ever many networks you want.  Connect these opt interfaces to different vswitches.  Setup your firewall rules on your opt interfaces = done.

          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.7.2, 24.11

          1 Reply Last reply Reply Quote 0
          • T
            tyh
            last edited by

            @johnpoz:

            "following a guide on connecting subnets with physical routers,"

            Yeah that was some moron using some stupid off the shelf user wifi router.. Not even running some sort of 3rd party firmware that supports vlans.

            There is no reason at all do that sort of setup to have 2 networks.  You only need 1 pfsense to do this.  Your making a mess trying to do it the way your doing it.

            You need your 1 pfsense.  Add an opt interface, or as many opt interfaces you want for how ever many networks you want.  Connect these opt interfaces to different vswitches.  Setup your firewall rules on your opt interfaces = done.

            Okay, thank you; I will try with a single VM. Do I need to set up any static routing in addition to the firewall rules?

            1 Reply Last reply Reply Quote 0
            • E
              elliotcater
              last edited by

              As long as you have your allow from any rules on the 2 lans they should talk to each other no dramas. Static routes just describe to your router, which gateway to use to get a hop closer to the destination network. Of course it all becomes moot if your router has all the gateways.

              1 Reply Last reply Reply Quote 0
              • johnpozJ
                johnpoz LAYER 8 Global Moderator
                last edited by

                No you do not need to setup any routes, pfsense knows how to route between its attached networks ;)

                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.7.2, 24.11

                1 Reply Last reply Reply Quote 0
                • T
                  tyh
                  last edited by

                  Thanks guys, I'll fire up a VM this morning and let you know how I get on.

                  1 Reply Last reply Reply Quote 0
                  • T
                    tyh
                    last edited by

                    Okay, I set up a new single pfSense VM. Please see below to see how it's set up:

                    I also created a firewall rule, although it's probably configured incorrectly. There is a default rule to allow LAN to any, so I figured I needed one for OPT1. Following the default rule, I set interface to OPT1, protocol to any, source to OPT1 net, and destination to any.

                    I can ping OPT1 (192.168.2.1) from Client 1 (192.168.1.100), but I cannot ping Client 2 (192.168.2.100) from Client 1. The same happens from Client 2 to Client 1.

                    I'm sure the firewall rule is at fault. Can anyone point me in the right direction?

                    Thanks

                    1 Reply Last reply Reply Quote 0
                    • V
                      viragomann
                      last edited by

                      Are the client configured to use the correct gateway?
                      Client1 - 192.168.1.1
                      Client2 - 192.168.2.1

                      Have you set a gateway in the pfSense LAN and OPT interface config? That must not be set.

                      1 Reply Last reply Reply Quote 0
                      • johnpozJ
                        johnpoz LAYER 8 Global Moderator
                        last edited by

                        And is there a software firewall on these vms?  Windows for example blocks ping..

                        Out of the box the lan rules on pfsense would allow you to ping opt2 network.  If its not answering points to firewall on that client..

                        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.7.2, 24.11

                        1 Reply Last reply Reply Quote 0
                        • T
                          tyh
                          last edited by

                          @viragomann:

                          Are the client configured to use the correct gateway?
                          Client1 - 192.168.1.1
                          Client2 - 192.168.2.1

                          Have you set a gateway in the pfSense LAN and OPT interface config? That must not be set.

                          The clients have the correct gateway set via DHCP, and neither LAN nor OPT have a gateway set. Both clients have internet access and can ping both LAN and OPT interfaces, but not each other.

                          @johnpoz:

                          And is there a software firewall on these vms?  Windows for example blocks ping..

                          Out of the box the lan rules on pfsense would allow you to ping opt2 network.  If its not answering points to firewall on that client..

                          I'll check, but I've never had the Windows Firewall block pings before. Unless that's because I'm normally pinging from the same subnet.

                          1 Reply Last reply Reply Quote 0
                          • T
                            tyh
                            last edited by

                            @johnpoz:

                            And is there a software firewall on these vms?  Windows for example blocks ping..

                            Out of the box the lan rules on pfsense would allow you to ping opt2 network.  If its not answering points to firewall on that client..

                            That was it, thanks! I disabled the firewall on both clients, and they were able to ping each other.

                            1 Reply Last reply Reply Quote 0
                            • johnpozJ
                              johnpoz LAYER 8 Global Moderator
                              last edited by

                              There you go see 1 pfsense and you have 2 network, you could have as many networks as you wanted that your VM host would be able to support ;)  Just using 1 pfsense vm.

                              Now if you wanted you could start getting fun with it and use it to play with vlan tagging, etc. vs your actual physical network simulation you have going on now.  Using port groups on your vswitch and then setting up the vlans on the 1 vm nic you have connected to pfsense, etc.

                              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.7.2, 24.11

                              1 Reply Last reply Reply Quote 0
                              • T
                                tyh
                                last edited by

                                @johnpoz:

                                There you go see 1 pfsense and you have 2 network, you could have as many networks as you wanted that your VM host would be able to support ;)  Just using 1 pfsense vm.

                                Now if you wanted you could start getting fun with it and use it to play with vlan tagging, etc. vs your actual physical network simulation you have going on now.  Using port groups on your vswitch and then setting up the vlans on the 1 vm nic you have connected to pfsense, etc.

                                I am interested in VLANs and have no experience with them, so I think I will try setting something like that up next.

                                1 Reply Last reply Reply Quote 0
                                • B
                                  bheemboy1
                                  last edited by bheemboy1

                                  In anyone is still interested, here is how I got it to work with 3 pfsense setup.

                                  I wanted to setup an environment where I have a datacenter and a remote lab.
                                  All machines in the datacenter have the domain datacenter.home.arpa.
                                  All machines in the lab have the domain lab1.home.arpa.
                                  I wanted machines in the lab to be able to reach machines in the datacenter.

                                  pfSense1:

                                  • Hostname: pfSense
                                  • Domain: home.arpa
                                  • WAN (dhcp)
                                  • LAN: 192.168.0.1
                                    • Block private networks and loopback addresses: Unchecked
                                  • Forward packets for datacenter subnet 192.168.2.0/24 to datacenter router - 192.168.0.2
                                    • Added gateway
                                      • Name: datacentergw
                                      • Interface: LAN
                                      • Gateway: 192.168.0.2
                                    • Added static route
                                      • Network: 192.168.2.0/24
                                      • gateway: datacentergw

                                  pfSense2:

                                  • Hostname: pfSense
                                  • Domain: datacenter.home.arpa
                                  • WAN: 192.168.0.2 (static)
                                  • LAN: 192.168.2.1
                                    • Block private networks and loopback addresses: Unchecked
                                  • NAT
                                    • Forward ICMP and TCP/UDP from source:192.168.0.0/16, destination: LAN net to LAN Address
                                      • This automatically added necessary firewall rules as well

                                  pfSense3:

                                  • Hostname: pfSense
                                  • Domain: lab1.home.arpa
                                  • WAN: 192.168.0.3
                                  • LAN: 192.168.3.1
                                    • Block private networks and loopback addresses: Unchecked
                                  • DNS
                                    • Add a domain override for datacenter.home.arpa and send its queries to datacenter DNS: 192.168.2.1
                                  • DHCP
                                    • Set lab1.home.arpa;datacenter.home.arpa as DNS Search
                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post
                                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.