Junos OS

 View Only
last person joined: 23 hours ago 

Ask questions and share experiences about Junos OS.
  • 1.  DHCP Option 121, multiple destinations

    Posted 12-21-2021 05:43

    Hi,
    I'm trying to configure DHCP option 121 (Classless Staci Route Option) on MX platform that acts as DHCP Server. I'm able to push only one destination route using the next configuration:

    dhcp-attributes {
        option 121 array ip-address [ 24.192.168.10 10.240.0.1 ];
    }

    monitor traffic interface from the router:

    Client-Ethernet-Address 00:50:02:00:03:00
    Vendor-rfc1048 Extensions
    Magic Cookie 0x63825363
    DHCP-Message Option 53, length 1: ACK
    Lease-Time Option 51, length 4: 86400
    Subnet-Mask Option 1, length 4: 255.255.240.0
    Server-ID Option 54, length 4: 10.240.0.1
    Classless-Static-Route Option 121, length 8: (192.168.10.0/24:10.240.0.1)


    I'm not able to add one more destination with the same next-hop, it's just not being added in the configuration itself and it's not being pushed to the DHCP Client as well:
    set dhcp-attributes option 121 array ip-address 24.192.168.11
    set dhcp-attributes option 121 array ip-address 10.240.0.1

    router# show
    network 10.240.0.0/20;
    range range {
    low 10.240.0.2;
    high 10.240.0.254;
    }
    dhcp-attributes {
       option 121 array ip-address [ 24.192.168.10 10.240.0.1 24.192.168.11 ];
    }

    It only works if I add a different next-hop for the second destination:
    set dhcp-attributes option 121 array ip-address 24.192.168.11
    set dhcp-attributes option 121 array ip-address 10.240.0.2

    dhcp-attributes {
       option 121 array ip-address [ 24.192.168.10 10.240.0.1 24.192.168.11 10.240.0.2 ];
    }

    Result:
    Client-Ethernet-Address 00:50:02:00:03:00
    Vendor-rfc1048 Extensions
    Magic Cookie 0x63825363
    DHCP-Message Option 53, length 1: ACK
    Lease-Time Option 51, length 4: 86400
    Subnet-Mask Option 1, length 4: 255.255.240.0
    Server-ID Option 54, length 4: 10.240.0.1
    Classless-Static-Route Option 121, length 16: (192.168.10.0/24:10.240.0.1),(192.168.11.0/24:10.240.0.2)


    Does anyone have any ideas on how to configure multiple destinations with the same next-hop?



    ------------------------------
    Kind regards,
    VASILE GORBATOVSCHI
    ------------------------------


  • 2.  RE: DHCP Option 121, multiple destinations
    Best Answer

     
    Posted 12-21-2021 18:15
    Option 121 isn't an array or list of IP addresses, it's a length code followed by one or more destination descriptors and  next-hop pairs. In JUNOS I think you need to hand-craft a  hex string. 

    For routes
    192.168.10/24 next-hop 10.240.0.1
    192.168.11/24 next-hop 10.240.0.1

    192.168.10/24 next-hop 10.240.0.1 = 18 C0 A8 0A 0A F0 00 01
    192.168.11/24 next-hop 10.240.0.1 = 18 C0 A8 0B 0A F0 00 01

    Length = 16 bytes

    +  access {
    +      address-assignment {
    +          pool test {
    +              family inet {
    +                  dhcp-attributes {
    +                      option 121 hex-string 1018C0A80A0AF0000118C0A80B0AF00001;
    +                  }
    +              }
    +          }
    +      }
    +  }
    ​

    That said, I'm not running dhcp here that I can test this with,




  • 3.  RE: DHCP Option 121, multiple destinations

    Posted 12-22-2021 05:51
    Edited by Annie Moncure 12-22-2021 08:32

    Hi @smicker,
    Thank you for the reply, I made it work! For everyone else who has this problem, the solution is here:


    Then you get the entire hex string from the first prefix and next-hop and second and concatenate. Then adding them as option 121 hex-string and it works:

    network 10.240.0.0/20;
    range range {
        low 10.240.0.2;
        high 10.240.0.254;
    }
    dhcp-attributes {
        option 121 hex-string 18C0A80A0AF0000118C0A80B0AF00001;
    }


    Result from the router:

    09:31:59.207556  In IP (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto: UDP (17), length: 384) 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:50:02:00:03:00, length 300, xid 0xdc8e9656, Flags [none]
    	  Client-Ethernet-Address 00:50:02:00:03:00
    	  Vendor-rfc1048 Extensions
    	    Magic Cookie 0x63825363
    	    DHCP-Message Option 53, length 1: Request
    	    Requested-IP Option 50, length 4: 10.240.0.2
    	    Hostname Option 12, length 20: "user-virtual-machine"
    	    Parameter-Request Option 55, length 18:
    	      Subnet-Mask, BR, Time-Zone, Default-Gateway
    	      Domain-Name, Domain-Name-Server, Option 119, Hostname
    	      Netbios-Name-Server, Netbios-Scope, MTU, Classless-Static-Route
    	      NTP, Classless-Static-Route, Classless-Static-Route-Microsoft, Static-Route
    	      Option 252, NTP
    09:31:59.207922 Out IP (tos 0x0, ttl  64, id 20586, offset 0, flags [none], proto: UDP (17), length: 327) 10.240.0.1.67 > 10.240.0.2.68: BOOTP/DHCP, Reply, length 299, xid 0xdc8e9656, Flags [none]
    	  Your-IP 10.240.0.2
    	  Client-Ethernet-Address 00:50:02:00:03:00
    	  Vendor-rfc1048 Extensions
    	    Magic Cookie 0x63825363
    	    DHCP-Message Option 53, length 1: ACK
    	    Lease-Time Option 51, length 4: 86400
    	    Subnet-Mask Option 1, length 4: 255.255.240.0
    	    Server-ID Option 54, length 4: 10.240.0.1
    	    Classless-Static-Route Option 121, length 16: (192.168.10.0/24:10.240.0.1),(192.168.11.0/24:10.240.0.1)


    And the result from the host:




    ------------------------------
    Kind regards,
    VASILE GORBATOVSCHI
    ------------------------------



  • 4.  RE: DHCP Option 121, multiple destinations

    Posted 12-27-2022 13:01
    Hi @VASILE GORBATOVSCHI

    Does this also support larger than /24? Like an IP /32 with 4 hex numbers?
    Will /16 imply a prefix of only 2 hex numbers? I guess the system should do so, otherwise the netmask wouldn't be asked of course. But it's still a guess.

    Thanks in advance.

    Kind regards,
    Kris Beyers

    ------------------------------
    ICT-department CMB
    ------------------------------



  • 5.  RE: DHCP Option 121, multiple destinations

    Posted 12-29-2022 04:07
    Edited by Juniper Community Admin 12-29-2022 09:24
      |   view attached
    Hi @ICT-department CMB​,

    The prefix written in decimal needs to be converted in HEX, taking into consideration that the first value is the prefix length and then the prefix itself. 
    Note: Every value must be composed of 2 characters, which means that if you have a value of decimal 1 then you will write it in HEX as "01"


    ------------------------------
    Kind regards,
    VASILE GORBATOVSCHI
    ------------------------------

    Attachment(s)



  • 6.  RE: DHCP Option 121, multiple destinations

    Posted 12-29-2022 04:23
    Hello @ICT-department CMB,
    The prefix written in decimal needs to be converted into a prefix in HEX, taking into consideration that the first value is the prefix length and then the prefix itself. 
    Note: Every value must be composed of 2 characters, which means that if you have a value of decimal 1 then you will write it in HEX as "01"

    ------------------------------
    Kind regards,
    VASILE GORBATOVSCHI
    ------------------------------