H
H
• These packages are necessary for setting up various services like DHCP, DNS, FTP, email,
etc.
• Install the same packages as for CentOS 7 above, except dhcp-devel instead of dhcp.
• Ensure to use CentOS 6 because the setup might require backward compatibility features
for testing.
• Note: After copying VMs, modify the MAC addresses to avoid network conflicts.
• Use the virtual machine network interface to connect each VM to the corresponding
virtual network as per your network design.
• Disable firewalls (both iptables and firewalld) for initial setup and troubleshooting.
• After installation, check that all required packages are installed on each VM using
commands like:
• Use systemctl to enable the required services (e.g., DHCP, DNS, FTP, HTTP, etc.) to start
automatically on boot:
systemctl enable <service-name>
SELINUX=disabled
• Apply the changes and reboot the machine for the settings to take effect.
sysctl -w net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1
• Set the default route on “Routeur” towards the ISP machine (the next-hop gateway):
• On Srv-interne and Srv-externe, set the default gateway to the IP address of the
“Routeur”:
• Set up the DHCP service to provide IP addresses dynamically on two networks (Vmnet2
and Vmnet3).
• Install and configure the DHCP relay service on the “Routeur” to forward DHCP requests
from the Vmnet3 network to the DHCP server on Srv-interne.
• Install DNS (BIND) on “Srv-externe” and configure it for the external domain BAIDRIS.ma.
• Install DNS (BIND) on “Srv-interne” and configure it for the internal domain BAIDRIS.isgi.
• Set “Srv-interne” to use “Srv-externe” as a DNS forwarder for resolving external domain
names:
forwarders {
<Srv-externe-IP>;
};
Part B: Internal Services (FTP, HTTP, SMTP, POP3, NFS, SAMBA, and SSH)
anonymous_enable=NO
local_enable=YES
write_enable=YES
chroot_local_user=YES
Part II: HTTP for Two Sites on Two Different Ports on “Srv-interne”
• Edit the /etc/httpd/conf/httpd.conf file to add configurations for two sites running on
ports 80 and 8008.
Listen 80
<VirtualHost *:80>
DocumentRoot /var/www/html/site1
ServerName site1.local
</VirtualHost>
Listen 8008
<VirtualHost *:8008>
DocumentRoot /var/www/html/site2
ServerName site2.local
</VirtualHost>
myhostname = srv-interne.local
mydomain = baidris.local
relayhost = [20.20.4.2]
• Why you can’t receive emails: You haven’t set up a mail receiving server (like Dovecot or
another MX server) to accept incoming emails.
• Edit /etc/dovecot
useradd HAMZA
passwd HAMZA
smbpasswd -a HAMZA
groupadd BAIDRIS
mkdir -p /BAIDRIS/HAMZA
exportfs -a
Samba Setup:
[partage-HAMZA]
path = /BAIDRIS/HAMZA
read only = no
• Restart Samba:
Summary of Commands:
• Start and enable services: systemctl start <service-name>, systemctl enable <service-
name>
• You need to assign a second IP to the network interface on “Srv-externe”. This can be
done by modifying the network configuration:
IPADDR1=20.20.4.3
NETMASK=255.255.255.248
GATEWAY=20.20.4.1
• Restart the network service:
anonymous_enable=NO
local_enable=YES
write_enable=YES
chroot_local_user=YES
Part II: HTTP for Two Sites with Different Addresses on “Srv-externe”
• You will configure two virtual hosts on different IPs (20.20.4.3 and another address):
<VirtualHost 20.20.4.3:80>
DocumentRoot /var/www/html/site1
ServerName site1.srv-externe.local
</VirtualHost
<VirtualHost 20.20.4.4:80>
DocumentRoot /var/www/html/site2
ServerName site2.srv-externe.local
</VirtualHost>
• You need to add A records for the sites and a CNAME for FTP in the public DNS.
• A records:
site1.srv-externe.local IN A 20.20.4.3
site2.srv-externe.local IN A 20.20.4.4
myhostname = srv-externe.local
mydomain = baidris.ma
relayhost = [smtp.internet-provider.com]
• You will configure NAT to allow internal clients to access the internet.
• Verify that internal clients can access the internet by testing ping or browsing.
• To ensure the firewall blocks everything, you will first delete existing rules and then set
the default policies to DROP.
iptables -F
3. Modify Default Policy to Block All Traffic (Incoming, Outgoing, and Transit):
• To ensure the system works properly, you need to allow loopback traffic:
iptables -A INPUT -i lo -j ACCEPT
6.
a.Create Specific Rules for Communication Between Zones (Internal → DMZ, NAT, etc.):
b. Allow Specific Traffic (HTTPs, FTP, DNS, SMTP, etc.) from Internal to External (Internet):
• Enable POP3s and IMAP4s on “srv-interne” and use port forwarding for email services:
iptables -A PREROUTING -t nat -p tcp --dport 995 -j DNAT --to-destination 20.20.4.5:995 # POP3s
iptables -A PREROUTING -t nat -p tcp --dport 993 -j DNAT --to-destination 20.20.4.5:993 # IMAP4s