9 Build a Simple Local Area Network with DHCP running on Tiny Core Linux

Mathew J. Heath Van Horn, PhD

A Local Area Network (LAN) has many definitions, depending on who you ask. They can be defined by geography, function, or electrical connections. In this book, we typically use the term “LAN” to specify a few end devices connected to the same switch. This is a gross oversimplification of LANs, but simplification is helpful when exploring larger concepts. Consider how we use logs to represent exponential equations or ask veterans in the audience to stand for recognition. Both actions are simplifications of greater meaning.

In this lab, we show you how to make a fundamental LAN with DHCP that won’t stress your host machine’s resources.

Phase 0 – Professional Alignment

Enterprise networks depend on reliable network services to automatically connect users and devices. In this chapter, you will build your first local area network (LAN) and configure Dynamic Host Configuration Protocol (DHCP) services using Tiny Core Linux. These foundational networking skills are essential for designing, deploying, and administering enterprise networks.

DCWF Work Roles

The knowledge and skills developed in this chapter align with the following Department of Defense Cyber Workforce Framework (DCWF) work roles:

  • 511 – Network Operations Specialist
  • 441 – Network Services Specialist
  • 531 – Systems Administrator

NICE Work Roles

This chapter supports competencies associated with the following NICE Workforce Framework for Cybersecurity work roles:

  • Network Operations Specialist
  • Network Services Specialist
  • Systems Administrator

Professional Skills

By completing this chapter, you will begin developing the ability to:

  • Build and configure a basic enterprise local area network.
  • Deploy and configure DHCP services to automate IP address assignment.
  • Connect network clients and verify network communication.
  • Configure and validate network interface settings.
  • Troubleshoot IP addressing and connectivity issues.
  • Document and validate network configurations before deployment.

What You’ll Be Able to Do

After completing this chapter, you should be able to:

  • Build a functional LAN using GNS3 network devices and virtual machines.
  • Configure a Tiny Core Linux system to provide DHCP services.
  • Verify that client devices automatically receive valid IP configuration information.
  • Test network connectivity between hosts using standard networking tools.
  • Troubleshoot common DHCP configuration and client connectivity issues.
  • Document the completed network topology and its addressing scheme for future laboratory exercises.

 

Learning Concepts

  • Create a functional LAN with:
    • 1 switch
    • 2 PCs
    • 1 DHCP server

Prerequisites

Deliverables

  • None – this is a preparatory lab for other labs

resources

Contributors and Testers

  • Kyle Wheaton, Cybersecurity Student, ERAU-Prescott

Phase I – Initial Setup

Initial setup involves creating a workspace, segmenting it, and then labeling its components.

By the end of this chapter, your network should look like the following:

Expected final product
Figure 17 – The final network dia
  1. Ensure you have completed the prerequisites before starting the lab
  2. Open Oracle VirtualBox Manager
  3. Make a full clone of the TinyCoreLinux VM
    1. Right-click on the machine and select Clone
      Clone the TC VM
      Figure 2 – Clone the TC VM
    2. Rename it to “TC-red” and select the option to generate new MAC addresses, then click Next
    3. Select Full Clone, then click Finish
      Cloning settings
      Figure 3 – cloning settings
  4. Right-click on the TC-red VM and click on settings
  5. Navigate to “Network” and change the network adapter 1 settings to Generic Driver and UDPTunnel, then click OK
    change network settings
    Figure 4 – change network settings
  6. Start GNS3 and start a new blank project. Name it anything you like, but for this example, we are calling it Simple LAN
  7. Add the TC-red VM to the GNS3 appliances – Change its symbol to a Red Server
  8. In the GNS3 toolbar ribbon, click on the Draw a Rectangle tool and click the workspace to place a rectangle
    draw a rectangle
    Figure 5 – draw a rectangle
  9. You can use the mouse to resize the rectangle at any time
    change rectangles properties
    Figure 6 – change the rectangle’s properties
  10. Change the properties of the rectangle by right-clicking on the edge and selecting Style
    1. Some people use a fill color, and some don’t
    2. Change the border color to a primary color (we are using red)
    3. Change the Border width to 6 px
    4. Click apply, then click ok
      change rectangle color
      Figure 7 – change rectangle color
  11. GNS3 uses layers for its graphics. Generally, the shapes are at a higher layer than the connectors. This means that anything you put in the box may not be seen. So you can change the box’s layer now or at any time by right-clicking on the shape and selecting Lower one layer
    lower one layer
    Figure 8 – lower one layer
  12. Place the following inside the red rectangle
    1. Ethernet Switch
    2. Two (2) VPCS
    3. TC-red VM
  13. Connect the devices to the switch
  14. Use the note tool – next to the shape tool – to add a new note of “Red Network 192.168.1.0/24”
  15. Use the note tool to add a new note of “.250” next to the TC-Red VM
    build the network
    Figure 9 – build the network
  16. Start all devices

Phase II – Configure DHCP on TC-red VM

Tiny Core Linux comes with a DHCP service. However, we will have to type quite a bit to make it work. When you finish this lab, you can use these instructions to create a default TC-DHCP VM that you can clone whenever you need a lightweight DHCP server.

NOTE: Most errors encountered by testers were due to typos. Be careful, and everything should work fine.

  1. Navigate to the TC-Red VM (its a VM on your Windows toolbar) and open a terminal

    NOTE: If your cursor behaves strangely, turn off mouse integration on the VM controls

    mouse integration is turned off
    Figure 10 – mouse integration is turned off
    open a terminal in TC-Red
    Figure 11 – open a terminal in TC-Red
  2. Configure the Ethernet interface with a static IP address
    1. Open a new configuration file by typing

      > sudo vi /opt/eth0.sh

    2. You will see a lot of tildes (~) which means a blank document
    3. Press i to activate insert, and type the following in the file

      # fast storage device may need a delay on boot for the settings to take
      # adjust the following sleep statement if needed
      sleep .2

      #kill the dhcp client for eth0
      sleep 1
      if [ -f /var/run/udhcpc.eth0.pid ]; then rm /var/run/udhcpc.eth0.pid;
      sleep 0.1
      fi

      #configure the interface eth0
      ifconfig eth0 192.168.1.250 netmask 255.255.255.0 broadcast 192.168.1.255 up

      #start the DHCP server process once the interface is ready with the IP add
      sleep .1
      sudo udhcpd /etc/udhcpd.conf &

      configuring the static IP
      Figure 12 – configuring the static IP
    4. Press esc to exit the edit mode
    5. Press the full colon < : >followed by wq  (this means write out – old school ‘save file’ – and quit)

      :wq

    6. Now type in the command line

      > sudo chmod 777 /opt/eth0.sh

    7. Followed by

      > sudo /opt/eth0.sh

    8. You can check if interface eth0 is configured by typing

      > ifconfig

      applying the configuration
      Figure 13- applying the configuration
  3. Create a DHCP configuration file
    1. Type

      > sudo vi /etc/udhcpd.conf

    2. In this new file, press i to insert and type the following

      start 192.168.1.100
      end 192.168.1.200
      interface eth0
      option subnet 255.255.255.0
      option router 192.168.1.250
      option lease 43200
      option dns 192.168.1.250
      option domain local

      NOTE: These settings mean the following

      Statement Setting Meaning
      Start 192.168.1.100 This is the first possible IP address that can be given out to end devices asking for an IP address
      Stop 192.168.1.200 This is the last possible IP address that can be given out to end devices asking for an IP address
      interface eth0 This is the network interface that will be looking for DHCP requests
      option subnet 255.255.255.0 The IPv4 subnet mask used for this network (192.168.1.0)
      option router 192.168.1.250 This is the IP address of the gateway router to leave the local LAN
      option lease 43200 The number of seconds between lease refresh – this is 12 hours
      option dns 192.168.1.250 DNS should use this gateway router
      option domain local DNS requests will resolve locally first before using the gateway
      configure the DHCP
      Figure 14 – configure the DHCP
    3. When finished typing, press escape, followed by

      :wq

    4. Then start the DHCP Daemon by typing

      sudo udhcpd /etc/udhcpd.conf

    5. Verify if the DHCP process is running by typing the following

      sudo netstat -anp

    6. You should see a listening line similar to this (the PID will vary):   udp  0  0  0.0.0.0:67    0.0.0.0:*   1781/udhcpd
      perform a netstack check
      Figure 15 – perform a netstack check
  4. Remember, Tiny Core Linux has limited persistence, so we have to add our DHCP configuration file to the list
    1. Gain change permissions to the bootlocal file by typing

      sudo chown root:staff /opt/bootlocal.sh
      sudo chmod 775 /opt/bootlocal.sh

    2. Now add the persistence by typing the following

      sudo echo ‘etc/udhcpd.conf’ >> /opt/.filetool.lst
      sudo echo ‘opt/eth0.sh’ >> /opt/.filetool.lst
      sudo echo ‘opt/eth0.sh &’ >> /opt/bootlocal.sh
      filetool.sh -b

    3. You should get a confirmation like in
      adding persistence
      Figure 16 – adding persistence
    4. Now reboot TC-red to verify the settings were retained by typing the following at the command line
      1. Static IP is configured

        ifconfig

        NIC information remains after reboot
        Figure 17 – NIC information remains after reboot
      2. DHCP server is running

        sudo netstat -anp

        DHCP server is running
        Figure 18 – DHCP server is running

Phase III – Verify hosts are getting IP addresses

We can never be certain that our VPCS are getting IP addresses until we try it.

  1. Navigate to the GNS3 workspace
  2. Right-click on a VPCS console and type

    ip dhcp

  3. You should get a response of an IP address between 192.168.1.100 – 192.168.1.200
    ensuring devices are getting DHCP
    Figure 16 – Ensure devices are getting DHCP
  4. Note the IP address and use the GNS3 note tool to add the IP address to the Workspace
    Add notes to the workspace
    Figure 17 – Add a note to the workspace

NOTE: Most errors encountered by testers were due to typos. Be careful, and everything should work fine.

Final Note – you can change the DHCP configuration any time by modifying IP addresses.  For instance, if our network was 20.20.0.0/16 and we knew our gateway router was 20.20.20.254, we would change our settings to the following:

Purpose Lab IP Address Possible Modification
Network ID 192.168.1.0 20.20.0.0
subnet mask 255.255.255.0 255.255.0.0
Static IP (this DHCP Server) 192.168.1.250 20.20.20.1
Option Router (gateway or next-hop) 192.168.1.250 20.20.20.254
start – the first available IP address for DHCP 192.168.1.100 20.20.20.50
stop – the last available IP address for DHCP 192.168.1.200 20.20.20.99
Option DNS (the gateway if DNS cannot be resolved locally) 192.168.1.250 20.20.20.254
lease time (in seconds) 43200 ( =12 hours) 21600 (= 6 hours)

Career Connection

Automatic IP address assignment is a fundamental service found in virtually every enterprise network. Network administrators and systems administrators configure and maintain DHCP services to ensure that workstations, servers, printers, and other networked devices can communicate efficiently without manual configuration. The skills developed in this chapter provide practical experience with one of the first services deployed when building or expanding an enterprise network and establish the foundation for additional infrastructure services introduced in later chapters.

End of Lab

Feedback email
Figure 00 – Contact us via prmaster@erau.edu

License

Icon for the Creative Commons Attribution-NonCommercial 4.0 International License

Mastering Enterprise Networks 3e Copyright © 2024 by Mathew J. Heath Van Horn is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License, except where otherwise noted.