Option to respond with a different pool in Freeradius DHCP based on interface

Durand fabrice fdurand at inverse.ca
Tue Feb 7 20:00:48 CET 2017


Hello Nataniel,

i worked a little bit on freeradius dhcp for another project and i did 
something like that:

listen {
     type = dhcp
     ipaddr = 0.0.0.0
     src_ipaddr = 192.168.0.1
     port = 67
     interface = eth0
     broadcast = yes
     virtual_server = dhcp.eth0
}

listen {
     type = dhcp
     ipaddr = 0.0.0.0
     src_ipaddr = 192.168.1.1
     port = 67
     interface = eth1
     broadcast = yes
     virtual_server = dhcp.eth1
}


server dhcp.eth0 {
  dhcp DHCP-Discover {
....
}
server dhcp.eth1 {
  dhcp DHCP-Discover {
....
}

A listener per interface and a virtual_server for each interfaces.

Regards
Fabrice

Le 2017-02-07 à 13:51, Nataniel Klug a écrit :
> Hello again,
>
> It didn't work in the way I tought it would be. I need to test the
> interface that the DHCP-Discover come from but I am not being able to make
> that happen. The DHCP-Discover come like this:
>
>
> Received DHCP-Discover of Id f018203b from 0.0.0.0:68 to 255.255.255.255:67
> 0: 01 01 06 00 f0 18 20 3b 00 00 80 00 00 00 00 00
> 16: 00 00 00 00 00 00 00 00 00 00 00 00 00 50 56 b8
> 32: bb 95 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 48: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 64: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 96: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 112: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 128: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 144: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 176: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 192: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 208: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 224: 00 00 00 00 00 00 00 00 00 00 00 00 63 82 53 63
> 240: 35 01 01 37 06 01 79 03 21 06 2a 0c 08 4d 69 6b
> 256: 72 6f 54 69 6b 3d 07 01 00 50 56 b8 bb 95 ff 00
> 272: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 288: 00 00 00 00 00 00 00 00 00 00 00 00
>          DHCP-Opcode = Client-Message
>          DHCP-Hardware-Type = Ethernet
>          DHCP-Hardware-Address-Length = 6
>          DHCP-Hop-Count = 0
>          DHCP-Transaction-Id = 4028112955
>          DHCP-Number-of-Seconds = 0
>          DHCP-Flags = Broadcast
>          DHCP-Client-IP-Address = 0.0.0.0
>          DHCP-Your-IP-Address = 0.0.0.0
>          DHCP-Server-IP-Address = 0.0.0.0
>          DHCP-Gateway-IP-Address = 0.0.0.0
>          DHCP-Client-Hardware-Address = 00:50:56:b8:bb:95
>          DHCP-Message-Type = DHCP-Discover
>          DHCP-Parameter-Request-List = DHCP-Subnet-Mask
>          DHCP-Parameter-Request-List = DHCP-Classless-Static-Route
>          DHCP-Parameter-Request-List = DHCP-Router-Address
>          DHCP-Parameter-Request-List = DHCP-Static-Routes
>          DHCP-Parameter-Request-List = DHCP-Domain-Name-Server
>          DHCP-Parameter-Request-List = DHCP-NTP-Servers
>          DHCP-Hostname = "MikroTik"
>          DHCP-Client-Identifier = 0x01005056b8bb95
>
>
> And for this request I need to send an specific pool and update info. This
> came from my eth2 interface. Any ideas?
>
>
>
> Atenciosamente,
>
> *Nataniel Klug* | nataniel.klug at gmail.com
>
> 2017-02-07 13:42 GMT-02:00 Nataniel Klug <nataniel.klug at gmail.com>:
>
>> Solved with an "if" statement:
>>
>>
>> if(DHCP-DHCP-Server-Identifier == 10.192.0.5) {
>>          update control {
>>                  &Pool-Name := "dhcp_ftth"
>>          }
>> } else {
>>          update control {
>>                  &Pool-Name := "gestao"
>>          }
>> }
>>
>>
>> Atenciosamente,
>>
>> *Nataniel Klug* | nataniel.klug at gmail.com
>>
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html



More information about the Freeradius-Users mailing list