In my lab i will be using ubuntu server as my dhcp server and centos a sthe dhcp client
sudo apt install isc-dhcp-server
for recovery purposes
sudo mv dhcpd.conf dhcpd.conf.bak
sudo vim dhcpd.conf
# Default lease timedefault-lease-time28800;max-lease-time86400;# Home lab networksubnet172.16.1.0netmask255.255.255.0{range172.16.1.100172.16.1.200;optionsubnet-mask255.255.255.0;optionrouters127.16.1.100;optiondomain-name"homelab.lan";optiondomain-name-serversns1.homelab.lan;}
Now i have to add a network interface inside my Vmware setting for ubuntu server machine
A network interface with ens37 name has been added to this machine ( same thing to do for centos machine)
Netplan is responsible for network configuration in my machine:
sudo vim /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'network:ethernets:ens33:addresses:-192.168.1.5/24nameservers:addresses:-8.8.8.8search: []routes:-to:defaultvia:192.168.1.1ens37:addresses:-172.16.1.100/24nameservers:addresses:-192.168.1.9search: []version:2
As you can see, i have added a network interface configuration for ens37
Note: I didn’t add a route to the gateway because this will issue a conflict between this interfaces Instead I am planning to use my ubuntu server as a router too and let the forwarding from ens37 to ens33 so any client that takes address from this interface will reach the internet via my home router (not ubuntu server = 192.168.1.1)
And you can see that i have put the default route for these clients to be the same interface that gives dhcp which is ens37=172.16.1.100