Hello guys
i do remeber my first dhcp server i ever set up was a linux mahine 12 years ago
every time people say windows dhcp server ,, for vlans and i smiled
any way keep in mind , linux kernal which have support for 802.q will able to serve dhcp service also
example here :
yum install dhcpd ( for fedora or rhel /cent)
dnf install dhcpd
apt-get install dhcpd ( ubuntu or db)
step 2 . create virtual interfaces , you do no need more phy interfaces
in example to make 3 vlan ,, 10.10.10.x , 10.10.20.x , 10.10.30.x
nmcli con modify type vlan ifname vlan10 dev ens33 id 10 ip4 10.10.10.1/24 gw4 10.10.10.254
nmcli con add type vlan ifname vlan10 dev ens33 id 10 ip4 10.10.10.1/24 gw4 10.10.10.254
nmcli con add type vlan ifname vlan20 dev ens33 id 20 ip4 10.10.20.1/24 gw4 10.10.20.254
nmcli con add type vlan ifname vlan30 dev ens33 id 30 ip4 10.10.30.1/24 gw4 10.10.30.254
this for fedora or rhel latest version
if for ubuntu
command is
vconfig add ens33 10
vconfig add ens33 20
then
Configure the network settings for the VLAN interfaces:
# ip addr add 10.10.10.1/24 dev ens33.10
Bring up the VLAN interface:
# ip link set eth33.10 up
do for all interfaces in ubuntu
then check ip address ,,, you can see virutal interfaces pinging
then
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#
# option definitions common to all supported networks...
option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;
default-lease-time 600;
max-lease-time 7200;
# Use this to enble / disable dynamic dns updates globally.
#ddns-update-style none;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.
subnet 10.10.0.0 netmask 255.255.0.0 {
}
# This is a very basic subnet declaration.
subnet 10.10.10.0 netmask 255.255.255.0 {
range 10.10.10.1 10.10.10.20;
option routers 10.10.10.1;
}
subnet 10.10.20.0 netmask 255.255.255.0 {
range 10.10.20.1 10.10.20.20;
option routers 10.10.20.1;
}
subnet 10.10.30.0 netmask 255.255.255.0 {
range 10.10.30.1 10.10.30.20;
option routers 10.10.30.1;
}
save start the service and your good to go ,,, connect to trunk port of switch and check it ,,
any doubts ,, do let me know
my email :hafeezisbad@yahoo.com
tech consultant
A working configuration example from
hafeezisbad@gmail.com
Server ip : 172.27.0.10
Swtich ip / gateway ip of server : 172.27.0.100
Option domain –name servers : 172.27.0.6
Please note default vlan 172.27.0.x in this case
Switch and server need to be in default lan for communication / or else we need to trunk in case other vlan connected , we need to configure vconfig on server to communicate
For biggner I would recommend to go for the default vlan connectivity
Example :
ddns-update-style interim;
ignore client-updates;
default-lease-time 43200;
max-lease-time 43200;
authoritative;
#-----subnet mask-- broadcast-- gateway-#
option subnet-mask 255.255.255.0;
#option broadcast-address 192.168.1.1;
option routers 172.27.0.100;
option domain-name-servers 172.27.0.6;
# ----------- Server Scope and vlan1 with switches and server--------------#
subnet 172.27.0.0 netmask 255.255.255.0 {
#range 172.27.0.0 172.27.0.50;
option routers 172.27.0.1;
#option subnet-mask 255.255.255.0;
option broadcast-address 172.27.0.255;
#option domain-name-servers 172.27.0.5;
}
# ----------- clients1 Scope-vlan2-------------#
subnet 172.27.1.0 netmask 255.255.255.0 {
range 172.27.1.3 172.27.1.200;
option routers 172.27.1.1;
option subnet-mask 255.255.255.0;
option broadcast-address 172.27.1.255;
#option domain-name-servers 192.168.1.1 #
}
Save the file
Chkconfig –list dhcpd on
{ For enabling the service on all run levels }
Service dhcpd start
In case , dhcp server faild to start , check with log messages
/var/log/messages
Check for the ip helper address in layer 3 swtich , which act as dhcp-relay
Which has to be configured as 172.27.0.10
Troubleshooting Dhcp server start up error :
1) Run the Dhcp service in debug mode
2) Check the ip configuration
3) Check for syntax errors in dhcpd.conf file
4) Check for the right location of the dhcpd file
5) Ping test between the switch and server
6) Possible conflict of other dhcp server may be the issue
dhcpd in the foreground in debug mode with /usr/sbin/dhcpd -d –f
Hopefully, a DHCP server like the one we’ll be configuring will respond. Running tcpdump shows a dhcp request looks like:
17:26:02.003956 00:00:00:00:00:00 > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0×0800), length 342: 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request, length 300
You should notice DHCP running in the process (ps) list. Any problems, check syslog
Congratulations you have finally configured In easy steps