Configuring VM Networking in Simulation Lab
Configuring VM Networking in Simulation Lab
By:
1.
Habiba Mohamed Ahmed Aboeldahab 2131037
2.
Mariam Elsayed Saad-Eldin Mohamed 2131101
3.
Abdelhamed Marzouk Hashad 2132050
4.
Ali Mohamed Ali Darwish 2132062
5.
Allam Basem Fayed 2132057
6.
Habiba Mohamed Ahmed Aboeldahab 2131037
7.
Mariam Elsayed Saad-Eldin Mohamed 2131101
8.
Abdelhamed Marzouk Hashad 2132050
9.
Ali Mohamed Ali Darwish 2132062
10.
Allam Basem Fayed 2132057
First and foremost, all praise is due to Allah for granting us the strength, patience, and
perseverance to complete this graduation project successfully.
We would like to express our sincere gratitude to our supervisor, Dr. Engy Elshafeiy, for their
continuous support, guidance, and valuable feedback throughout every stage of this project.
Our deepest appreciation goes to the Faculty of Computers and Artificial Intelligence, Sadat City
University, for providing us with the knowledge and resources needed during our academic
journey.
We are also grateful to all the professors and teaching assistants who inspired and supported us
during our years of study.
Special thanks to our families and friends for their endless encouragement, prayers, and
understanding. Their support was a constant source of motivation for us.
Finally, we would like to thank our colleagues and teammates for their collaboration, dedication,
and hard work in making this project a success.
I
Abstract
This document serves as a practical guide to designing a modern, efficient, and secure enterprise
network infrastructure. By combining theoretical knowledge with practical implementation, this
project demonstrates how innovative solutions can address complex networking problems,
enabling businesses to operate effectively in an increasingly interconnected world.
II
Table of Contents
ACKNOWLEDGMENT I
ABSTRACT II
LIST OF ACRONYMS/ABBREVIATIONS IX
1.1 INTRODUCTION 2
1.2 PROBLEM STATEMENT 2
1.3 SIGNIFICANCE OF THE PROBLEM 4
1.4 CURRENT SOLUTION 4
CHAPTER2: NETWORK AND PROGRAM ANALYSIS 6
III
4.1 INTRODUCTION TO NETWORK COMMUNICATION 40
4.2 DHCP REQUEST AND INITIAL CONNECTIVITY 40
4.3 INTERNAL COMMUNICATION AND VLAN ROUTING 40
4.4 INTER-BRANCH COMMUNICATION USING BGP 41
4.5 SERVICE PROVIDER ROUTING USING EIGRP 41
4.6 CONCLUSION AND BEST PRACTICES 41
CHAPTER5: NETWORK SECURITY IMPLEMENTATION USING FORTIGATE
FIREWALLS 42
6.1 INTRODUCTION 69
6.2 OBJECTIVE OF USING WIRESHARK 69
6.3 PROJECT ENVIRENMENT 69
6.4 INSTALLING WIRESHARK ON A LINUX VM 69
6.5 HOW WIRESHARK WAS USED 70
6.6 LAB TEST SCENARIOS 70
6.7 RESULT AND BENEFIT 71
6.8 LEGAL AND ETHICAL USE 71
6.9 CONCLUSION 71
CHAPTER7: SOCKET CHAT APPLICATION 72
IV
7.7 ERROR HANDLING 74
7.8 HOW TO RUN 75
7.9 POSSIBLE FUTURE IMPROVEMENTS 76
V
Tools and Protocols Overview
VMWARE WORKSTATION
VMware Workstation is a hosted hypervisor that allows users to set up virtual machines (VMs)
on a single physical machine and use them simultaneously. It is essential for simulating a virtual
network environment.
PNETLAB
PNetLab is a powerful emulator used to simulate complex network topologies using virtual
network devices such as routers, switches, firewalls, and more. It supports various images like
Cisco IOS, Fortinet, etc.
ROUTER
A router is a networking device that forwards data packets between computer networks. It uses
routing tables and protocols like OSPF, EIGRP, and BGP to determine the best path for
forwarding the data.
SWITCH
A switch is used to connect devices within the same network. It operates at Layer 2 (Data Link
Layer) and is responsible for forwarding data based on MAC addresses.
FIREWALL
A firewall is a network security system that monitors and controls incoming and outgoing
network traffic. It acts as a barrier between a trusted and an untrusted network.
FORTINET
Fortinet is a cybersecurity company known for its FortiGate firewalls. These devices provide
high-performance network security and threat protection.
VI
SERVER
A server is a device or software that provides functionality for other programs or devices. It is
typically used to host services, applications, and data in a network environment.
Core switches are high-capacity backbone devices that aggregate traffic from access switches.
Access switches connect end devices like PCs and printers to the network.
WIRESHARK
Wireshark is a network protocol analyzer used to capture and inspect data traffic on a network. It
helps in troubleshooting and analyzing network issues.
OSPF is a dynamic routing protocol used in IP networks. It uses link-state routing and converges
quickly, making it suitable for large enterprise networks.
Protocol Involved: BGP (IBGP and EBGP), OSPF, VLANs, EIGRP, BVI, VTP
o BGP (IBGP & EBGP): Utilized for scalable and flexible routing across different
networks (inter-network) and within the same network (intra-network). EBGP connects
networks, while IBGP works within the network, ensuring that routing information scales
seamlessly as the organization grows.
o OSPF: A hierarchical routing protocol ideal for large networks. OSPF divides the
network into areas, reducing routing overhead and optimizing traffic management, which
enhances scalability and quick convergence.
o VTP: VLAN Trunking Protocol simplifies the management of VLAN configurations
across switches. It ensures that new VLANs are easily propagated throughout the
network, supporting growth without manual intervention, especially as new subnets or
departments are added.
VII
o EIGRP and BVI: These protocols enable efficient routing within the organization.
EIGRP allows for dynamic, flexible subnet management, while BVI provides routing
between bridged VLANs, enhancing scalability across multiple network segments.
STP (SPANNING TREE PROTOCOL)
STP is used in Ethernet networks to prevent loops by creating a loop-free logical topology.
A VLAN is a logical subgroup within a network that combines devices from different physical
LANs. It enhances security and network efficiency.
VIII
LIST OF ACRONYMS/ABBREVIATIONS
AD Active Directory
IX
Abbreviation Full Form
IP Internet Protocol
IT Information Technology
X
Abbreviation Full Form
XI
Abbreviation Full Form
XII
CHAPTER1:
Project Description
Chapter 1: Project Description
1.1 INTRODUCTION
In the current digital era, a reliable, secure, and scalable corporate network infrastructure has
become an essential component for the success of any organization. Networks are the backbone
of internal communication, data sharing, remote collaboration, and access to services. However,
designing such infrastructure comes with challenges, including security threats, performance
issues, and future scalability.
This project aims to design and simulate a corporate network for a medium-sized enterprise with
two main branches—one located in Cairo and the other in Alexandria. The simulation is
conducted using PNETLAB, a professional network emulation platform that allows for testing
and validating network configurations before real-world deployment.
Each branch includes multiple departments with various devices. Without segmentation:
2
Chapter 1: Project Description
Solution:
Inter-branch connectivity is crucial. Instead of costly fiber connections, the network uses Site-to-
Site VPN over IPsec, ensuring:
Threats can originate externally (hackers) or internally (employees misusing privileges). Security
is enforced through:
Threats include:
3
Chapter 1: Project Description
4
Chapter 1: Project Description
Advantages:
Limitations:
Benefits:
Limitations:
5
Chapter 2: Network and Program Analysis
6
Chapter 2: Network and Program Analysis
7
Chapter 2: Network and Program Analysis
[Link] HR Department
8
Chapter 2: Network and Program Analysis
[Link] IT Department
9
Chapter 2: Network and Program Analysis
10
Chapter 2: Network and Program Analysis
11
Chapter 2: Network and Program Analysis
12
Chapter 2: Network and Program Analysis
13
Chapter 2: Network and Program Analysis
[Link] Admin
14
Chapter 2: Network and Program Analysis
[Link] Employee
15
Chapter 2: Network and Program Analysis
[Link] Admin
16
Chapter 2: Network and Program Analysis
[Link] Employee
17
Chapter 2: Network and Program Analysis
[Link] Adim
18
Chapter 2: Network and Program Analysis
[Link] Employee
19
Chapter 3: Server Infrastructure Implementation
After installing Windows Server 2019 on the virtual machine, the Active Directory Domain
Services (AD DS) role was added using the Server Manager. Once the role was successfully
installed, the server was promoted to a Domain Controller through the post-installation wizard.
20
Chapter 3: Server Infrastructure Implementation
During the promotion process, a new domain was created with the Fully Qualified Domain
Name (FQDN) [Link]. A static IP address ([Link]) was configured on the server to
ensure consistent network communication with domain clients. This server now functions as the
central domain controller responsible for authenticating and managing devices and users across
the domain.
21
Chapter 3: Server Infrastructure Implementation
After setting up the domain controller, several Organizational Units (OUs) were created in
Active Directory Users and Computers to logically organize users based on their departmental
roles. The following OUs were created: Accounts, Call Center, HR, Management, and
Training & Rooming. Inside each OU, a corresponding security group was created to manage
access control and policy assignment.
22
Chapter 3: Server Infrastructure Implementation
Each user was manually created and assigned to the appropriate group within their respective OU
to ensure proper access management and Group Policy Object (GPO) targeting.
23
Chapter 3: Server Infrastructure Implementation
The DHCP Server and DNS Server roles were installed on the Windows Server 2019 machine
using Server Manager. After installation, multiple DHCP scopes were created to manage IP
distribution across different departments. The scopes are:
HR: [Link]/24
Server: [Link]/24
IT: [Link]/24
Management: [Link]/24
Admin: [Link]/24 (corrected from [Link].0)
Each scope was configured with its own range of IP addresses, lease duration, and other basic
options like default gateway and DNS server.
24
Chapter 3: Server Infrastructure Implementation
On the DNS side, a Reverse Lookup Zone was created to support name-to-IP resolution. Load
balancing was implemented by assigning the hostname www to two different IP addresses:
[Link] and [Link], enabling round-robin DNS.
Additionally, a Conditional Forwarder was set up to forward DNS queries for the external
domain [Link] to a specific DNS server.
25
Chapter 3: Server Infrastructure Implementation
26
Chapter 3: Server Infrastructure Implementation
Multiple Group Policy Objects (GPOs) were created and linked to specific Organizational Units
(OUs) to enforce security and usability policies across departments.
The Default Domain Policy was edited to apply general security settings to all domain
computers. The applied policies included:
Accounts OU:
27
Chapter 3: Server Infrastructure Implementation
28
Chapter 3: Server Infrastructure Implementation
HR OU:
IT OU:
29
Chapter 3: Server Infrastructure Implementation
Management OU:
30
Chapter 3: Server Infrastructure Implementation
31
Chapter 3: Server Infrastructure Implementation
To enhance security and control user access, logon hours were defined for all domain users using
Active Directory Users and Computers (ADUC). Each user account was configured to allow
logon only between 8:00 AM and 4:00 PM, restricting access outside working hours.
This policy ensures that no unauthorized logon attempts occur during off-hours, reducing the risk
of malicious activity or policy violations.
To centralize user data and apply storage/security policies, a shared folder structure was created
on the E: partition of the Windows Server. The structure was organized based on department
OUs.
32
Chapter 3: Server Infrastructure Implementation
Drive Mapping:
Using Group Policy, a mapped network drive was configured for each OU.
o Example: Accounts OU users have drive Z:\ mapped to \\ServerName\Data\
Accounts
This ensures users have direct access to their department's shared folder.
33
Chapter 3: Server Infrastructure Implementation
Home Folders:
A home folder was assigned for each user (except Call Center users), stored on the server
and linked from the user’s AD profile.
34
Chapter 3: Server Infrastructure Implementation
Profiles:
Roaming profiles were configured for all users to store their profile data on the server
and allow it to follow them across devices.
Quota Management:
Using Quota Management, size limits were applied to users’ home folders to control
disk usage.
35
Chapter 3: Server Infrastructure Implementation
File Screening:
File Screening policies were configured to block audio and video file types from being saved
in shared folders.
36
Chapter 3: Server Infrastructure Implementation
To monitor and track system and security events across the domain controller and network
services. This allows detecting suspicious behavior, configuration changes, and access attempts
in a timely manner.
37
Chapter 3: Server Infrastructure Implementation
To configure UAC (User Account Control) settings that enforce elevation prompts for standard
users and limit administrative privileges unless explicitly granted. This enhances the overall
system security and prevents unauthorized changes.
Performance Monitor:
38
Chapter 3: Server Infrastructure Implementation
o Created custom Data Collector Sets for CPU, RAM, and Disk
usage.
39
Chapter 3: Server Infrastructure Implementation
In addition to the primary domain [Link] hosted on [Link], a second and independent
domain was deployed for the organization's second branch.
This domain was configured independently but follows the same structure, policies, and
configurations as the primary domain to maintain consistency across both branches.
The replication was manual, not via trust or forest relationship. Each domain operates
independently, with no trust established between them.
40
Chapter 3: Server Infrastructure Implementation
41
Chapter 3: Network Communication Flow and Design Overview
In a modern enterprise network, the communication process starts the moment a device, such as
a personal computer (PC), is powered on. The primary goal at this stage is to ensure the device
can obtain an IP address and communicate across the network securely and efficiently.
This document outlines the step-by-step flow of communication, routing protocols involved, and
the security mechanisms implemented in a professional network setup. The focus is on reliability,
scalability, and security.
When a PC is turned on, it immediately sends a broadcast message requesting an IP address. This
DHCP Discover message travels through the access layer switch and is then forwarded to the
core switch.
The core switch plays a vital role in managing traffic flow and ensuring the message is directed
toward the security layer. Before the request can reach the DHCP server, it must pass through a
firewall — such as Fortinet — which checks the content for potential threats or malicious
patterns.
After clearance, the request reaches the DHCP server, which examines the VLAN ID associated
with the source port. Based on this VLAN, the server assigns an IP address from the respective
DHCP pool. This dynamic assignment allows seamless network connectivity.
Once an IP is assigned, the device can communicate internally or externally. For devices within
the same branch, the routing is handled using VLAN Trunking Protocol (VTP). VTP helps
propagate VLAN information across switches, simplifying configuration and management.
42
Chapter 3: Network Communication Flow and Design Overview
This form of routing ensures that devices in the same VLAN but connected to different switches
can communicate efficiently. It is suitable for intra-branch communications where latency and
security are tightly controlled.
For communication across different branches, the edge router becomes responsible. It connects
to the service provider using Border Gateway Protocol (BGP), a robust and scalable routing
protocol designed for inter-domain communication.
BGP is preferred due to its security features, stability, and ability to handle vast numbers of
routes. It ensures that even as the organization expands to multiple locations, connectivity
remains seamless and routing decisions are optimized.
Inside the service provider’s infrastructure, Enhanced Interior Gateway Routing Protocol
(EIGRP) is implemented. EIGRP is chosen for its fast convergence, loop-free routing, and
efficient bandwidth usage.
EIGRP handles dynamic routing within the service provider’s domain and ensures high
availability and performance between customer branches.
This network architecture provides a highly reliable and secure communication flow from end-
user devices to remote branches. By integrating DHCP, VLANs, VTP, BGP, and EIGRP
appropriately, the network achieves a balance between flexibility, performance, and scalability.
Best practices include regular monitoring of firewall logs, updating routing tables, using access
control lists (ACLs) for added security, and maintaining VLAN segmentation to isolate sensitive
data.
The described setup not only meets enterprise-grade performance requirements but also allows
for future growth, integrating new technologies like SD-WAN or cloud-based routing if needed.
43
Chapter 4: Network Security Implementation using FortiGate Firewalls
In modern network infrastructures, robust security is paramount to protect sensitive data, ensure
business continuity, and maintain compliance. This chapter details the comprehensive security
implementation for our distributed network, which comprises a Headquarter office and a Branch-
1 office, interconnected via public service provider networks. The core of this security
architecture is built upon FortiGate Next-Generation Firewalls (NGFWs), deployed at both the
Headquarter and Branch-1 locations. These devices provide a multi-layered defense,
encompassing network segmentation, stateful firewalling, Network Address Translation (NAT),
and secure Site-to-Site Virtual Private Network (VPN) tunnels.
Secure Internet Access: To allow internal users in both the Headquarter and Branch-1
offices to access the Internet securely, while protecting internal networks from external
threats.
Secure Inter-Branch Communication: To establish an encrypted and authenticated
tunnel between the Headquarter and Branch-1 offices, enabling secure data exchange
between their respective internal networks over the untrusted public Internet.
44
Chapter 4: Network Security Implementation using FortiGate Firewalls
The first step in securing the network involved the initial deployment and basic network interface
configuration of the FortiGate appliances at both Branch-1 and the Headquarter. For
demonstration purposes, we will primarily detail the configuration on the Branch-1 FortiGate,
with the understanding that analogous configurations (with appropriate IP address and network
adjustments) were applied to the Headquarter FortiGate.
The FortiGate was accessed via its console interface, which provides direct command-line access
for initial setup and configuration. Upon booting the FortiGate VM in the PNETLab
environment, the device presented a login prompt:
Password:
After successfully entering the credentials, the CLI prompt FortiGate-VM64-KVM # became
available, signifying readiness for configuration commands.
Network interfaces on the FortiGate are the foundational elements for connecting to various
network segments (LAN, WAN). Each interface must be configured with an IP address, netmask,
and administrative access settings.
Objective: Assign a static IP address to port1 and enable essential administrative access for
remote management.
45
Chapter 4: Network Security Implementation using FortiGate Firewalls
edit "port1"
next
end
config system interface: This command navigates the CLI to the system interface
configuration section.
edit "port1": This command selects the interface named "port1" for configuration. If
"port1" does not exist, it will be created.
set mode static: This command configures the interface to use a static IP address, as
opposed to obtaining one via DHCP.
set ip [Link] [Link]: This command assigns the IP address [Link] with
a subnet mask of [Link] to port1. This IP address is within the network segment
provided by the Service Provider.
set allowaccess ping https ssh: This command enables specific administrative protocols
on this interface. ping allows the interface to respond to ICMP echo requests, useful for
connectivity testing. https allows secure web-based management via the Graphical User
Interface (GUI). ssh enables secure command-line access.
next: This command saves the changes for the current interface and moves to the next
entry in the configuration block (though in this case, it simply signals completion for
port1).
end: This command exits the config system interface mode, saving all pending changes
within that section.
Observed Output and Verification:
46
Chapter 4: Network Security Implementation using FortiGate Firewalls
After executing these commands, the configuration of port1 can be verified using the show
command:
The output confirms the configured IP address, mode, and allowed access protocols.
47
Chapter 4: Network Security Implementation using FortiGate Firewalls
Objective: Assign a static IP address to port2, enable administrative access, and configure its
role.
edit "port2"
next
end
48
Chapter 4: Network Security Implementation using FortiGate Firewalls
The output confirms the IP address, allowed access, and assigned role.
Note: An initial command parse error before 'dhcp-server' was encountered during an attempt to
enable DHCP directly on the interface using set dhcp-server enable. This indicated that the
DHCP server configuration required a separate, dedicated configuration section, which will be
addressed in the next section.
To automate IP address assignment for client devices within the Branch-1 LAN, a DHCP
(Dynamic Host Configuration Protocol) server was configured on the FortiGate, leveraging port2
as the interface for DHCP services.
Objective: Provide automatic IP address, default gateway, and DNS server information to
devices in the [Link]/24 network.
edit 1
config ip-range
49
Chapter 4: Network Security Implementation using FortiGate Firewalls
edit 1
next
end
next
end
config system dhcp server: Navigates to the DHCP server configuration section.
edit 1: Creates or selects DHCP server instance ID 1. FortiGate allows multiple DHCP
server configurations for different interfaces.
set interface port2: Binds this DHCP server to the port2 interface, meaning it will listen
for DHCP requests on this interface and serve IPs to clients connected to it.
set default-gateway [Link]: Informs DHCP clients that their default gateway is the
IP address of FortiGate's port2 interface.
set netmask [Link]: Provides the subnet mask for the IP addresses.
config ip-range: Enters the configuration mode for defining the IP address pool.
o edit 1: Creates or selects IP range ID 1.
o set start-ip [Link]: Sets the beginning of the IP address range.
o set end-ip [Link]: Sets the end of the IP address range.
set dns-server1 [Link]: Configures the primary DNS server for DHCP clients (Google's
Public DNS).
set dns-server2 [Link]: Configures the secondary DNS server (Google's Public DNS).
next and end: Save the DHCP server configuration.
50
Chapter 4: Network Security Implementation using FortiGate Firewalls
The DHCP server configuration was verified by checking the DHCP server settings on the
FortiGate and attempting to acquire an IP address on a client PC connected to the Branch-1
LAN.
Note: Initial attempts to configure the DHCP server directly on the interface, or using incorrect
syntax like set dns-server [Link] (instead of set dns-server1 and set dns-server2), resulted in
Command parse error or Command fail. Return code -61 errors. These issues were resolved by
adhering to the precise FortiGate CLI syntax for DHCP server configuration, specifically by
configuring it under config system dhcp server and using dns-server1/dns-server2 attributes.
Client PC Verification:
On the client PC (Windows 7 in PNETLab), the ipconfig /release and ipconfig /renew commands
were used to force a new DHCP lease. Ideally, the PC should obtain an IP address in the
[Link]-200 range, with [Link] as the Default Gateway.
Initial observations showed the client PC receiving a 169.254.x.x APIPA address, indicating a
DHCP failure. This was primarily attributed to the resource-intensive nature of the PNETLab
environment causing performance bottlenecks and preventing the DHCP process from
completing successfully. In a production environment or a more stable lab setup, the DHCP
server configuration outlined above would function as expected.
To ensure that traffic from the Branch-1 LAN destined for the Internet (or any network not
directly connected) is correctly forwarded, a default static route was configured on the FortiGate.
Objective: Direct all unknown network traffic towards the Service Provider's router, which
serves as the next hop to the Internet.
edit 1
51
Chapter 4: Network Security Implementation using FortiGate Firewalls
next
end
The routing table was inspected to confirm the presence and active status of the default route.
The output displayed the newly configured default route (S* [Link]/0 [10/0] via [Link],
port1), indicating that the FortiGate is now configured to forward traffic to the Internet.
Even with correct interface and routing configurations, no traffic will flow through the FortiGate
without explicit firewall policies. A policy was created to allow internal users from Branch-1 to
access the Internet.
Objective: Permit all outbound traffic from the Branch-1 LAN to the WAN, while performing
Network Address Translation (NAT) to allow multiple internal devices to share a single public IP.
52
Chapter 4: Network Security Implementation using FortiGate Firewalls
edit 1
next
end
53
Chapter 4: Network Security Implementation using FortiGate Firewalls
set srcaddr "all": Allows traffic from any source IP address within the srcintf zone. While
all is used for lab simplicity, in production, this would typically be a specific address
object or group representing the internal LAN subnet ([Link]/24).
set dstaddr "all": Allows traffic to any destination IP address within the dstintf zone.
Again, for lab simplicity, all is used to represent the entire Internet.
set schedule "always": Ensures the policy is active at all times.
set service "ALL": Permits all types of network services (e.g., HTTP, HTTPS, DNS, FTP,
etc.). In a production environment, this would be restricted to only necessary services for
enhanced security.
set action accept: Specifies that traffic matching this policy should be allowed.
set nat enable: Crucially, this command enables Network Address Translation (NAT) for
this traffic. When internal devices communicate with the Internet, their private IP
addresses (e.g., 192.168.10.x) are translated to the FortiGate's public IP address on port1
([Link]). This is essential for devices with private IP addresses to access the
Internet.
next and end: Save the firewall policy.
Observed Output and Verification:
The configured firewall policy was verified by displaying the firewall policy list.
Note: An initial error related to set schedule was encountered, indicating that the schedule
attribute MUST be set before attempting to exit the policy configuration. This highlights the
strict order of operations required by the FortiGate CLI for certain configuration blocks.
Establishing a secure, encrypted communication channel between Branch-1 and the Headquarter
office is a critical security requirement. An IPsec Site-to-Site VPN tunnel was configured on both
FortiGate devices to facilitate this. The configuration process involves defining two distinct
phases: Phase 1 (IKE) and Phase 2 (IPsec).
54
Chapter 4: Network Security Implementation using FortiGate Firewalls
Phase 1 (Internet Key Exchange, or IKE Phase 1) is responsible for establishing a secure,
authenticated channel between the two VPN endpoints. This channel, known as the IKE Security
Association (SA), protects the negotiation of the actual IPsec tunnel parameters in Phase 2.
Objective: Define the parameters for the initial secure connection, including authentication,
encryption, and key exchange algorithms.
edit "To-HQ-VPN"
set psksecret your_secret_key_here # This key must be strong and identical on both
FortiGates
# Attempting to set proposal using standard syntax - known CLI parsing issue
set dhgrp 14 5
55
Chapter 4: Network Security Implementation using FortiGate Firewalls
next
end
config vpn ipsec phase1-interface: Navigates to the IPsec VPN Phase 1 configuration
section.
edit "To-HQ-VPN": Creates or selects the Phase 1 tunnel entry named "To-HQ-VPN".
This name is a logical identifier for the VPN tunnel.
set interface port1: Specifies that the VPN tunnel will originate and terminate on the
port1 interface of the Branch-1 FortiGate. This is the internet-facing interface.
set remote-gw [Link]: Defines the IP address of the peer (the Headquarter FortiGate's
WAN interface). This is the public IP address that the Branch-1 FortiGate will connect to
for VPN establishment.
set psksecret your_secret_key_here: Sets the Pre-shared Key (PSK) for authentication.
This is a crucial security element and must be an identical, complex string on both VPN
endpoints.
set mode main: Configures the IKE exchange mode to "Main Mode". Main Mode is
preferred for its enhanced security features, including identity protection, by performing a
six-message exchange.
unset proposal: This command was crucial to clear previous failed attempts at setting the
proposal using various syntaxes that resulted in Command parse error or Command fail.
Return code -61.
set enc aes128: Specifies the encryption algorithm for Phase 1. AES128 (Advanced
Encryption Standard with 128-bit key) provides strong encryption.
set auth sha1: Specifies the authentication algorithm for Phase 1. SHA1 (Secure Hash
Algorithm 1) provides data integrity verification.
o Note on set proposal vs. set enc/set auth: During the project, significant
challenges were faced with the set proposal command due to specific CLI parsing
limitations in the FortiOS version in use within PNETLab. Multiple attempts with
56
Chapter 4: Network Security Implementation using FortiGate Firewalls
This command confirms the parameters set for the To-HQ-VPN tunnel.
Phase 2 (IPsec Phase 2) defines the parameters for the actual data tunnel, including the
encryption and authentication methods for the user data traffic, and specifies which local and
remote networks will communicate through this tunnel.
Objective: Define the security parameters for data encryption and specify the subnets that will
be allowed to communicate over the VPN tunnel.
57
Chapter 4: Network Security Implementation using FortiGate Firewalls
edit "To-Headquarter-P2"
set proposal aes128-sha1 # Assuming this format now works or was configured via GUI
# If set proposal still fails, could consider separate enc/auth here too if necessary.
next
end
config vpn ipsec phase2-interface: Enters the IPsec VPN Phase 2 configuration section.
edit "To-Headquarter-P2": Creates or selects a Phase 2 selector named "To-Headquarter-
P2". This is a logical name for the data tunnel's parameters.
set phase1name "To-HQ-VPN": Links this Phase 2 configuration to the previously
defined Phase 1 tunnel named "To-HQ-VPN". This association is critical for the VPN
tunnel to form.
set proposal aes128-sha1: Sets the encryption and authentication algorithms for Phase 2.
These should typically match the algorithms chosen in Phase 1 for compatibility, but
FortiGate allows different (usually stronger) algorithms for Phase 2.
o Note: If the set proposal command continued to fail in the CLI for Phase 2,
similar to Phase 1, the set enc aes128 and set auth sha1 commands would be used
instead.
58
Chapter 4: Network Security Implementation using FortiGate Firewalls
set src-subnet [Link] [Link]: Defines the local network(s) that will be
allowed to send traffic over this VPN tunnel. This specifies the entire Branch-1 LAN.
set dst-subnet [Link] [Link]: Defines the remote network(s) that traffic can
reach via this VPN tunnel. This specifies the primary LAN segment at the Headquarter.
o If there were multiple networks at the Headquarter (e.g., [Link]/24), these
would ideally be defined using a FortiGate Address Group object, and then set
dst-address <address_group_name> would be used instead of set dst-subnet for
each individual subnet. This provides a more scalable and manageable approach.
set keylife-type seconds and set keylifeseconds 3600: Sets the lifetime of the Phase 2 SA
to 3600 seconds (1 hour). After this period, a new IPsec SA will be negotiated without
interrupting traffic flow.
set pfs enable: Enables Perfect Forward Secrecy (PFS). PFS ensures that if a future
session key is compromised, it does not compromise past session keys.
set dhgrp 14 5: Specifies the Diffie-Hellman groups for PFS. It is best practice to use the
same or stronger DH groups than those used in Phase 1.
next and end: Save the Phase 2 configuration.
Initially, show vpn ipsec phase2-interface showed an empty configuration (end), confirming that
Phase 2 was not yet set up, which contributed to the VPN tunnel being down (run_state=0) as
seen in diagnose vpn tunnel list output.
For traffic to correctly traverse the VPN tunnel, a static route must be configured on Branch-1
FortiGate, directing traffic destined for the Headquarter's internal networks through the To-HQ-
VPN virtual interface.
Objective: Ensure that the FortiGate knows to send traffic for the Headquarter LAN via the
IPsec tunnel.
59
Chapter 4: Network Security Implementation using FortiGate Firewalls
next
end
set dst [Link] [Link]: Specifies the destination network for this route, which
is the Headquarter's internal LAN.
set device "To-HQ-VPN": Points the route to the logical IPsec VPN interface name. This
is how the FortiGate knows to encapsulate the traffic and send it through the tunnel.
set gateway [Link]: For a VPN tunnel interface, the gateway is often set to [Link] as the
next-hop is the VPN peer itself, handled by the tunnel.
Just like Internet access, traffic traversing the VPN tunnel requires explicit firewall policies to
permit it. Two policies are typically needed: one for traffic originating from the Branch-1 LAN
going to the Headquarter LAN, and another for return traffic from Headquarter LAN to Branch-1
LAN.
Objective: Allow secure bidirectional communication between the Branch-1 LAN and the
Headquarter LAN over the IPsec VPN tunnel.
60
Chapter 4: Network Security Implementation using FortiGate Firewalls
set nat disable # NAT is not typically used over VPN tunnels for internal traffic
next
edit 3
next
61
Chapter 4: Network Security Implementation using FortiGate Firewalls
end
set srcintf "port2" and set dstintf "To-HQ-VPN": For outbound traffic from Branch-1 to
Headquarter, the source is the local LAN interface, and the destination is the VPN tunnel
interface.
set srcintf "To-HQ-VPN" and set dstintf "port2": For inbound traffic from Headquarter to
Branch-1, the source is the VPN tunnel interface, and the destination is the local LAN
interface.
set srcaddr and set dstaddr: These define the specific internal subnets allowed to
communicate over the VPN. In this case, [Link]/24 (Branch-1 LAN) and
[Link]/24 (Headquarter LAN).
set nat disable: It is crucial to disable NAT for VPN traffic between internal networks.
The goal of a Site-to-Site VPN is to allow direct, secure communication between private
IP addresses without translation.
The Headquarter FortiGate requires an analogous VPN configuration to establish the other end of
the tunnel. The key difference is that the 'local' and 'remote' parameters are swapped.
edit "To-Branch1-VPN"
set interface port_wan_hq # Assuming this is the WAN interface name for HQ
62
Chapter 4: Network Security Implementation using FortiGate Firewalls
set dhgrp 14 5
next
end
edit "To-Branch1-P2"
set dhgrp 14 5
next
end
Note: If Headquarter has multiple LANs (e.g., [Link]/24), these would also be included in
src-subnet or via address groups in dstaddr on Branch-1, and vice-versa.
63
Chapter 4: Network Security Implementation using FortiGate Firewalls
edit 2 # Or appropriate ID
next
end
edit 2 # Or appropriate ID
next
64
Chapter 4: Network Security Implementation using FortiGate Firewalls
edit 3 # Or appropriate ID
next
end
After configuring both ends of the VPN tunnel, the operational status of the VPN was checked.
Initially, this command showed run_state=0 for the To-HQ-VPN tunnel, indicating that the
tunnel was not established due to incomplete configuration (missing Phase 2) or peering issues
(Headquarter FortiGate not yet configured or reachable). Upon successful configuration of both
Phase 1 and Phase 2 on both FortiGates, and ensuring network reachability between their WAN
interfaces, the run_state would typically transition to up or established, indicating an active VPN
tunnel.
65
Chapter 4: Network Security Implementation using FortiGate Firewalls
While the core security implementation focuses on basic firewalling and VPN connectivity,
FortiGate firewalls offer a comprehensive suite of advanced security features that are critical for
a robust enterprise security posture. Although not fully implemented in this specific lab scenario
due to scope or environmental constraints, it is imperative to acknowledge their importance and
how they would be integrated in a production deployment.
FortiGates are renowned for their Unified Threat Management (UTM) or Next-Generation
Firewall (NGFW) capabilities, which provide deep packet inspection and multi-layered threat
protection. These features are applied via "Security Profiles" within firewall policies.
Antivirus: Scans incoming and outgoing traffic for known malware, viruses, and other
malicious executables.
o CLI Integration:
edit <policy_id>
next
end
Web Filtering: Controls user access to websites based on categories, URLs, and ratings.
This prevents access to malicious, inappropriate, or unproductive websites.
o CLI Integration:
edit <policy_id>
66
Chapter 4: Network Security Implementation using FortiGate Firewalls
next
end
Application Control: Identifies and controls specific applications (e.g., social media,
file-sharing, streaming services) regardless of the port or protocol they use. This helps in
enforcing acceptable use policies and reducing bandwidth consumption by non-business
applications.
o CLI Integration:
edit <policy_id>
next
end
edit <policy_id>
next
end
67
Chapter 4: Network Security Implementation using FortiGate Firewalls
Comprehensive logging is essential for monitoring network activity, detecting security incidents,
and performing forensics. FortiGates generate detailed logs covering traffic, events, and security
detections.
Local Logging: Storing logs directly on the FortiGate's internal memory or disk.
Remote Logging to FortiAnalyzer: For centralized logging, correlation, and reporting,
FortiGates should be configured to send logs to a FortiAnalyzer appliance. This is critical
for large-scale deployments and compliance.
set ip <FortiAnalyzer_IP_Address>
end
Event Logging: Capturing critical system events, user logins, configuration changes, and
security alerts.
Traffic Logging: Recording details of network sessions, including source/destination
IPs, ports, and bytes transferred.
68
Chapter 4: Network Security Implementation using FortiGate Firewalls
Regular review of logs and automated alerts configured through FortiAnalyzer are paramount for
proactive security posture management.
For mission-critical environments, single points of failure must be eliminated. FortiGates support
High Availability (HA) configurations, typically in an Active-Passive or Active-Active cluster.
Benefits of HA:
Redundancy: If one FortiGate unit fails, the other seamlessly takes over, ensuring
continuous network operation.
Load Balancing (Active-Active): In some HA modes, traffic can be distributed across
multiple FortiGate units, enhancing performance.
HA Implementation Considerations:
config system ha
set group-id 1
end
69
Chapter 4: Network Security Implementation using FortiGate Firewalls
Note: Implementing HA would require additional physical or virtual interfaces and careful
planning for seamless failover.
end
The security implementation detailed in this chapter lays a robust foundation for protecting the
distributed network of the Headquarter and Branch-1 offices. By meticulously configuring
FortiGate interfaces, DHCP services, static routes, and essential firewall policies, basic Internet
access and secure inter-branch communication via IPsec VPN have been established. The
70
Chapter 4: Network Security Implementation using FortiGate Firewalls
detailed CLI commands and accompanying screenshots demonstrate the practical steps involved
in hardening network perimeters.
71
Chapter 5: Wireshark
chapter6: Wireshark
6.1 INTRODUCTION
As part of our graduation project, which involves designing or analyzing a virtual network using
the PnetLab platform, we utilized Wireshark as a key tool to monitor and analyze packet flow
across network devices. Wireshark provides detailed visibility into how data moves between
devices, helping us troubleshoot configurations, verify connectivity, and better understand
network behavior.
Platform: PnetLab
Devices Used:
o Cisco Routers and Switches
o Virtual Machine (Ubuntu or Kali Linux)
Traffic Type: Internal (LAN), NAT, or Bridged traffic
Traffic Type: Internal (LAN), NAT, or Bridged traffic
72
Chapter 5: Wireshark
A simple network topology was created in PnetLab (e.g., Router ↔ Linux VM).
Devices were configured and tested using ping, HTTP, and DNS.
Wireshark was launched on the VM and set to capture traffic on interface eth0.
Filters were applied to narrow down traffic based on protocols or IP addresses:
o icmp for ping traffic
o http for web traffic
o [Link] == [Link] to focus on a specific IP
73
Chapter 5: Wireshark
Wireshark was used exclusively within a private, virtual lab environment created for academic
purposes. No external or unauthorized network monitoring was conducted.
6.9 CONCLUSION
Using Wireshark in the graduation project provided significant practical value. It allowed us to
bridge the gap between theoretical networking concepts and real-world implementation,
enhancing the project’s quality and technical depth. The data gathered through Wireshark
supported troubleshooting, performance analysis, and deeper understanding of protocol behavior.
74
Chapter 6: Socket Chat Application
Socket Chat
7.1.2 Description
A basic multi-client chat application built using Python's socket programming. It allows users to
connect to a server and communicate via a GUI. The project consists of two files:
[Link]: The server that handles connections, messaging, and user management.
[Link]: The server that handles connections, messaging, and user management.
Python 3
socket (for networking)
threading (to handle multiple clients concurrently)
tkinter (for building the GUI)
75
Chapter 6: Socket Chat Application
Server Initialization:
server_socket = [Link](...)
server_socket.bind(('[Link]', 10319))
server_socket.listen(5)
[Link](target=accept_connections).start()
Socket Initialization:
76
Chapter 6: Socket Chat Application
self.client_socket.connect(('[Link]', 10319))
Block/Unblock Events:
GUI Layout:
Name input
Chat history box
Message entry box
Join button
try/except blocks ensure that socket errors or disconnects do not crash the app
Graceful shutdown when closing the window or on network failur
77
Chapter 6: Socket Chat Application
python [Link]
78
Chapter 6: Socket Chat Application
python [Link]
79