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

    InterVLAN routing with DHCP on layer 3 switch

    Scheduled Pinned Locked Moved DHCP and DNS
    6 Posts 3 Posters 924 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.
    • V
      vikd
      last edited by vikd

      I'm trying to setup InterVLAN routing on a Layer 3 switch (HP1920) with DHCP behind my pfSense box.

      My setup is following:

      pfSense with VLAN30 + VLAN40
      VLAN30 - 10.10.30.1/24 - Gateway:10.10.30.2 (manually added in pfsense for VLAN30)
      VLAN40 - 10.10.40.1/24 - Gateway:10.10.40.2 (manually added in pfsense for VLAN40)
      =>connected to HP-switch through a trunk port which obtains 10.10.30.2(VLAN30) and 10.10.40.2(VLAN40) as IP-addresse for those 2 VLAN-interfaces.

      Clients connected to the HP Switch and obtained IP through DHCP:
      Client1 on VLAN30 - 10.10.30.10
      Client2 on VLAN40 - 10.10.40.10

      The routing table on the HP-switch is following:

      10.10.30.0	255.255.255.0	Direct	0	10.10.30.2	Vlan-interface30
      10.10.40.0	255.255.255.0	Direct	0	10.10.40.2	Vlan-interface40
      

      The goal is to use the Layer3 switch to route VLAN30 and VLAN40 without pfSense.

      I did manage to accomplish this by manually setting up the IP-addresses on the clients to
      10.10.30.10/24 GW:10.10.30.2 (Address of VLAN30 interface on the HP swith manually added in pfSense) and
      10.10.40.10/24 GW:10.10.40.2 (Address of VLAN40 interface on the HP swith manually added in pfSense)

      The problem is, that when I enable DHCP, the correct IP-addresses are obtained, but the gateway is set to 10.10.30.1 on all VLAN-interfaces on the switch!
      So, the routing is obviously done by pfSense.

      I seem to miss some basics in either pfSense or HP switch, so what am I doing wrong ?

      pfSense is acting as DHCP-server, do I need to do DHCP-relay on the HP switch in order it for work properly ?

      P.S. Do I need to do any additional static routing on HP switch as it seems it's already routing the correct networks ?

      bingo600B 1 Reply Last reply Reply Quote 0
      • bingo600B
        bingo600 @vikd
        last edited by

        @vikd

        Did you specify the switch ip address , in the Gateway field , in the DHCP server settings ?
        Else it would default to the pfSense interface.

        c32c64c4-783a-432d-bf73-bba9aac5ede4-image.png

        If you find my answer useful - Please give the post a šŸ‘ - "thumbs up"

        pfSense+ 23.05.1 (ZFS)

        QOTOM-Q355G4 Quad Lan.
        CPUĀ  : Core i5 5250U, Ram : 8GB Kingston DDR3LV 1600
        LANĀ  : 4 x Intel 211, DiskĀ  : 240G SAMSUNG MZ7L3240HCHQ SSD

        V 1 Reply Last reply Reply Quote 0
        • V
          vikd @bingo600
          last edited by vikd

          @bingo600
          Hmm, no I actually didn't, I did specify (or so I thought) the GW for VLANs here:

          46c9bd1a-2442-43d0-ab63-1860357732a6-image.png

          Does it need to be done in both places then ?

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

            @vikd um if vlans our downstream of pfsense, why would they be setup in pfsense?

            You should have no setup of interfaces for vlans/networks that are downstream of pfsense. The only thing listed would be the gateways and routes to those network.

            It would not be possible for pfsense to hand out IPs via dhcp of some downstream networks.

            The network that connects to your downstream router (your L3 switch doing routing) would be the transit network.. There should be no hosts on this network.

            Here is how you do a downstream router...

            pfsense-layer-3-switch.png

            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

            V 1 Reply Last reply Reply Quote 0
            • V
              vikd @johnpoz
              last edited by

              @johnpoz
              I'm not sure I understand your point. Why is it a problem having VLANs and interfaces in pfsense and not possible to hand out IPs via DHCP ?
              My switch does not have the DHCP capability.
              Additionally, I need most of my VLANs to be able to access Internet in addition to also having access to the VPN-tunnel which is going to be run on pfSense.

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

                @vikd said in InterVLAN routing with DHCP on layer 3 switch:

                VLANs and interfaces in pfsense and not possible to hand out IPs via DHCP ?

                You can hand out IPs to network directly attached to pfsense, you can not hand out dhcp to a L2 network this is not directly connected to pfsense.

                If your routing these downstream of pfsense, then that is a different L2 network.

                All of your downstream networks would use pfsense to get to the internet, or could even use it for dns, etc. etc.. Or other networks hanging off of pfsense. But once you create downstream networks that router to other downstream networks at your L3 switch, this is not a directly attached network to pfsense and you wouldn't be able to hand out dhcp to those networks. If your switch can not do dhcp, then its a pretty crappy L3 switch.. But if it can not - then run something else on each of the L2 networks for dhcp. Or run something that allows you to create dhcp pools for non connected network - stand alone version of isc dhcpd can do this, etc. Then you would setup IP helper or dhcp relay on your switch to point to this dhcpd. But pfsense can not do dhcp for network that are not directly attached at the L2 level.

                If your wanting to route at your downstream and put pfsense in the same L2 as these networks, ie you created the vlan - then your going to run int asymmetrical routing problems unless you host route on all of your devices saying to get to some other network talk to yoru switch, but to get to internet talk to pfsense, etc..

                The drawing I attached shows you how to properly do downstream networks, and also have a network or networks attached directly to pfsense..

                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
                • First post
                  Last post
                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.