Skip to content

Server Client Lab

Dracarys edited this page Feb 15, 2024 · 20 revisions

Create two VMs (Server, Client) in Vmware Workstation both belong to the same Subnet

  • Create the virtual machines, I opted Alma minimal operating system and configure the settings as needed (CPU, RAM, disk size).
  • Install packages in server machine: nginx for webserver, bind for DNS, tftp for TFTP, dhcp-server for DHCP.

Network Segmentation

  • Configure the network adapter to use "Custom: Specific virtual network", I selected Custom(VMnet0).
  • Uncheck the DHCP and host adapter box in VMware Network Settings for VMnet0 under Edit > Virtual Network Editor.
  • Configure static IP addresses manually.
    • Server: IP address: 192.168.1.10/24, Default gateway: 192.168.1.1
    • Client: IP address: 192.168.1.20/24, Default gateway: 192.168.1.1
  • Ensure that both virtual machines can ping each other to verify connectivity within the same subnet.

Create a DHCP Server

To automatically assign IP addresses and other network configuration information to devices that connect to our network.

  • Configure the server under /etc/dhcp/dhcpd.config
subnet 192.168.1.0 netmask 255.255.255.0 {
    option routers 192.168.1.254;
    option subnet-mask 255.255.255.0;
    option domain-search "corp.com";
    option domain-name-servers 192.168.1.1;
    option time-offset 19800;
    option broadcast-address 192.168.1.255;
    range 192.168.1.2 192.168.1.100;
    max-lease-time 7200;
}
  • Start DHCP server
sudo systemctl start dhcpd
sudo systemctl enable dhcpd
  • Configure Firewall
sudo firewall-cmd --add-service=dhcp --permanent
sudo firewall-cmd --reload
  • Test DHCP server, boot the client machine and configure its network adapter to use DHCP.
sudo nmtui

### Under edit a connection, change IPv4 configuration to Automatic
sudo systemctl restart NetworkManager

### IP should be under specified dhcp range
ip a

Create a DNS Nameserver

To allow DHCP clients to resolve the domain name to IP addresses. Since our internal network is not connected to the internet, DNS resolution is limited to the domains and resources hosted within our internal network.

The internal DNS server will respond to DNS queries for domain names within its authoritative zones (configured in its BIND zone files). If client sends a DNS query for a domain outside of the internal network (e.g., google.com), it will typically result in a timeout or a response indicating that the domain could not be resolved.


  • Configure the BIND server to define the DNS zones under /etc/named.conf
zone "example.com" {
    type master;
    file "/var/named/example.com.zone";
};
  • Configure a forward zone file for example.com under /var/named/example.local.zone
$TTL 1d ; Default TTL (1 day)

@ IN SOA ns1.example.local. admin.example.local.(
                                  3         ; Serial
                                  1h        ; Refresh (1 hour)
                                  1h        ; Retry
                                  3w        ; Expire (3 weeks)
                                  1h )      ; Negative Cache TTL
;
@       IN      NS      ns1.example.local.
@       IN      A       192.168.1.77
ns1     IN      A       192.168.1.77
  • Start and Enable BIND
sudo systemctl start named
sudo systemctl enable named
  • Configure DHCP to Provide DNS Server Address
    option domain-search "example.local";
    option domain-name-servers 192.168.1.77;

Clone this wiki locally