0% found this document useful (0 votes)
14 views60 pages

FOC Module3

The document provides an overview of computer system software, focusing on operating systems, their functions, types, and basic commands in Linux and Windows. It explains the distinction between system software and application software, details the services provided by operating systems, and outlines various types of operating systems based on user type, functionality, and device type. Additionally, it covers essential Linux commands and introduces shell scripting concepts, including variable usage and control flow structures.

Uploaded by

gowri.vj
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views60 pages

FOC Module3

The document provides an overview of computer system software, focusing on operating systems, their functions, types, and basic commands in Linux and Windows. It explains the distinction between system software and application software, details the services provided by operating systems, and outlines various types of operating systems based on user type, functionality, and device type. Additionally, it covers essential Linux commands and introduces shell scripting concepts, including variable usage and control flow structures.

Uploaded by

gowri.vj
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Module 3

Computer system software-Operating system,Basic commands in Linux/Windows,shell


scripting(bash),Computer communications-LAN,MAN ,WAN,Client server
network,peer to peer network,Topologies,Basics of IP address, DHCP, NAT,Network
security(desktop and perimeter), DNS,VPN,Routers ,Client-Server,Internet,WWW,web
server
_______________________________________________________
Computer System Software
Software is a collection of programs that enable a computer to perform specific tasks. It is
broadly classified into two types:
● System Software
● Application Software
System software is a set of computer programs, which is designed to manage system
resources. It is a collection of such files and utility programs that are responsible for running
and smooth functioning of your computer system with other [Link] inlcudes
1. Operating Systems (OS) – Manages hardware and software resources. Examples:
Windows, Linux, macOS.
2. Utility Programs – Helps in system maintenance (e.g., antivirus, disk cleanup tools).
3. Device Drivers – Allows communication between hardware devices and the OS (e.g.,
printer drivers).
4. Firmware – Embedded software in hardware devices, such as BIOS
Application Software is a type of software that is mainly developed to perform a specific
task as per the user's request. It acts as an interface between the end-user and system
software.
example:Ms Word,whatsapp
Operating System
An Operating System (OS) is a system software that manages computer hardware and
software, providing an interface between users and the system.
Services and Facilities
● The user interface, command processor, and application program interface
● The file management system
● The input/output control system
● Process control management and interprocess communication
● Memory management
● Scheduling and dispatching
● Secondary storage management
● Network management, communication support, and communication interfaces
● System protection management and security
● Support for system administration.

1. The User Interface, Command Processor, and Application Program Interface:


This component provides the means for users and programs to interact with the operating
system. The user interface can be graphical (GUI) or command-line (CLI), while the
command processor interprets and executes commands entered by users. The API allows
applications to request services from the OS in a standardized way.

2. The File Management System:


It organizes and manages data storage on devices like hard drives, including file creation,
deletion, reading, writing, and access control. It maintains directories, handles metadata, and
ensures data integrity.

3. The Input/Output Control System:


This manages communication between the computer and its external devices such as
keyboards, printers, and drives. It includes device drivers and I/O scheduling to efficiently
process data transfers.

4. Process Control Management and Interprocess Communication:


This handles the creation, execution, and termination of processes. It also provides
mechanisms (like message passing or shared memory) for processes to communicate and
synchronize with each other.

5. Memory Management:
It allocates and tracks memory usage for programs and processes. It ensures efficient
memory usage, handles virtual memory, and protects memory spaces of different processes.

6. Scheduling and Dispatching:


The OS decides which process runs at any given time using scheduling algorithms.
Dispatching is the actual act of handing the CPU to the chosen process.

7. Secondary Storage Management:


It manages long-term storage devices like hard drives and SSDs. This includes space
allocation, organization of data blocks, and ensuring data is retrievable and secure.

8. Network Management, Communication Support, and Communication Interfaces:


This ensures smooth communication over networks by managing network connections,
protocols, and data exchange. It also provides APIs and services to support networked
applications and internet access.

9. System Protection Management and Security:


This involves enforcing access control policies and protecting against unauthorized access or
attacks. It ensures confidentiality, integrity, and availability of system resources.

10. Support for System Administration:


The OS provides tools and utilities for system maintenance, performance monitoring, and
configuration. This includes user account management, software installation, and system
diagnostics. Some administrative function include

● System configuration and setting group configuration policies


● Adding and deleting users
● Controlling and modifying user privileges to meet the changing needs of the users
● Providing and monitoring appropriate security
● Managing, mounting, and unmounting file systems
● Managing, maintaining, and upgrading networks
● Providing secure and reliable backups
● Providing and controlling software, installing new software, and upgrading software
as required.

Types of Operating Systems

Operating Systems Based on User Type:

1. Single-User Operating System

● Designed for one user at a time.

● Only one person can operate and access system resources.

● Common in personal computers and simple devices.

Examples:

● MS-DOS

● Windows 95/98

● macOS (basic usage)

2. Multi-User Operating System

● Allows multiple users to access the system simultaneously or at different times.

● OS manages user sessions, permissions, and resource sharing.

● Common in servers, mainframes, and enterprise environments.

Examples:

● UNIX

● Linux (Ubuntu Server, CentOS)

● Windows Server editions

Operating Systems Based on Functionality:

1. Batch Operating System

● Executes a batch of jobs without user interaction.

● Jobs are collected, grouped, and run sequentially.


● Ideal for repetitive tasks and large-scale data processing.

Example: IBM OS/360, early UNIX

2. Time-Sharing (Multitasking) Operating System

● Allows multiple tasks/users to share system resources at the same time.

● CPU switches rapidly between tasks, giving the illusion of parallelism.

● Ensures better response time and user interaction.

Example: UNIX, Windows, Linux

3. Real-Time Operating System (RTOS)

● Responds to inputs within a fixed time constraint.

● Used in systems where timing is critical like medical, military, or embedded systems.

● Divided into hard and soft real-time systems.

Example: VxWorks, RTLinux, FreeRTOS

4. Distributed Operating System

● Manages multiple computers as a single system.

● Coordinates resources across a network to increase performance, reliability, and


scalability.

Example: LOCUS, Amoeba, Windows Server with clustering

5. Network Operating System

● Provides services like file sharing, remote login, and printer access over a network.

● Users are aware of multiple independent systems.

Example: Novell NetWare, Windows Server, UNIX/Linux with Samba

6. Mobile Operating System

● Designed for mobile devices with touch interfaces, limited resources, and battery
constraints.
● Optimized for power management, app handling, and communication.

Example: Android, iOS

Operating Systems Based on Device Type:

1. Desktop Operating System

● Designed for personal computers and laptops.

● Supports GUI, multitasking, multimedia, and general-purpose computing.

● User-friendly, with support for a wide range of hardware and software.

Examples:

● Windows 10/11

● macOS

● Ubuntu (Linux)

2. Server Operating System

● Designed to manage and serve multiple client systems.

● Optimized for networking, resource management, security, and uptime.

● Supports multi-user environments and enterprise applications.

Examples:

● Windows Server

● Red Hat Enterprise Linux

● Ubuntu Server

● UNIX

3. Mobile Operating System

● Built for smartphones, tablets, and wearable devices.

● Lightweight, touch-optimized, with efficient power and memory management.


● Supports mobile apps, sensors, and wireless communication.

Examples:

● Android

● iOS

● HarmonyOS

4. Embedded Operating System

● Installed in embedded systems like IoT devices, appliances, cars, etc.

● Real-time or near real-time with minimal resource usage.

● Highly specialized and tailored to specific hardware.

Examples:

● FreeRTOS

● Embedded Linux

● VxWorks

● QNX

5. Mainframe Operating System

● Designed for mainframe computers that handle large-scale transaction processing


and bulk data.

● Supports thousands of simultaneous users and high reliability.

Examples:

● IBM z/OS

● UNIX variants

6. Supercomputer Operating System

● Built for high-performance computing (HPC) tasks like scientific simulations.


● Optimized for parallel processing and resource scheduling.

Examples:

● Cray Linux Environment (CLE)

● Linux-based custom HPC OS (like CentOS, RHEL variants)

Linux commands

1. ls – List Directory Contents

● Syntax: ls [options] [directory]


Example:
ls – lists files in the current directory
ls -l – detailed list (long format)
ls /home/user/Documents – list files in a specific folder

2. mkdir – Make Directory

● Syntax: mkdir [directory_name]


Example:
mkdir myfolder – creates a folder named myfolder

3. cd – Change Directory

● Syntax: cd [directory_name]
Example:
cd Documents – moves into Documents directory
cd .. – goes one level back (to parent directory)
cd ~ – moves to the home directory

4. pwd – Print Working Directory

● Syntax: pwd
Example:
pwd – displays the current directory path (e.g., /home/user)

5. cp – Copy Files or Directories

● Syntax: cp [source] [destination]

● Example:
cp [Link] backup/ – copies [Link] into backup/ folder
cp -r folder1/ folder2/ – copies a folder and its contents

6. mv – Move or Rename Files/Directories


● Syntax: mv [source] [destination]
Example:
mv [Link] /home/user/Desktop/ – moves file to Desktop
mv [Link] [Link] – renames a file

7. cat – Display Contents of a File

● Syntax: cat [filename]


Example:
cat [Link] – displays contents of [Link]
cat [Link] [Link] > [Link] – merges files into [Link]

8. Redirection (> and >>)

● Syntax:
○ command > file – redirects output to a file (overwrite)

○ command >> file – appends output to the file

Example:
ls > [Link] – saves the output of ls to [Link]
echo "Hello" >> [Link] – appends "Hello" to the file

9. grep – Search for Text in Files

● Syntax: grep [pattern] [file]


Example:
grep "hello" [Link] – finds lines containing "hello" in [Link]
grep -i "test" [Link] – case-insensitive search

10. man – Manual Pages

● Syntax: man [command]


Example:
man ls – shows manual/help for ls command
Press q to quit the manual page

11. chmod – Change File Permissions

Each file/directory has 3 sets of permissions:

● User (u) – the file owner

● Group (g) – users in the same group as the file

● Others (o) – everyone else

And 3 types of permissions:


Symbol Permission Description

r Read View file content or list directory

w Write Modify file or add/remove files in a directory

x Execute Run the file as a program or enter a directory

Numeric (Octal) Mode

Permissions can be set using numbers:

Number Symbol Meaning

0 --- No permission

1 --x Execute only

2 -w- Write only

3 -wx Write and execute

4 r-- Read only

5 r-x Read and execute

6 rw- Read and write

7 rwx Read, write, execute

● Syntax: chmod [permissions] [file]


Example:
chmod 755 [Link] – gives read/write/execute to owner, read/execute to others
chmod +x [Link] – makes the script executable

12. rmdir – Remove Empty Directory

● Syntax: rmdir [directory_name]

● Example:
rmdir myfolder – removes the empty folder named myfolder
(Use rm -r if the folder is not empty)

Shell Scripting

A shell is software that gives a user interface to various operating system functions and
services. Shells provide a way for you to communicate with the operating [Link]
communication is carried out either interactively input from the keyboard is acted upon
immediately or as a shell script.

Types of Shells

Common types of shells include:

1. Bourne Shell (sh)

2. Bash (Bourne Again Shell) - Default in most Linux distributions

3. C Shell (csh)

4. Korn Shell (ksh)

5. Z Shell (zsh)

A shell script is a file containing a series of commands that can be executed.

Creating a Shell Script

1. Open a terminal.

2. Use a text editor to create a new script file, e.g., nano [Link].

3. Start the script with a shebang (#!) followed by the shell path:

#!/bin/bash
4. Then write the [Link] example,
echo "Hello, World!"

5. Save and exit.

6. Give execution permission: chmod +x [Link]


7. Run the script: sh [Link]

[Link]: Shell scripts use variables to store values.

Eg: name="John Doe"


echo "Hello, $name!"
[Link] read from the user : We can simply get user input from the ‘read’ command in shell programming.
Eg: echo "Enter your name: "
read user_name
echo "Hello, $user_name!"
[Link]
echo "Enter number 1 : " # -n option supresses newline
read NUM1 # Read the user input from Standard Input and store in Variable NUM1
echo "Enter number 2 : "
read NUM2
SUM=$(($NUM1 + $NUM2)) # Arithmetic expansion using double parentheses
echo "The sum is $SUM"
or
SUM=`expr $NUM1+$NUM2`# Arithmetic expansion using backticks
4. if statement :This block will process if the specified condition is true.
Syntax:
if [ expression ]
then
statement
fi
eg: echo -n "Enter number 1 : " # -n option supresses newline
read NUM1 # Read the user input from Standard Input and store in Variable NUM1
echo -n "Enter number 2 : "
read NUM2
if [ $NUM1 -gt $NUM2 ] # -gt is to test integer numbers
then
echo "NUM1 > NUM2"
fi
5. if-else statement :If specified condition is not true in if part then else part will be execute.
Syntax
if [ expression ]
then
statement1
else
statement2
fi
eg:
NUM1=2 # Variable assignment
NUM2=5

if [ $NUM1 -lt $NUM2 ] # -lt is to test integer numbers


then
echo "NUM1 < NUM2"
else
echo "NUM1 > NUM2"
fi

[Link]..elif..else..fi statement (Else If ladder)


To use multiple conditions in one if-else block, then elif keyword is used in shell. If expression1 is true then
it executes statement 1 and 2, and this process continues. If none of the condition is true then it processes
else part.
Syntax
if [ expression1 ]
then
statement1
statement2
.
.
elif [ expression2 ]
then
statement3
statement4
.
.
else
statement5
fi
eg: echo -n "Enter a number: "
read NUM
if [ $NUM -gt 0 ]
then
echo "$NUM is +ve"
elif [ $NUM -lt 0 ]
then
echo "$NUM is -ve"
else
echo "$NUM is 0"
fi

echo "done"

[Link] statement: case statement is a control flow structure that allows you to execute one of many
code blocks based on the value of an [Link] is often used in place of if-else ladder when there
are multiple conditional [Link] statement works as a switch statement if specified value match
with the pattern then it will execute a block of that particular patternWhen a match is found all of
the associated statements until the double semicolon (;;) is executed.A case will be terminated when
the last command is [Link] there is no match, the exit status of the case is zero.
echo -n "Enter a character: "
read CHAR
case $CHAR in
a) echo "You entered $CHAR which is a vowel";; # ;; Terminates each option
e) echo "You entered $CHAR which is a vowel";;
i) echo "You entered $CHAR which is a vowel";;
o) echo "You entered $CHAR which is a vowel";;
u) echo "You entered $CHAR which is a vowel";;
*) echo "You entered $CHAR which is not a vowel";; # Defaults to everything else
esac
Looping Statements

[Link] loop

while loop syntax -

While condition_is_true

do

//execute commands

done

Example:

COUNT=0

while [ $COUNT -lt 50 ]

Do

echo "Loop count is ${COUNT}"

COUNT=$((COUNT + 1))

done

echo "Done"

for loop

for loop syntax :

for variable in list

do
//execute commands

done

Example:

for x in 1 2 3 4 5

do

echo "The value of x is $x";

done

if's companion - test

test is an internal feature of the shell. 'test' evaluates the condition placed on its right, and
returns either a true or false exit status. For this purpose, 'test' uses certain operators to
evaluate the condition. They are as follows:
Relational Operators

● -eq - Equal to
● -lt - Less than
● -gt - Greater than
● -ge - Greater than or Equal to
● -le - Less than or Equal to

Example

. Shell script to check for even or odd

#!/bin/bash

echo "Enter a number"

read a

if [ $(( $a % 2 )) -eq 0 ]

then

echo "Even number"

else

echo "Odd number"

fi

Shell script to simulate a menu driven calculator

#!/bin/bash
k= "y"
echo "-----------------"
echo "Simple Calculator"
echo "-----------------"
while [ $k=="y" ]
do
echo "Enter two numbers"
read a
read b
echo "choose operation :"
echo "+"
echo "-"
echo "*"
echo "/"
read op
case $op in
'+') echo "$a + $b = `expr $a + $b`";;
'-') echo "$a - $b = `expr $a - $b`";;
'*') echo "$a x $b = `expr $a \* $b`";;
'/') echo "$a / $b = `expr $a / $b`";;
esac
echo "continue ? [y/n]"
read k
if [ $k != "y" ]
then
exit
fi

done

Computer Communication
Computer communication refers to the process of sharing data and information between
computing devices over a network.

Basic Data Communication Concepts


[Link], Packets, and Channels

Message

A message is the information or data sent from one device (sender) to another (receiver). It
can be text, audio, video, or binary data.

Packet

A packet is a small unit of data into which a large message is divided for transmission across
a network. Each packet includes:

● Header (control information)

● Payload (actual data)

● Trailer (error checking)

Channel

A channel is the physical or logical medium used for communication between sender and
receiver.

[Link] Characteristics

Medium

The transmission medium is the path through which data travels from source to destination. It
is categorized as:

A. Guided Media (Wired)

● Uses physical cables like twisted pair, coaxial cable, and fiber optics.

● More secure and less prone to interference.

● Suitable for short to medium distances.

B. Unguided Media (Wireless)

● Uses radio waves, microwaves, and infrared for transmission.

● No physical connection between sender and receiver.


● Suitable for mobile and long-distance communication.

[Link] Transmission

A. Serial Transmission

● Sends data bit by bit, one after the other.

● Suitable for long-distance communication (e.g., USB, Ethernet).

B. Parallel Transmission

● Sends multiple bits simultaneously using multiple channels.

● Faster but limited to short distances (e.g., internal computer buses).

4. Directionality

A. Simplex

● Data flows in one direction only.

● Example: TV broadcast.

B. Half Duplex

● Data flows in both directions, but one direction at a time.

● Example: Walkie-talkies.

C. Full Duplex

● Data flows in both directions simultaneously.

● Example: Telephone communication.

5. Carrier, Modulation & Demodulation

Carrier Signal

● A carrier is a high-frequency signal used to transmit data over long distances.

Modulation
● The process of combining a message signal with a carrier wave to transmit over a
medium.

● Types:

○ Amplitude Modulation (AM)

○ Frequency Modulation (FM)

○ Phase Modulation (PM)

Demodulation

● The reverse process of extracting the original message from the modulated carrier
signal at the receiver end.

The networks can be classified based on their coverage area and the technology they use. The
most common types are LAN (Local Area Network), WAN (Wide Area Network), and
MAN (Metropolitan Area Network).

1. Local Area Network (LAN)

A LAN is a network that connects computers and devices within a limited geographical
area, such as a home, office, or school building.

Features:

● Covers a small area (typically within a few kilometers).

● High data transfer rate (usually 100 Mbps to 1 Gbps or higher).

● Generally owned and managed by a single organization.


● Uses Ethernet cables, Wi-Fi, switches, and routers.

Network Devices in LAN

Router

● Connects multiple networks, including LAN to the Internet.

● Routes data based on IP addresses.

Hub

● Broadcasts data to all connected devices.

● Does not filter or manage traffic.

● Rarely used now due to inefficiency.

Switch

● Intelligently forwards data to specific devices using MAC addresses.

● More efficient than hubs.

Repeater

● Boosts signal strength over long distances.

● Used in wired and wireless networks to extend range.

Advantages:

● High speed and low latency.

● Easy to set up and manage within a small area.

● Cost-effective for small organizations.

Disadvantages:

● Limited to a small geographical range.

● Security can be a concern if not properly configured.


Examples:

● Office network connecting multiple desktop computers.

● Wi-Fi network in a home or classroom.

Ethernet

Ethernet is the most common wired LAN technology, using protocols like IEEE 802.3. It
defines rules for data formatting, addressing, and transmission using:

● Twisted-pair cables or fiber optics

● MAC addresses for device identification

● CSMA/CD for collision detection in older systems

Wireless Ethernet

Also known as Wi-Fi, it enables wireless LAN connections using IEEE 802.11 standards.

Access Point (AP):

● A device that connects wireless clients to a wired LAN.

● Acts as a central transmitter and receiver for WLAN traffic.

2. Metropolitan Area Network (MAN)

A MAN connects multiple LANs within a city or metropolitan area. It is larger than a LAN
but smaller than a WAN.
Features:

● Covers a city-sized area (several kilometers to tens of kilometers).

● Typically owned by a service provider or large organization.

● Uses fiber optic cables and other high-speed transmission media.

● Bridges the gap between LAN and WAN.

Advantages:

● Fast communication within a city.

● Supports multiple LANs with efficient data exchange.

● Useful for businesses with branches across a city.

Disadvantages:

● More complex and expensive than LAN.

● May require special permissions and coordination with ISPs.

Examples:

● A city's government network linking municipal buildings.

● A university campus network spread across the city.

Components

Service Provider

● Provides internet or network services over MAN.

● Examples: Local ISPs, cable operators, telecom companies.

Edge Router

● Connects the internal MAN network to external networks, such as the Internet.

● Also used for traffic filtering and routing at the edge of a network.

ISP (Internet Service Provider)


● A company that provides Internet access.

● ISPs maintain MAN/WAN infrastructure and offer services to homes, offices, and
businesses.

3. Wide Area Network (WAN)

A WAN is a network that spans a large geographical area, such as a country, continent, or
even the globe.

Features:

● Covers large distances (hundreds to thousands of kilometers).

● Slower speeds compared to LANs due to long-distance transmission.

● Uses public networks (like the Internet), satellites, and leased lines.

● Typically managed by multiple service providers.

Advantages:

● Enables global communication.


● Connects branch offices, data centers, and remote users.

● Facilitates cloud computing and remote access.

Disadvantages:

● Slower and less secure than LAN/MAN.

● High setup and maintenance cost.

● Depends on third-party infrastructure.

Examples:

● The Internet (largest WAN).

● Multinational companies connecting offices across countries.

PSTN (Public Switched Telephone Network)

● A traditional circuit-switched telephone network.

● Forms the backbone for many WAN connections and dial-up internet access.

● Now often used in combination with modern digital technologies (e.g., DSL).

Comparison Table

Feature LAN MAN WAN

Coverage Area Building or campus City or large town Country or world

Speed High Medium to high Lower than LAN/MAN

Ownership Private Private or public Usually public

Cost Low Medium High


Technology Ethernet, Wi-Fi Fiber optics, Ethernet Satellites, leased lines
Used

Client Server networks

A client-server network is a type of network architecture where multiple client devices (like
computers or smartphones) request and receive services from a centralized server.

Client: A device or program that requests services (e.g., web browsers, email clients).

Server: A powerful computer or program that provides services or resources such as files,
data, applications, or network access.

Working

A client sends a request to the server (e.g., requesting a web page).

The server processes the request and sends the required information back to the client.

The process continues as long as the client needs services.

Features:

● Centralized control: Data and resources are managed centrally on the server.

● Scalability: Easy to add more clients or upgrade server capabilities.

● Security: Easier to enforce security policies and backups at the server level.
● Dedicated services: Servers are optimized for specific tasks like file sharing, printing,
web hosting, etc.

Advantages:

● Efficient data management

● Centralized backups and security

● Easy maintenance and updates

● Supports multiple clients simultaneously

Disadvantages:

● High setup and maintenance cost (especially for servers)

● Server dependency – if the server fails, all services may be disrupted

● Requires skilled administration

Examples:

● A company email system where all emails are stored and managed by a central mail
server.

● Websites accessed using a browser (the client) that communicate with web servers.

● Online games where a central game server manages player interactions.

Peer to peer Network


A Peer-to-Peer (P2P) network is a type of network where each computer (called a "peer")
acts as both a client and a server. All peers have equal responsibilities and capabilities in
sharing resources and [Link] networks do not involve a large number of nodes,
usually less than 12. All the computers in the network store their own data but this data is
accessible by the group. Unlike client-server networks, P2P uses resources and also provides
them. This results in additional resources if the number of nodes increases. It requires
specialized software. It allows resource sharing among the network.

Features:

● Decentralized structure

● Equal privileges among devices

● Typically supports fewer devices (10–15 computers)

● Often used for file sharing and collaborative work

Advantages:

● Low cost – no need for a dedicated server

● Simple to set up and maintain

● No central point of failure

● Efficient for small networks

Disadvantages:

● Less secure – each peer must manage its own security


● Difficult to manage with large numbers of peers

● Performance may degrade as more peers join

● No centralized backup or administration

Examples:

● File sharing platforms like BitTorrent

● Local file sharing in small offices or homes

● Multiplayer gaming in LAN mode

Comparison with Client-Server Network:

Feature Client-Server Peer-to-Peer

Server Yes (central server needed) No central server


requirement

Cost Higher Lower

Management Centralized Decentralized

Security Easier to enforce centrally Harder to manage individually

Best suited for Large networks Small networks

Network Topologies

Network topology refers to the physical or logical arrangement of devices (nodes) and
communication links in a computer network. It defines how data flows within the network.

Types of Network Topologies:


1. Bus Topology

All devices are connected to a single central cable (the bus).

● Advantages:

○ Easy and inexpensive to set up.

○ Requires less cable than other topologies.

● Disadvantages:

○ Performance degrades as more devices are added.

○ Failure of the central cable causes network failure.

Use Case: Small networks, early LANs.

2. Star Topology

All devices are connected to a central hub or switch.

● Advantages:

○ Easy to install and manage.


○ Failure of one device does not affect the rest of the network.

● Disadvantages:

○ Failure of the central hub leads to complete network failure.

○ Requires more cable than bus topology.

Use Case: Most modern LANs.

3. Ring Topology

Devices are connected in a circular loop, and data travels in one direction.

● Advantages:

○ Data transmission is orderly.

○ Easy to identify network issues.

● Disadvantages:

○ A break in the ring can cause network failure.

○ Adding or removing devices can disrupt the network.

Use Case: Used in some token ring networks.

4. Mesh Topology

Every device is connected to every other device.


● Advantages:

○ Provides high redundancy and fault tolerance.

○ Very reliable; if one link fails, another can be used.

● Disadvantages:

○ Expensive and complex to install.

○ Requires a lot of cabling.

Use Case: Military or mission-critical networks.

5. Tree Topology
A combination of star and bus topologies. Devices are arranged in a hierarchical manner.

● Advantages:

○ Scalable and easy to expand.

○ Easy to manage and troubleshoot.

● Disadvantages:

○ If the main backbone line fails, it can bring down the entire network.

○ More cable and configuration needed.

Use Case: Large organizations and educational institutions.

6. Hybrid Topology

A combination of two or more different types of topologies.

● Advantages:

○ Flexible and scalable.

○ Can be designed to meet specific needs.


● Disadvantages:

○ Complex design and maintenance.

○ Costly to implement.

Use Case: Modern enterprise networks.

Basics of IP Addresses

An IP (Internet Protocol) address is a unique numerical identifier assigned to each device on


a network. It allows devices to communicate with each other across local or global networks.

IPv4 (Internet Protocol version 4)

● IPv4 is the most commonly used version of IP.

● It uses a 32-bit address format, allowing approximately 4.3 billion unique addresses.

● Written in dotted decimal format: [Link]


(e.g., [Link])

Structure of IPv4 Address

An IPv4 address is made up of two parts:

1. Network Address:

● Identifies the specific network the device belongs to.

● Used by routers to forward data to the correct network.

2. Host Address:

● Identifies the specific device (host) within that network.

● Must be unique within the same network.

For example, in the IP address [Link]/24:

● Network address: [Link]

● Host address: 10

Subnet Address
● Subnetting is the process of dividing a large network into smaller, manageable sub-
networks called subnets.

● Helps improve network performance, security, and efficient IP address usage.

Subnet Mask:

● Used to distinguish the network portion and the host portion of an IP address.
Common example:
[Link] (or /24) – indicates the first 24 bits are the network part.

NAT – Network Address Translation

NAT is a networking process where a router or firewall translates private IP addresses used
inside a local network into a public IP address used on the internet—and vice versa.

It acts like a translator between a private network and the internet, allowing multiple
devices to access the internet using a single public IP address.

● The IPv4 address space is limited.

● NAT allows many devices in a private network (e.g., home, office) to share one
public IP.
● Provides a layer of security, hiding internal IP addresses from external users.

How NAT Works ( Example):

Imagine a home network:


● Your laptop has IP: [Link]

● Your phone has IP: [Link]

● Your router has public IP: [Link]

When your laptop visits a website:

1. The laptop sends a request to the router.

2. The router replaces the private IP ([Link]) with its public IP ([Link]) and
sends it to the internet.

3. When the response comes back, the router knows to send it back to the laptop.

Benefits of NAT

● Saves public IP addresses.

● Adds privacy and security by hiding internal network structure.

● Enables multiple devices to share a single internet connection.

Limitations of NAT

● Can cause issues with peer-to-peer applications, VoIP, or online games.

● Requires port forwarding for hosting services (like web or game servers).

DHCP – Dynamic Host Configuration Protocol

DHCP is a network protocol used to automatically assign IP addresses and other network
settings (like subnet mask, gateway, DNS server) to devices (clients) on a network.

Without DHCP, IP addresses would need to be manually assigned to each device. No manual
configuration [Link] unique IPs are assigned. Ideal for networks with many devices
(e.g., offices, schools, homes).

Steps:

1. Discover
The client broadcasts a DHCP Discover message to find a DHCP server.

2. Offer
The server replies with a DHCP Offer, suggesting an IP address and settings.
3. Request
The client responds with a DHCP Request to accept the offer.

4. Acknowledge
The server sends a DHCP Acknowledgment, finalizing the lease.

Advantages of DHCP:

● Automated configuration

● Reduced errors

● Centralized management

● Scalability for large networks

Network Security

What is a Firewall?

A firewall is a security system—either hardware, software, or both—that monitors and


controls incoming and outgoing network traffic based on predefined security rules.

It acts as a barrier between a trusted internal network (like your home or office) and
untrusted external networks (like the internet).

Main Purpose of a Firewall:

● Prevent unauthorized access to or from a private network.

● Block harmful traffic (viruses, hackers, malware).

● Allow safe communication between trusted sources.

Types of Firewalls:

Type Description

Hardware A physical device (like a security router) placed between your


Firewall network and the internet.

Software Firewall Installed on individual computers; controls traffic based on


settings.
Cloud-based Provided as a service over the internet for businesses.
Firewall

Firewall Functions:

● Packet filtering: Checks data packets against rules (IP, port, protocol).

● Proxy service: Acts as a middleman between users and services.

● Stateful inspection: Monitors active connections and makes decisions based on


context.

● Application filtering: Allows/block traffic from specific apps or services.

Example Scenario:

If a hacker tries to access your computer from the internet:

● The firewall blocks the unauthorized attempt.

● It only allows connections you’ve approved, like opening a website or using


email.

Why Firewalls Are Important:

● Essential for network protection in homes, offices, and enterprises.

● Prevents data theft, cyberattacks, and network misuse.

● Acts as the first line of defense in cybersecurity.

Domain Names and DNS Services

1. What is a Domain Name?

A domain name is a human-readable address used to access websites on the internet.

● It replaces complex IP addresses (like [Link]) with easy-to-remember


names (like [Link]).

● Domain names are part of the URL (Uniform Resource Locator) of a website.

Examples:
● [Link]
● [Link]
[Link]

Structure of a Domain Name:

A domain name is made up of three parts (from right to left):

● Top-Level Domain (TLD): .com, .org, .in, etc.

● Second-Level Domain: Usually the name of the organization (e.g., google)

● Subdomain (optional): Like www, mail, etc.

Example:
[Link]
→ Subdomain: www, Second-level: google, TLD: .com

2. What is DNS (Domain Name System)?

DNS is like the phonebook of the internet. It translates domain names into their
corresponding IP addresses, which computers use to locate each other on networks.

Why DNS is Needed:

● Humans remember names.

● Computers and networks communicate using IP addresses.


● DNS bridges this gap by automatically resolving names to IPs.

How DNS Works (Step-by-Step):

1. You type [Link] in your browser.

2. Your computer sends a DNS request to a DNS server.

3. The DNS server looks up the IP address for [Link].

4. The browser uses that IP to connect to the correct website.

Types of DNS Servers:

Type Role

DNS Resolver First server contacted by your device; forwards the


query

Root Server Directs the resolver to the TLD server

TLD Server Handles domains with common extensions like .com,


.org

Authoritative Server Has the final answer (IP) for the domain name
VPN – Virtual Private Network
What is a VPN?

A VPN (Virtual Private Network) is a technology that creates a secure, encrypted


connection over the internet between your device and a VPN server.

It allows users to:

● Hide their IP address

● Encrypt their internet activity

● Access restricted or region-blocked content

Use of a VPN

● To protect privacy on public Wi-Fi (e.g., in cafes or airports)

● To bypass geo-blocks (e.g., access websites not available in your country)

● To keep online activity secure and anonymous

● For safe remote access to private networks (e.g., company servers)

Steps:
1. You connect to a VPN app on your device.

2. The VPN app encrypts your internet traffic.

3. Your traffic is sent to a VPN server.

4. The VPN server forwards your request to the website or app.

5. The response is sent back through the encrypted tunnel.

To websites, it appears as if you are browsing from the VPN server’s location,
not your own.

Key Features of a VPN:

Feature Description

Encryption Protects data from hackers and snooping

IPAddress Masking Hides your real IP and location

Secure Tunneling Routes all traffic through a protected “tunnel”

Anonymity Helps keep your identity private online

Types of VPN:

● Remote Access VPN: Used by individuals to connect securely to the internet or a


private network.

● Site-to-Site VPN: Used to connect two different networks securely (e.g., two
company branches).
● Commercial VPNs: Offered by providers like NordVPN, ExpressVPN, etc., for
personal use.

Advantages of VPN:

● Enhanced online security

● Bypasses internet censorship or restrictions

● Allows anonymous browsing

● Enables safe access to work or school networks from home

Disadvantages of VPN:

● May slow down internet speed due to encryption

● Trust is needed in the VPN provider

● Some services may block VPN traffic

Internet and Web Technologies – Key Concepts

1. History of the Internet

Origins:

● The Internet began as a U.S. government project in the 1960s called ARPANET
(Advanced Research Projects Agency Network).

● 1969: ARPANET connected four universities in the U.S. to share data.

● It evolved from a military and academic network into a global communication


system.

Milestones:

● 1980s: TCP/IP (Transmission Control Protocol/Internet Protocol) became the standard


protocol.

● 1990: ARPANET was officially shut down.

● 1991: The World Wide Web (WWW) was introduced by Tim Berners-Lee.

● 1993: The first graphical web browser (Mosaic) was released, increasing public
interest.

2. WWW – World Wide Web


What is WWW?

● The World Wide Web (WWW) is a system of interlinked hypertext documents


accessed through the internet using a web browser.

Key Components:

● Web pages: Written in HTML (HyperText Markup Language).

● Web browser: Software like Chrome, Firefox, or Edge used to access web pages.

● URL (Uniform Resource Locator): Address of a web page (e.g.,


[Link]

Difference between Internet and WWW:

Internet WWW

A global network of networks A service running on the internet

Includes email, file sharing, etc. Mainly includes web pages and sites

3. Web-Based Computing

What is Web-Based Computing?

● A computing model where software applications are accessed and run through a web
browser over the internet.

● Users don’t need to install software locally.

Examples:

● Google Docs (word processing)

● Gmail (email)

● YouTube (video streaming)

Advantages:
● Accessible from any device with the internet.

● No need for powerful local hardware.

● Easy to update and maintain centrally.

4. Web Server

What is a Web Server?

● A web server is a computer or software that stores, processes, and delivers web
pages to users over the internet.

How it Works:

1. A user sends a request via browser (e.g., clicking a link).

2. The browser sends an HTTP request to the web server.

3. The server locates the requested file or page.

4. It sends the HTML file back to the user’s browser.

5. The browser renders and displays the page.

Popular Web Server Software:

● Apache

● Nginx

● Microsoft IIS

Key Features:

● Handles multiple requests at once.

● Hosts websites and web applications.

● Can use SSL for secure connections (HTTPS).


Questions

1. What is the difference between System Software and Application Software?

• System Software is designed to operate and control the computer hardware and
provide a platform for application software.
Examples: Operating Systems, Device Drivers, Utility Programs, Firmware.
• Application Software is developed to perform specific tasks as per the user's needs.
Examples: MS Word, WhatsApp, Excel, Browsers.

2. Explain the key functions of an Operating System.

An Operating System (OS) performs various essential functions, including:

1. User Interface & Command Processing


2. File Management – Organizes and stores files and directories.
3. I/O Control – Manages communication with input/output devices.
4. Process Management – Manages tasks and their execution.
5. Memory Management – Allocates memory to processes and ensures protection.
6. Scheduling & Dispatching – Determines process execution order.
7. Secondary Storage Management
8. Network Management & Communication
9. Security & Protection
10. System Administration Support
3. Compare and contrast Single-User and Multi-User Operating Systems with examples.

Feature Single-User OS Multi-User OS

Users at a time One Multiple

Usage Personal devices Servers, Institutions

Examples MS-DOS, Windows 98 Linux, UNIX, Windows Server

Resource Sharing Not shared Shared among users


4. A company wants to set up a centralized system for managing multiple client
computers. Which type of operating system should they choose and why?

They should use a Server Operating System like Windows Server or Red Hat Enterprise
Linux. Because server OSs are designed to handle multiple users, manage network resources,
provide secure file sharing, printer access, user authentication, and centralized administration,
all of which are essential for enterprise environments.

5. Define a Real-Time Operating System (RTOS) and give two examples of where it is
used.

A Real-Time Operating System (RTOS) is an OS designed to process data and respond


within a guaranteed time frame. It is used in systems where timing is critical.

Examples of use:

• Medical devices (e.g., heart monitors)


• Automobile systems (e.g., airbag deployment)
Examples of RTOS: VxWorks, FreeRTOS, RTLinux

6. You are organizing your project files. Create a new directory named Project2025,
copy a file called [Link] into it, and then rename the copied file to final_report.txt.
Write the sequence of Linux commands you would use.

mkdir Project2025 # Step 1: Create the directory

cp [Link] Project2025/ # Step 2: Copy [Link] into the new folder

mv Project2025/[Link] Project2025/final_report.txt # Step 3: Rename the file

7. Write a shell script to read a file line by line

#!/bin/bash

# Check if filename is provided

if [ -z "$1" ]; then

echo "Usage: $0 filename"

exit 1

fi

# Read the file line by line

while IFS= read -r line

do
echo "$line"

done < "$1"

steps

1. Save this as [Link].


2. Make it executable:
3. chmod +x [Link]
4. Run the script with a filename:
5. ./[Link] [Link]
8. Define a packet and explain its components.

A packet is a small unit of data into which a large message is divided for transmission over a
network.
Components include:

• Header: Contains control information such as source and destination addresses.


• Payload: The actual data being sent.
• Trailer: Contains error checking data for validation.
9. Differentiate between guided and unguided media.

Guided Media (Wired): Uses physical paths like twisted pair cables, coaxial cables, and fiber
optics. It's more secure and suitable for short to medium distances.

Unguided Media (Wireless): Uses radio waves, microwaves, or infrared, with no physical
medium. Ideal for mobile or long-distance communication.

10. What is the function of a switch in a LAN?

A switch is a network device that forwards data only to the specific device (based on MAC
address) that needs it, rather than broadcasting to all connected devices like a hub. This
makes it more efficient and secure.

[Link] would a business choose a MAN over a LAN or WAN?

A business with multiple offices spread across a city would choose a MAN because:

• It connects different LANs efficiently within a metropolitan area.


• Offers high-speed connectivity.
• Is cost-effective compared to a WAN, which may be overkill for city-wide coverage.
12. Describe the difference between simplex, half-duplex, and full-duplex
communication.
• Simplex: One-way communication (e.g., TV broadcast).
• Half-Duplex: Two-way communication, but one direction at a time (e.g., walkie-
talkies).
• Full-Duplex: Two-way communication simultaneously (e.g., phone calls).
13. In what scenario would you use a repeater in a LAN setup?
A repeater is used when the signal weakens over long distances in a LAN setup—such as
when two offices in a large building are connected by Ethernet, and the cable length exceeds
the standard limit (100 meters). The repeater regenerates the signal to maintain quality.

14. What problems can arise if a hub is used instead of a switch in a modern LAN?

Using a hub can lead to:

• Network congestion: It broadcasts data to all devices, creating unnecessary traffic.


• Security risks: Data is visible to all connected devices.
• Slower performance: Due to increased collisions and retransmissions in shared
bandwidth.
15. What role does the PSTN play in a WAN?

The Public Switched Telephone Network (PSTN) provides traditional circuit-switched


communication infrastructure that supports WAN connectivity, especially for dial-up or
DSL-based internet services. It forms part of the foundational long-distance communication
network.

16. An organization has multiple offices in different cities and requires seamless data
sharing. Compare the suitability of client-server and peer-to-peer networks for this
purpose, and recommend the better option.

For an organization with multiple offices in different cities and a requirement for seamless
data sharing, here's a comparison between Client-Server and Peer-to-Peer (P2P) networks:

Client-Server vs Peer-to-Peer

Feature Client-Server Network Peer-to-Peer Network


Structure Centralized: Clients connect to a Decentralized: Each node acts as
central server both client and server
Scalability Highly scalable, ideal for large, Not scalable; performance drops as
distributed environments users increase
Data Centralized data storage and control Data spread across devices, harder
Sharing make sharing efficient to manage
Security Stronger control and centralized Weaker security; hard to enforce
security policies access control
Maintenance Managed by IT admins; easier to Difficult to manage across multiple
update and monitor locations
Reliability High reliability; backup and recovery If one peer fails, data may be lost or
handled at server level unavailable
Suitable for Large organizations with multiple Small, local networks with few
locations users

Client-Server Network is better for this case:

• Centralized servers enable efficient, secure, and consistent data sharing across all city
offices.
• Allows for remote access, backup, and system updates to be managed from a central
location.
• Supports user authentication, permissions, and encryption, crucial for enterprise-level
operations.
• Easily integrates with WAN infrastructure for cross-city connectivity.
16.

1. Local Area Network (LAN):


o Each office likely has a LAN for internal communication within the site.
o It connects all computers, printers, and other devices within the office.
2. Wide Area Network (WAN):
o For communication between offices that are separated by hundreds of
kilometers, a WAN is used.
o WANs often use public telecommunication infrastructure (like leased lines or
internet-based VPNs) to connect distant LANs.
3. Virtual Private Network (VPN):
o A VPN can be established over the internet for secure communication between
offices.
o This is cost-effective and provides encrypted data transfer between offices.
4. Dedicated Leased Lines:
o These are point-to-point private connections used for high-security
communication between offices.
o They are expensive but ensure a consistent and reliable connection.
5. Fiber-Optic Links:
o If the company has its private network infrastructure, fiber-optic links could
connect different offices for high-speed and high-capacity communication.
In conclusion, communication between computers across the company involves a
combination of LAN (within offices) and WAN (between offices). WAN connectivity
could utilize technologies like VPNs,leased lines, or the internet, depending on the
company's requirements and budget.

17. The World Wide Web (WWW) is not the same as the Internet, though they are
closely related. Here's a detailed justification:

• Internet:
The Internet is a global network of interconnected computers and servers that allows
for the transmission of data using standardized communication protocols (e.g.,
TCP/IP). It serves as the infrastructure for a variety of services.
• World Wide Web (WWW):
The WWW is a service or system that runs on the Internet. It is a collection of
documents, images, videos, and other resources that are accessed using web browsers
via HTTP/HTTPS protocols.
2. Key Differences

Aspect Internet World Wide Web


(WWW)
Scope Encompasses the entire A subset of the Internet
infrastructure, including used to access web pages
hardware, protocols, and and resources.
services.
Technology Uses protocols like Relies on HTTP/HTTPS
TCP/IP, SMTP (for email), and HTML for creating
FTP (for file transfer), etc. and viewing web pages.
Components Includes email, file Includes only web pages,
transfer, chat, streaming, hyperlinks, and
gaming, etc. multimedia accessed via
browsers.
Dependency The WWW cannot exist The Internet can exist
without the Internet. without the WWW,
supporting other services.
The Internet is the larger network that supports a variety of services, including the
World Wide Web. While they are interconnected, they are not the same. The WWW
is one of many services that use the Internet as their foundation.

18. A company wants to set up a reliable and scalable network topology for its new
office. The office has several departments that need to communicate frequently with
each other, and the company anticipates future expansion. Which network topology
would you recommend, and why? Discuss its advantages and limitations in this
scenario.

Use Star Topology.

The advantage of using star is

1. Reliability:
o Each device is connected to a central hub or switch. If one device fails, it
doesn’t affect the rest of the network. This ensures minimal disruption in
communication.
2. Scalability:
o Adding new devices or departments is straightforward—simply connect them
to the hub/switch without altering the existing setup.
3. Performance:
o The centralized nature of communication ensures efficient data transfer
between devices without collisions (especially if a switch is used).
4. Ease of Troubleshooting:
o Problems are easier to identify and resolve because the central hub acts as the
control point.
Advantages in the Company’s Context:

• Departments can communicate efficiently through the hub.


• Future expansion is manageable, as new departments can be added without
redesigning the entire network.
• Suitable for offices with high device density as it reduces network congestion.
19. What is the difference between a public IP address and a private IP address in
IPv4? Provide examples of each.

Public IP Address:

• A public IP address is globally unique and can be accessed over the Internet.
• It is assigned by an Internet Service Provider (ISP) and is used to identify devices on
the global network.
• Example: [Link], [Link].
Private IP Address:

• A private IP address is used within a local network and cannot be accessed directly
over the Internet.
• These addresses are defined in RFC 1918 and are meant for internal communication
within networks like homes, schools, or businesses.
• Example ranges:
o [Link] – [Link]
o [Link] – [Link]
o [Link] – [Link]
Key Difference:
Public IPs are visible on the Internet and used for external communication, while private IPs
are restricted to local networks and require Network Address Translation (NAT) to access the
Internet.

20. A company has a network with 50 devices, but it only has 10 public IP addresses
assigned by its ISP. Explain how NAT and DHCP can work together to enable all
devices to access the Internet.

Role of NAT (Network Address Translation):

• NAT allows multiple devices within a private network to share a single public IP
address or a limited pool of public IPs for accessing the Internet.
• When a device sends a request to the Internet, NAT translates its private IP address to
one of the available public IPs.
• On receiving a response, NAT maps the public IP back to the respective private IP,
ensuring the communication is routed correctly.
Role of DHCP (Dynamic Host Configuration Protocol):

• DHCP automatically assigns private IP addresses to all devices within the network.
• It ensures that each device gets a unique IP address without manual configuration,
simplifying network management.
How They Work Together:

1. DHCP assigns private IP addresses:


Each of the 50 devices is assigned a private IP address (e.g., from the range
[Link] to [Link]).
2. NAT handles Internet access:
o When a device requests access to the Internet, NAT translates its private IP
address into one of the 10 public IP addresses provided by the ISP.
o If there are more requests than public IPs available, NAT uses port numbers to
differentiate traffic from multiple devices sharing the same public IP.
Benefits:

• Efficient use of limited public IPs.


• Simplified internal IP management through DHCP.
• Enhanced security, as private IPs are not exposed to the Internet.
21. A startup is expanding its business and needs to implement network security.
Propose a security plan that includes desktop security, perimeter security, and VPN for
remote access.

To ensure comprehensive network security, the plan addresses three critical aspects: desktop
security, perimeter security, and VPN for remote access.

1. Desktop Security

Secure individual devices to prevent internal threats and unauthorized access.

Measures:

1. Antivirus and Anti-malware Software:


o Install and regularly update reputable antivirus/anti-malware programs on all
desktops to protect against malicious attacks.
2. Operating System and Software Updates:
o Enforce automatic updates to ensure all desktops run the latest security
patches.
3. User Authentication:
o Implement strong password policies requiring complex, regularly updated
passwords.
o Use Multi-Factor Authentication (MFA) for an additional layer of security.
4. Endpoint Detection and Response (EDR):
o Deploy EDR solutions to monitor, detect, and respond to suspicious activities
on desktops.
5. Disk Encryption:
o Enable full-disk encryption (e.g., BitLocker or FileVault) to protect data in
case a device is lost or stolen.
6. Access Control:
o Assign user permissions based on roles and implement the principle of least
privilege (users only have access to the resources they need).
2. Perimeter Security

Defend the network boundary against external threats.

Measures:

1. Firewall:
o Deploy a hardware firewall to monitor and control incoming and outgoing
traffic.
o Use advanced firewalls with features like deep packet inspection (DPI) and
intrusion prevention systems (IPS).
2. Network Segmentation:
o Separate critical systems (e.g., databases) from other parts of the network to
limit potential damage from breaches.
3. Intrusion Detection and Prevention System (IDPS):
o Implement IDPS to detect and prevent malicious activities at the network
perimeter.
4. DNS Filtering:
o Use DNS filtering services to block access to malicious websites and prevent
phishing attempts.
5. Access Logging and Monitoring:
o Regularly monitor access logs and network traffic for suspicious activity using
a Security Information and Event Management (SIEM) tool.
3. VPN for Remote Access

Securely connect remote employees to the internal network.

Measures:

1. VPN Configuration:
o Deploy a secure VPN solution (e.g., OpenVPN, WireGuard, or Cisco
AnyConnect) to encrypt remote communication between users and the internal
network.
2. Strong Authentication:
o Require MFA for VPN login to prevent unauthorized access.
3. Split Tunneling:
o Disable split tunneling unless absolutely necessary to ensure all traffic routes
through the VPN for better security.
4. Regular Key Updates:
o Rotate encryption keys periodically to prevent potential breaches.
5. Remote Device Security:
o Enforce security policies on devices used for VPN access, such as enabling
firewalls, encryption, and endpoint protection.
By combining robust desktop security, strong perimeter defenses, and a secure VPN setup,
the startup can build a resilient network security framework that supports its growth while
protecting critical assets.

22. A Company wants to allow its employees to access a web-based application hosted
on a cloud server but block access to all other external websites. How can a firewall be
configured to achieve this, and what types of firewalls would be most effective in this
scenario?

Configuration to Achieve the Goal:

1. Whitelist the Application’s IP Address or Domain:


o Configure the firewall to allow traffic only to the specific IP address or
domain of the web-based application (e.g., [Link] or [Link]).
2. Block All Other Outbound Traffic:
o Use "deny all" rules as the default policy for outbound traffic and create
exceptions only for the allowed IP/domain.
3. Port-Specific Rules:
o Allow traffic only on the necessary port (e.g., port 443 for HTTPS) to the
application.
4. URL Filtering (If Required):
o Use URL filtering to ensure that only the application’s URL is accessible
while blocking other URLs, even if they share the same IP range.
Types of Firewalls for This Scenario:

1. Packet-Filtering Firewall:
o Can block all traffic except the allowed IP address and port. However, it does
not inspect the content deeply, making it less secure for complex scenarios.
2. Stateful Inspection Firewall:
o Tracks active connections and allows only legitimate traffic to the specified
destination.
3. Application Layer Firewall (Proxy Firewall):
o Provides deep inspection of application traffic and is best suited for this use
case, as it can enforce rules based on specific URLs or applications.
4. Next-Generation Firewall (NGFW):
o Offers advanced features like deep packet inspection, URL filtering, and
application control, making it the most effective solution for precise traffic
control.
Shell Script Programs

[Link] a shell script to Add Two Numbers and subtract two number

#!/bin/bash

a=10

b=20

sum=$((a + b))

echo "Sum: $sum"

2. Write a shell script to Check if a Number is Even or Odd

#!/bin/bash

echo "Enter a number: "

read num

if (( num % 2 == 0 )); then

echo "$num is Even"

else

echo "$num is Odd"

[Link] Factorial of a Number

read -p "Enter a number: " num

fact=1

for (( i=1; i<=num; i++ ))

do

fact=$((fact * i))

done
echo "Factorial of $num is $fact"

4. Check if a Number is Positive, Negative, or Zero

#!/bin/bash

read -p "Enter a number: " num

if [ $num -gt 0 ]; then

echo "Positive number"

elif [ $num -lt 0 ]; then

echo "Negative number"

else

echo "Zero"

fi

5. Find the Largest of Three Numbers

#!/bin/bash

read -p "Enter first number: " a

read -p "Enter second number: " b

read -p "Enter third number: " c

if [ $a -ge $b ] && [ $a -ge $c ]; then

echo "Largest number is $a"

elif [ $b -ge $a ] && [ $b -ge $c ]; then

echo "Largest number is $b"

else

echo "Largest number is $c"

fi

6. Print Numbers from 1 to N

#!/bin/bash

read -p "Enter a number: " n


for (( i=1; i<=n; i++ ))

do

echo "$i"

done

7. Sum of N Natural Numbers (Using While Loop)

#!/bin/bash

read -p "Enter a number: " n

sum=0

i=1

while [ $i -le $n ]

do

sum=$((sum + i))

i=$((i + 1))

done

echo "Sum of first $n natural numbers is $sum"

8. Check If a Number is Prime (Using Loop)

#!/bin/bash

read -p "Enter a number: " num

is_prime=1

for (( i=2; i<num; i++ ))

do

if (( num % i == 0 )); then

is_prime=0

break

fi

done
if (( num < 2 )); then

echo "Not a prime number"

elif (( is_prime == 1 )); then

echo "Prime number"

else

echo "Not a prime number"

fi

9. Print Multiplication Table of a Number

#!/bin/bash

read -p "Enter a number: " num

for (( i=1; i<=10; i++ ))

do

echo "$num x $i = $((num * i))"

done

10. Reverse a Number

#!/bin/bash

read -p "Enter a number: " num

rev=0

while [ $num -gt 0 ]

do

digit=$((num % 10))

rev=$((rev * 10 + digit))

num=$((num / 10))

done

echo "Reversed Number: $rev"

You might also like