static networking
Hank Crawford plays alto and baritone sax in a small local band called the Ray Charles' Band by night, and he is the Executive Director of the Linux Foundation by day. He wants to do a demonstration of configuring static networking and hostname resolution on a small network. He sets up a RHEL server and 2 RHEL workstations. He wants the server (Server A) to serve up files at 192.168.1.1 to Client A (192.168.1.2) and Client B (192.168.1.3). He also wants Server A to act as a DNS server for the network. Please demonstrate all of the commands that he will have to run, including which packages he will need to install on all machines.
Sure, here are the steps that Hank Crawford can follow to configure static networking and hostname resolution on his RHEL server and workstations:
- Install necessary packages:
- sudo yum install net-tools bind bind-utils -y
- This command installs the net-tools package for network configuration tools and the bind and bind-utils packages for DNS server functionality.
- Configure static IP address on Server A:
- sudo vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
- In this file, set the following parameters:
- BOOTPROTO=none
IPADDR=192.168.1.1
NETMASK=255.255.255.0
GATEWAY=192.168.1.254
DNS1=127.0.0.1
- BOOTPROTO=none
- Save and exit the file.
- Configure static IP address on Client A:
- sudo vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
- In this file, set the following parameters:
- BOOTPROTO=none
IPADDR=192.168.1.2
NETMASK=255.255.255.0
GATEWAY=192.168.1.254
DNS1=192.168.1.1
- BOOTPROTO=none
- Save and exit the file.
- Configure static IP address on Client B:
- sudo vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
- In this file, set the following parameters:
- BOOTPROTO=none
IPADDR=192.168.1.3
NETMASK=255.255.255.0
GATEWAY=192.168.1.254
DNS1=192.168.1.1
- BOOTPROTO=none
- Save and exit the file.
- Configure hostname on Server A:
- sudo hostnamectl set-hostname servera
- This command sets the hostname of the server to "servera".
- Configure hostname on Client A:
- sudo hostnamectl set-hostname clienta
- Configure hostname on Client B:
- sudo hostnamectl set-hostname clientb
- This command sets the hostname of the client to "clientb".
- Configure DNS server on Server A:
- sudo vi /etc/named.conf
- In this file, add the following zone configuration:
- zone "mylocalnetwork.com" IN {
type master;
file "mylocalnetwork.com.zone";
};
- zone "mylocalnetwork.com" IN {
- Save and exit the file.
- Configure DNS zone file:
- sudo vi /var/named/mylocalnetwork.com.zone
- In this file, add the following records:
- $TTL 86400
@ IN SOA servera.mylocalnetwork.com. admin.mylocalnetwork.com. (
1 ; Serial
3600 ; Refresh
1800 ; Retry
604800 ; Expire
86400 ) ; Minimum TTL
@ IN NS servera.mylocalnetwork.com.
servera IN A 192.168.1.1
clienta IN A 192.168.1.2
clientb IN A 192.168.1.3
- $TTL 86400
- Save and exit the file.
- Restart network and DNS services:
- sudo systemctl restart network
sudo systemctl enable named
sudo systemctl restart named
- sudo systemctl restart network
After completing these steps, Server A should be able to serve up files at 192.168.1.1 to Client A (192.168.1.2) and Client B (192.168.1.3) on the local network, and also act as a DNS server for the network. The clients can access the server using the hostname "servera.mylocalnetwork.com" and resolve hostnames for each other using the DNS server running on Server A.
Hank Crawford can now demonstrate these commands to his colleagues to show them how to configure static networking and DNS resolution on a small network.