# dhcpd conf question



## tessio (Apr 15, 2011)

Hello,
I'm trying to configure my dhcp3 server to give ip leases based on which interface the request came from..

Something like:

```
shared-network real-virtual {
 subnet 10.1.1.0 netmask 255.255.255.0 {
   option routers 10.1.1.1;
 }
 subnet 192.168.56.0 netmask 255.255.255.0 {
   option routers 192.168.56.1;
 }
 pool {
  #allow if from em0
   range 10.1.1.100 10.1.1.250;
 }
 pool {
   #allow if from em1
   range 192.168.56.100 192.168.56.250;
 }
}
```

Is this even possible?


----------



## phoenix (Apr 15, 2011)

```
shared-network real-virtual {
 subnet 10.1.1.0 netmask 255.255.255.0 {
   range 10.1.1.100 10.1.1.250
   option routers 10.1.1.1;
   option subnet-mask 255.255.255.0;
   option domain-name-servers 10.1.1.1;
   etc ...;
 }
 subnet 192.168.56.0 netmask 255.255.255.0 {
   range 192.168.56.100 192.168.56.250;
   option routers 192.168.56.1;
   option subnet-mask 255.255.255.0;
   option domain-name-servers 10.1.1.1;
   etc ...;
 }
}
```

dhcpd will compare the IP of the interface the packet came in on with the *subnet* value listed in the *shared-network* stanza.  If it finds a match, then it issues an IP from the *range*.


----------



## tessio (Apr 16, 2011)

It worked as you said.. Thanks a lot!


----------

