Embedded software development and testing
Friday, 2 November 2012
How to enable DHCP Server in Linux Fedora core 16 for both IPv4 and IPv6
How to enable DHCP Server in Linux Fedora core 16 for both IPv4 and IPv6
We need to run two instances of dhcp to serve IPv4 and IPv6 separately, also we should have two config files for this.
1) yum install dhcp-common
yum install dhcp
2) cd /etc/dhcpd/
Copy sample files
# cp /usr/share/doc/dhcp*/dhcpd.conf.sample dhcpd.conf
#cp /usr/share/doc/dhcp*/dhcpd6.conf.sample dhcpd6.conf
3) configure the subnets for both IPv4 and IPv6 in config files
# vim /etc/dhcp/dhcpd.conf
subnet 192.16.2.0 netmask 255.255.255.0 {
range 192.16.2.10 192.16.2.80;
option routers 192.168.2.1;
option broadcast-address 192.168.2.255;
default-lease-time 600;
max-lease-time 7200;
}
# vim /etc/dhcp/dhcpd6.conf
subnet6 2001:db8:1:0::/64 {
range6 2001:db8:1:0::10 2001:db8:1:0::80;
range6 2001:db8:1:0:: temporary;
prefix6 2001:db8:1:0:: 2001:db8:1:0:: /64;
# Override of the global definitions,
# works only when a resource (address or prefix) is ass
# option dhcp6.name-servers 3ffe:501:ffff:101:200:ff:fe00
}
Save both the files
4) Start the servers
dhcpd -4 -cf /etc/dhcp/dhcpd.conf
dhcpd -6 -d -cf /etc/dhcp/dhcp6.conf
Got error-> "Can't open lease file /usr/local/var/db/dhcp6.lease"
5) vim /etc/dhcp/dhcpd6.conf'
change log path :
dhcpv6-lease-file-name "/var/lib/dhcpd/dhcpd6.leases";
6) Generate blank file
touch /var/lob/dhcpd/dhcpd6.leases
7) Kill the servers, if running and start again the servers
dhcpd -4 -cf /etc/dhcp/dhcpd.conf
dhcpd -6 -d -cf /etc/dhcp/dhcp6.conf
8) Verify by making any Windows 7 Windows PC as IPv6 Client, it should get the ip address from this Server.
Keep Learning, Keep Breaking !!!!