configure a DHCP
server on Fedora
BY HUSSEIN
YOUNIS
1
2
What is hostname and NetworkManager?
hostname
is a name given to a computer and attached to the network. Its main
purpose is to uniquely identify over a network.
NetworkManager is a system network service that manages your network devices and
connections and attempts to keep network connectivity active when
available.
nmcli a command-line utility which you can use to create, display, edit, delete,
activate, and deactivate network connections, as well as control and
display network device status.
3
Get current
hostname
nmcli general hostname
Hostname commands
1
Change
hostname
nmcli general hostname hussein-pc
2
4
NetworkManager
Check NetworkManager
status
systemctl status NetworkManager
You must insure that the service NetworkManager is active and running.
5
NetworkManager
Check NetworkManager
status using nmcli
nmcli networking
You must insure that the service NetworkManager is active and running.
6
NetworkManager
Start NetworkManager
service
systemctl start NetworkManager
Stop NetworkManager
service
systemctl stop NetworkManager
7
network interface
a network interface is the point of connection between a computer and a network
Get active networking nmcli connection show
You can get the interface name form device attributes
8
NetworkManager
Make a connection
active
nmcli connection up 'Wired connection 1'
Make a connection
inactive
nmcli connection down 'Wired connection 1'
9
IP address configuration
Step 1 get the connection interface/device name
Command syntax nmcli connection show --active
10
IP address configuration
You can get the current configuration for a connection using the command ifconfig
Step 2 Get the configuration for a connection by the connection interface/device name
Command syntax ifconfig ens160
11
IP address configuration
You can modify network configuration using nmcli as follows:
Step 3 change the address configuration using nmcli
Command syntax nmcli connection modify 'Wired connection 1' ipv4.addresses
192.168.14.200/24 ipv4.gateway 192.168.14.2 ipv4.method manual
ipv4.dns 192.168.14.2
After changing the configuration you must down and then up the
connection to reflect the new configuration.
12
IP address configuration
You can modify network configuration using nmcli as follows:
Step 3 change the address configuration using nmcli
Command syntax nmcli connection modify 'Wired connection 1' ipv4.addresses
192.168.14.200/24 ipv4.gateway 192.168.14.2 ipv4.method manual
ipv4.dns 192.168.14.2
13
IP address configuration
You can modify network configuration using nmcli as follows:
The changes will be written to /etc/sysconfig/network-scripts/ifcfg-
Wired_connection_1 file.
14
What is DHCP?
the story beyond DHCP
No two hosts can have the same IP address in the same network, and
configuring them manually will likely lead to errors. With dynamic addressing, a
device can have a different IP address every time it connects to the network.
This means that a new computer can be added to a network without the hassle
of manually assigning it a unique IP address.
Dynamic Host Configuration Protocol (DHCP) is a client/server protocol that automatically provides
an Internet Protocol (IP) host with its IP address and other related configuration information such
as the subnet mask and default gateway.
15
DHCP client a host using DHCP to obtain an IP address and other configuration information
DHCP Components
1
DHCP server a host that returns IP addresses and other configuration information
2
BOOTP relay
agents
host or router that passes DHCP messages between DHCP clients and DHCP
servers.
2
16
1. Client startup TCP/IP operations. Broadcasts a request
for address information.
2. The DHCP server receives the request, assigns a new
address for a specific time period (called a lease period)
and sends it to the client together with the other required
configuration information.
3. This information is acknowledged by the client and used
to set up its configuration.
DHCP process
17
Step 1 Install the DHCP server package by running the commands below
Install and configure DHCP Sever in Fedora
Command syntax sudo yum install dhcp
example
The installation of the DHCP package creates an empty
configuration file under /etc/dhcp/dhcpd.conf. The
Sample configuration file is located
under /usr/share/doc/dhcp-server/dhcpd.conf.example.
Therefore, you can optionally check this sample
configuration to guide you on how to set up your DHCP
configuration file or you can copy the sample configuration
file to /etc/dhcp/dhcpd.conf. overwriting the existing one
and make necessary changes that best suits your network.
18
Step 2
Overwrite the dhcpd configuration file by Coping the sample dhcpd
configuration file to dhcpd configuration location.
Install and configure DHCP Sever in Fedora
Command syntax
sudo cp /usr/share/doc/dhcp-server/dhcpd.conf.example
/etc/dhcp/dhcpd.conf
example
19
Step 3 Open the configuration file for editing and make adjustments as follows,
Install and configure DHCP Sever in Fedora
Command syntax sudo vim /etc/dhcp/dhcpd.conf
option domain-name "dhcp.hussein.com";
option domain-name-servers ns1.hussein.org, ns2.hussein.org;
default-lease-time 600;
max-lease-time 7200;
20
Step 4 Subnet Declaration
Install and configure DHCP Sever in Fedora
In order for the DHCP server to understand the network topology, you need to define DHCP
subnet. For example, to configure the DHCP for the 192.168.14.0/24 LAN network, the declaration
is defined as shown below;
Note that you can only serve DHCP requests for a subnet for which there is an interface configured
in that subnet on the host machine.
21
Step 5 Save the file
Install and configure DHCP Sever in Fedora
Step 6 Restart the network service
Command syntax systemctl restart network.service
Step 7 Restart the computer.
You have configured the DHCP server
☺

configure a DHCP server on Fedora.pdf

  • 1.
    configure a DHCP serveron Fedora BY HUSSEIN YOUNIS 1
  • 2.
    2 What is hostnameand NetworkManager? hostname is a name given to a computer and attached to the network. Its main purpose is to uniquely identify over a network. NetworkManager is a system network service that manages your network devices and connections and attempts to keep network connectivity active when available. nmcli a command-line utility which you can use to create, display, edit, delete, activate, and deactivate network connections, as well as control and display network device status.
  • 3.
    3 Get current hostname nmcli generalhostname Hostname commands 1 Change hostname nmcli general hostname hussein-pc 2
  • 4.
    4 NetworkManager Check NetworkManager status systemctl statusNetworkManager You must insure that the service NetworkManager is active and running.
  • 5.
    5 NetworkManager Check NetworkManager status usingnmcli nmcli networking You must insure that the service NetworkManager is active and running.
  • 6.
    6 NetworkManager Start NetworkManager service systemctl startNetworkManager Stop NetworkManager service systemctl stop NetworkManager
  • 7.
    7 network interface a networkinterface is the point of connection between a computer and a network Get active networking nmcli connection show You can get the interface name form device attributes
  • 8.
    8 NetworkManager Make a connection active nmcliconnection up 'Wired connection 1' Make a connection inactive nmcli connection down 'Wired connection 1'
  • 9.
    9 IP address configuration Step1 get the connection interface/device name Command syntax nmcli connection show --active
  • 10.
    10 IP address configuration Youcan get the current configuration for a connection using the command ifconfig Step 2 Get the configuration for a connection by the connection interface/device name Command syntax ifconfig ens160
  • 11.
    11 IP address configuration Youcan modify network configuration using nmcli as follows: Step 3 change the address configuration using nmcli Command syntax nmcli connection modify 'Wired connection 1' ipv4.addresses 192.168.14.200/24 ipv4.gateway 192.168.14.2 ipv4.method manual ipv4.dns 192.168.14.2 After changing the configuration you must down and then up the connection to reflect the new configuration.
  • 12.
    12 IP address configuration Youcan modify network configuration using nmcli as follows: Step 3 change the address configuration using nmcli Command syntax nmcli connection modify 'Wired connection 1' ipv4.addresses 192.168.14.200/24 ipv4.gateway 192.168.14.2 ipv4.method manual ipv4.dns 192.168.14.2
  • 13.
    13 IP address configuration Youcan modify network configuration using nmcli as follows: The changes will be written to /etc/sysconfig/network-scripts/ifcfg- Wired_connection_1 file.
  • 14.
    14 What is DHCP? thestory beyond DHCP No two hosts can have the same IP address in the same network, and configuring them manually will likely lead to errors. With dynamic addressing, a device can have a different IP address every time it connects to the network. This means that a new computer can be added to a network without the hassle of manually assigning it a unique IP address. Dynamic Host Configuration Protocol (DHCP) is a client/server protocol that automatically provides an Internet Protocol (IP) host with its IP address and other related configuration information such as the subnet mask and default gateway.
  • 15.
    15 DHCP client ahost using DHCP to obtain an IP address and other configuration information DHCP Components 1 DHCP server a host that returns IP addresses and other configuration information 2 BOOTP relay agents host or router that passes DHCP messages between DHCP clients and DHCP servers. 2
  • 16.
    16 1. Client startupTCP/IP operations. Broadcasts a request for address information. 2. The DHCP server receives the request, assigns a new address for a specific time period (called a lease period) and sends it to the client together with the other required configuration information. 3. This information is acknowledged by the client and used to set up its configuration. DHCP process
  • 17.
    17 Step 1 Installthe DHCP server package by running the commands below Install and configure DHCP Sever in Fedora Command syntax sudo yum install dhcp example The installation of the DHCP package creates an empty configuration file under /etc/dhcp/dhcpd.conf. The Sample configuration file is located under /usr/share/doc/dhcp-server/dhcpd.conf.example. Therefore, you can optionally check this sample configuration to guide you on how to set up your DHCP configuration file or you can copy the sample configuration file to /etc/dhcp/dhcpd.conf. overwriting the existing one and make necessary changes that best suits your network.
  • 18.
    18 Step 2 Overwrite thedhcpd configuration file by Coping the sample dhcpd configuration file to dhcpd configuration location. Install and configure DHCP Sever in Fedora Command syntax sudo cp /usr/share/doc/dhcp-server/dhcpd.conf.example /etc/dhcp/dhcpd.conf example
  • 19.
    19 Step 3 Openthe configuration file for editing and make adjustments as follows, Install and configure DHCP Sever in Fedora Command syntax sudo vim /etc/dhcp/dhcpd.conf option domain-name "dhcp.hussein.com"; option domain-name-servers ns1.hussein.org, ns2.hussein.org; default-lease-time 600; max-lease-time 7200;
  • 20.
    20 Step 4 SubnetDeclaration Install and configure DHCP Sever in Fedora In order for the DHCP server to understand the network topology, you need to define DHCP subnet. For example, to configure the DHCP for the 192.168.14.0/24 LAN network, the declaration is defined as shown below; Note that you can only serve DHCP requests for a subnet for which there is an interface configured in that subnet on the host machine.
  • 21.
    21 Step 5 Savethe file Install and configure DHCP Sever in Fedora Step 6 Restart the network service Command syntax systemctl restart network.service Step 7 Restart the computer.
  • 23.
    You have configuredthe DHCP server ☺