[afnog] config dhcp

Geert Jan de Groot GeertJan.deGroot at xs4all.nl
Thu Sep 25 20:31:04 UTC 2008


On Thu, 25 Sep 2008 14:38:16 +0000 (GMT)  Dany Mustapha wrote:
> can you please tell me is it possible to give diffrent gateways to
> hosts in our network by using dhcp.
> i explain for example host1 & host2 must have gatway1 and host3
>  & host4 h gateway2,

It is possible, but you must know the MAC address of all the
hosts so you can add specific configurations for each host.

This is what I have with ISC DHCP - there may be newer versions
with a slightly different syntax, but I hope this gets you started:

# Subnet declaration
subnet 192.0.2.0 netmask 255.255.255.192 {
	range 192.0.2.10 192.0.2.60;
}

# Declaration for host1, using gateway1
host host1 {
	hardware ethernet 00:60:1a:01:02:03;
	fixed-address 192.0.2.1;
	option routers gateway1;
}

# Declaration for host2, using gateway1
host host2 {
	hardware ethernet 00:60:1a:04:05:06;
	fixed-address 192.0.2.2;
	option routers gateway1;
}

# Declaration for host3, using gateway2
host host3 {
	hardware ethernet 00:60:1a:07:08:09;
	fixed-address 192.0.2.3;
	option routers gateway2;
}

# Declaration for host4, using gateway2
host host4 {
	hardware ethernet 00:60:1a:0a:0b:0c;
	fixed-address 192.0.2.4;
	option routers gateway2;
}


In general, using different gateways is not a good idea, but sometimes
needs must.

Hope this helps,

Geert Jan





More information about the afnog mailing list