IP address depending on interface

Simon Hobson dhcp1 at thehobsons.co.uk
Thu Aug 23 10:51:28 UTC 2007


Martins Purins wrote:

>I have two subnets
>vlan10
>subnet 10.1.1.0 netmask 255.255.255.0 {
>         option routers 10.1.1.254;
>         option subnet-mask 255.255.255.0;
>}
>
>vlan 11
>subnet 10.1.2.0 netmask 255.255.255.0 {
>         option routers 10.1.2.254;
>         option subnet-mask 255.255.255.0;
>}
>
>And host entries with pairs
>host mambo {
>  hardware ethernet aa:aa:aa:aa:aa:aa;
>  fixed-address 10.1.1.4;
>}
>host mambo {
>  hardware ethernet aa:aa:aa:aa:aa:aa;
>  fixed-address 10.1.2.77;
>}
>When host connect from vlan 10 he receive correct address 10.1.1.4, but when
>he connect from vlan 11 he receive also address 10.1.1.4.

Then something else is wrong in your config - can you post the whole thing ?

>So is it possible set ip address based on interface from which request come.

Yes, that is automagic

>For example if request come from DHCPDISCOVER from aa:aa:aa:aa:aa:aa via
>10.1.1.254 then ip is 10.1.1.4 and if from 10.1.2.254 then ip is 10.1.2.77.

Yes, the above should do it - apart from the fact that the hostnames 
must be different for the two declarations. IIRC you should be able 
to do :

host mambo {
  hardware ethernet aa:aa:aa:aa:aa:aa;
  fixed-address 10.1.1.4,10.1.2.77;
}




More information about the dhcp-users mailing list