Junos OS

 View Only
last person joined: yesterday 

Ask questions and share experiences about Junos OS.
  • 1.  Wrong subnet with multiple dhcp relay

    Posted 08-02-2023 08:22

    Good day,

    We have a network with 1 dhcp server.  and some EX4300's

    to make it simple. lets say we have 3 networks

    vlan 1  192.168.1.0

    vlan 2  192.168.2.0

    vlan 3  192.168.3.0

    The dhcp server is  192.168.1.200 so no need for a dhcp relay in this subnet

    so i added 2 extra pools to the dhcp server

    and on the switch we added 2 dhcp relays

    forwarding-options {
        dhcp-relay {
            server-group {
                Lan2 {
                    192.168.1.200;
                }
    			Lan3 {
                    192.168.1.200;
                }
            }
            group Lan2 {
                active-server-group Lan2;
                interface irb.2;
            }
    		group Lan3 {
                active-server-group Lan3;
                interface irb.3;
            }
        }
    }

    now all clients get an ip.... thats great. however they get an ip from a random pool (192.168.2.x and 192.168.3.x) 

    so some clients get an ip in theire own vlan and are working. but most of the devices get an ip from the wrong subnet.

    had this problem in the past with an srx as dhcp (no relay) and solved this 

    set system services dhcp-local-server requested-ip-interface-match

    However this didn't solve it this time.

    for now i disabled the 3th vlan and the 3th dhcp pool (also the 1th since we dont realy need this)

    now we have 1 pool with 1 relay server and everything works fine.

    How can we make sure the dhcp relay chooses the right pool.



  • 2.  RE: Wrong subnet with multiple dhcp relay

    Posted 08-03-2023 09:28

    Hey,

    For your situation, you should use "giaddr" as the source address for your requests. Then, configure the DHCP server to match these addresses and allocate IP addresses from the appropriate pool.

    Your configuration should resemble the following:

    forwarding-options {
        dhcp-relay {
            server-group {
                Lan2 {
                    192.168.1.200;
                }
                Lan3 {
                    192.168.1.200;
                }
            }
            group Lan2 {
                active-server-group Lan2;
                interface irb.2;
                overrides {
                    replace-ip-source-with giaddr;
                }
            }
            group Lan3 {
                active-server-group Lan3;
                interface irb.3;
                overrides {
                    replace-ip-source-with giaddr;
                }
            }
        }
    }

    The next step involves matching a different giaddr and assigning IP addresses from the appropriate pool. Your DHCP configuration should appear as follows:

    class "lan2" {
        match if (binary-to-ascii(10, 8, ".", packet(24, 4)) = "192.168.2.1");
    }

    class "lan3" {
        match if (binary-to-ascii(10, 8, ".", packet(24, 4)) = "192.168.3.1");
    }

    shared-network lan-pools {
        subnet 192.168.2.0 netmask 255.255.255.0 {
            pool {
                allow members of "lan2";
                default-lease-time 240;
                max-lease-time 120;
                range 192.168.2.2 192.168.2.254;
                option subnet-mask 255.255.255.0;
                option routers 192.168.2.1;
                option domain-name-servers 8.8.8.8;
            }
        }

        subnet 192.168.3.0 netmask 255.255.255.0 {
            pool {
                allow members of "lan3";
                range 192.168.3.2 192.168.3.254;
                option subnet-mask 255.255.255.0;
                option routers 192.168.3.1;
                option domain-name-servers 8.8.8.8;
            }
        }
    }

    Hope this helps!



    ------------------------------
    Ivan Ivanov
    ------------------------------



  • 3.  RE: Wrong subnet with multiple dhcp relay

    Posted 08-03-2023 14:22

    Hey Ivan,

    Thanks for the complete answer.

    i see i didn't include a crucial part to my question. the dhcp server is a windows server.

    and it looks like they need the  GIADDR (as stated on this site)

    https://learn.microsoft.com/en-us/windows-server/networking/technologies/dhcp/dhcp-subnet-options

    I need to create an testlab but i think you have pointed me to the correct location.

    small change. you can add the override on the dhcp-relay level so you don't need to add it to all pools.

    I will let you know when it works.



  • 4.  RE: Wrong subnet with multiple dhcp relay

    Posted 08-03-2023 18:42

    Hey there,

    You're absolutely right! Adding the override can be done at the DHCP relay level. 

    From what I understand of your current setup, if your DHCP server can talk to the IP addresses set up on those VLANs (192.168.2.1, 192.168.3.1, etc.), you're pretty much good to go. All you need to do is set up the right pools in your Windows DHCP server. Once that's done, your clients will get their IP addresses from the correct pools. 

    Regards,



    ------------------------------
    Ivan
    ------------------------------



  • 5.  RE: Wrong subnet with multiple dhcp relay

    Posted 11-14-2023 05:54

    So Today i was back at the customer. and finally solved the issue.

    the GIADDR  is one part of the solution. and must not be ignored.

    however. to group all scopes there was an Super scope created.  according to the wizard this is just a administrative function.

    however it turns out that it is way more than that. after removing the scopes from the super scope. everything start working as expected.

    thanks for solving one part of the puzzle and the effort in finding the issue.