C&NS Lab Manual 2021
C&NS Lab Manual 2021
COURSE LEARNING OUTCOMES (CLOs) and its mapping with Program Learning Outcomes
(PLOs):
CLO Bloom’s
Course Learning Outcomes (CLOs) PLOs
No. Taxonomy
Explain fundamental security objectives, PLO_1 C2
1
security attacks, services, and mechanisms (Engineering knowledge) (Understanding)
Apply various algorithms and security PLO_3
C3
2 mechanisms to provide confidentiality, integrity, (Design/Development of (Applying)
and authentication Solutions)
Identify appropriate techniques to analyze the PLO_2 C4
3
problems in the discipline of network security (Problem Analysis) (Analyzing)
Use appropriate tools to apply different PLO_5 C3
4 cryptographic algorithms and network security (Modern Tool Usage) (Applying)
mechanisms
Annexure C
SSUET/QR/118
(Form IIa)
Sir Syed University of Engineering & Technology, Karachi
Computer Engineering Department
Rubric Guideline for Software Based Lab
Software Able to use software Able to use software Able to use Unable to use the
Handling with its standard and with its standard and software with its software
advanced features advanced features with standard features
without assistance minimal assistance with assistance
Able to achieve all the Able to achieve all the Able to achieve Unable to
Results desired results with desired results most of the achieve the
alternate ways desired results desired results
with errors
SSUET/QR/118
[Form-IIb]
Sir Syed University of Engineering & Technology, Karachi
Computer Engineering Department
Rubric-Laboratory Manual
Course Name (Course Code), __________________________Semester, Batch _______
Name of Student: ___________________________________Roll No. __________________
Lab Description & Score
Annexure C
SSUET/QR/118
(Form IIIb)
Sir Syed University of Engineering & Technology, Karachi
Computer Engineering Department
Rubric for Lab Exam
Course Name (Course Code), _______________________________ Semester, Batch _______
Name of Student: ________________________ Roll No. __________________
Performance
Able to present full Able to present Able to present sufficient No or very less
knowledge of both adequate knowledge of knowledge of both knowledge of
problem and solution. both problem and problem and solution both problem
solution and solution
Viva
Able to answer the Able to answer the Able to answer the Unable to
questions easily and questions related to questions but with answer the
correctly across the the project mistakes questions
project.
Total Score
Final Lab Assessment
Laboratory Manual
Lab Exam
Total (20)
LAB#01
MATLAB Commands & Functions
OBJECTIVE
The purpose of this lab is to implement the basics of MATLAB. The main goals are to
MATLAB
MATLAB (Matrix laboratory) is an interactive software system for numerical computations and graphics.
A numerical analyst called Cleve Moler wrote the first version of Matlab in the 1970s. It has since
evolved into a successful commercial software package. As the name suggests, Matlab is especially
designed for matrix computations: solving systems of linear equations, computing eigen values and
eigenvectors, factoring matrices, and so forth. In addition, it has a variety of graphical capabilities, and
can be extended through programs written in its own programming language. Many such programs come
with the system; a number of these extend Matlab's capabilities to nonlinear problems, such as the
solution of initial value problems for ordinary differential equations.
Characteristics of MATLAB:
1. Slow (compared with FORTRAN or C) i.e. not pre-compiled. Avoid for loops; instead use vector
form.
2. Automatic memory management, i.e., you don't have to declare arrays in advance.
3. Shorter program development time than traditional programming languages such as FORTRAN
and C.
4. Can be converted into C code via MATLAB compiler for better efficiency.
5. Many application-specific toolboxes available.
Main toolboxes which are going to be used are: communication toolbox, signal processing toolbox and
other supplement tool boxes.
Variables in MATLAB:
Type of variable in MATLAB is determined when it is created. One don’t have to declare variable before
assigning it a value. There are two types of variable.
i) Scalar Variables
Those variables that have one (1) row and one (1) column
Open a new m file and name it prog1 then execute the following commands:
a = 5; % numeric variable
E.g. flipping coin (flipping coin 100 times), lottery, and thermal noise in chips/semiconductors,
mouse movement and keystroke timings
PRN are computed i.e. they are deterministic and often computed with the following function
S0= seed
Si+1=F(Si)
These cannot use for the key because they are deterministic e.g. in software testing etc.
CPRNGs are PRNGs with an additional property--- the numbers are unpredictable
m = randsrc(4,4,[3:5]) %same as l
p = magic(5) %5by5 magic matrix. See the details of this matrix in the %detailed
help. Note that the magic matrix can only be a %square matrix
%Operations on matrices
r = b + c' %Addition
%Element extraction
m(1:3,2) %extracts the elements at 1 to 3 rows and 2nd column in min %this
way using the range sign : , you can extract any element %or elements
depending on the intersections
w = [b' c d] %concatenate different matrices into a single one such that the
%resultant matrix forms an acceptable shape.
%Basic functions
sum(d)
mean(d)
max(d)
min(d)
sin(d)
cos(d)
exp(d)
log(d)
%Basic plotting
t = [0:0.001:10];
y = sqrt(100 - t.^2);
plot(t,y) %plot y vs t
hold on
plot(-t,-y,'g')
hold on
plot(-t,y,'k')
Some basic programming. Open a new m file and name it prog2 then execute the following
commands
function res = prog2( v ) %function definition. This function can be called from any %place
after passing it the argument v such that v is a row (in %this %example)
else
%Explore different plotting commands and other useful commands fromthe help menu.
Lab Tasks:
1. Using a programming approach, create the following matrix:
9 9 9 9 9 9 9 9 9
9 0 0 0 0 0 0 0 9
9 0 0 0 0 0 0 0 9
9 0 0 0 0 0 0 0 9
9 0 0 0 0 0 0 0 9
9 0 0 0 0 0 0 0 9
9 0 0 0 0 0 0 0 9
9 0 0 0 0 0 0 0 9
9 9 9 9 9 9 9 9 9
2. A system is performing an encryption operation on a text data using the figure shown below. The
letters are mapped into bits in the following manner: the letter is converted into its corresponding
sequence number in the English alphabets and then that number is converted into binary
representation. The length of the key used the same as the length of a single letter in bits. Display
the encrypted message in text form. Assume your roll no as a key of your choice.
The text to encrypt is your complete name e.g. Rabia. Hint: discard the spaces between name and
the capitalization of letters.
LAB#02
Classical Encryption Techniques (Mono alphabetic Ciphers)
OBJECTIVE
3. Monoalphabetic cipher
Additive Cipher
Multiplicative Cipher
Affine Cipher
4. Monoalphabetic Substitution cipher
THEORY
Encryption algorithm: The sequence of data processing steps that go into transforming plaintext into
ciphertext. Various parameters used by an encryption algorithm are derived from a secret key.
Secret key: A secret key is used to set some or all of the various parameters used by the encryption
algorithm. The important thing to note is that the same secret key is used for encryption and decryption in
classical cryptography. It is for this reason that classical cryptography is also referred to as symmetric key
cryptography.
Decryption algorithm: The sequence of data processing steps that go into transforming ciphertext back
into plaintext. Various parameters used by a decryption algorithm are derived from the same secret key
that was used in the encryption algorithm. In classical cryptography for commercial and other civilian
applications, the decryption algorithm is made public.
Block cipher: A block cipher processes a block of input data at a time and produces a ciphertext block of
the same size.
Stream cipher: A stream cipher encrypts data on the y, usually one byte at a time.
Hence in this case, k 3 , and p represent the integer representation of letters minus one. So p have the
values [0 17 4 24 14 20 17 4 0 3 24] . Hence, C contains the numbers corresponding to the cipher
text.
In these formulas, 'k' would be the secret key. The symbols 'E' and 'D' represent encryption and
decryption where decryption is given as:
P Dk , C C k mod 26
Matlab Code:
Store the letters in a vector. Their locations in the vector represent their values.
Use find() command to find the plaintext in the letters vector.
Use mod() command for the modular arithmetic.
2. MULTIPLICATIVE CIPHER
3. AFFINE CIPHER
4. MONOALPHABETIC CIPHER
In monoalphabetic, rather than substituting all letters with a single key, multiple keys are used
instead. The Key size becomes 26!.
Rather than just shifting the alphabet could shuffle (jumble) the letters arbitrarily.
Each plaintext letter maps to a different random ciphertext letter
Another attack is possible using language characteristics
Letters are not equally commonly used in English E is by far the most common letter followed by
T,R,N,I,O,A,S. Other letters like Z,J,K,Q,X are fairly rare.
Have tables of single, double & triple letter frequencies for various languages and accordingly,
monoalphabetic ciphers can be compromised.
For Example:
Matlab Code:
Lab Tasks:
3. Implement Ceasar Cipher both encryption and decryption or the plaintext “ilikecomputersecurity”
by taking key is equal to your roll number.
Department of Computer Engineering, SSUET Page | 17
CE-408: Cryptography & Network Security SSUET/QR/114
5. Implement Affine Cipher both encryption and decryption or the plaintext “itshardtofindkey” by
taking any pair of key.
6. Encrypt and decrypt the text using monoalphabetic substitution cipher. The key arrangement
should be different for each student. The plain text is same as in task 1.
LAB#03
Classical Encryption Techniques II (Polyalphabetic and
Transposition Ciphers)
OBJECTIVE
5. Polyalphabetic Cipher
6. Transposition Cipher
THEORY
5. POLYALPHABETIC CIPHER
Vigenere Cipher
For Encryption
Ci = Pi + ki
For Decryption
Pi = Ci - ki
Use the same concept of Ceasar cipher or monoalphabetic for letter look up using find()
command.
Hill Cipher
In classical cryptography, the Hill cipher is a polygraphic substitution cipher based on linear algebra.
Each letter is represented by a number modulo 26. Often the simple scheme A = 0, B = 1, ..., Z = 25 is
used, but this is not an essential feature of the cipher. To encrypt a message, each block of n letters
(considered as an n-component vector) is multiplied by an invertible n × n matrix, against modulus 26. To
decrypt the message, each block is multiplied by the inverse of the matrix used for encryption.
The matrix used for encryption is the cipher key, and it should be chosen randomly from the set of
invertible n × n matrices (modulo 26). The cipher can, of course, be adapted to an alphabet with any
number of letters; all arithmetic just needs to be done modulo the number of letters instead of modulo 26.
6. TRANSPOSITION CIPHER
Arrange:
Ciphertext: “mematrhtgpryetefeteoaat”
A more complex transposition is achieved by writing letters of message out in rows over a
specified number of columns.
Then reorder the columns according to some key before reading off the rows.
The number of columns and the rearrangement becomes the key.
Matlab Code:
Lab Tasks:
7. Implement Polyalphabetic both encryption and decryption of the plaintext
“ilikecomputersecurity” such that the key is “sight”.
8. Encrypt and decrypt the plaintext “over the crimson sky” using Rail Fence with depth 5.
9. Encrypt and decrypt the plaintext “let us fly over the blue crimson sky ” using Keyed
Transposition with the following key combination: 2 5 4 3 1 6.
LAB#04
Modern Encryption Techniques
Simplified DES (S-DES)
OBJECTIVE
The purpose of this lab is to implement SDES encryption and decryption in MATLAB.
THEORY
Encryption: It takes an 8-bit block of plain text and a 10-bit key as input and produces an 8-bit
block of cipher text as output.
Decryption: It takes an 8-bit block of cipher text and the same 10-bit key used to produce that
ciphertext as input and produces the original 8-bit block of plaintext.
Algorithm involves 5 functions:
1. An initial permutation (IP).
2. A complex function, fK , that involves both permutation and substitution operations and depends
on the sub key input. In the first fKblock, sub key 1 is used.
3. A simple permutation function that switches the two halves of the data (SW).
4. The function fK again with sub key 2 being used in this case.
5. A permutation function that is the inverse of the initial one (IP-1) as shown below
C (IP -1 f K 2 SW f K1 IP)
or
Ciphertext IP -1 (f K 2 (SW(f K1 (IP(plaint ext)))))
where
K1 P8(Left Shift - 1 (P10(key)))
K 2 P8(Left Shift - 2(Left Shift - 1(P10(key) )))
and
Plaintext IP -1 (f K1 (SW(f K2 (IP(cipher text)))))
Refer to the detailed figure for encryption and decryption from the lecture notes.
The reference figures are shown below for encryption and key generation:
Matlab Code:
Create three functions, main, key generator and fk function. The key and fk functions are going to
be called from the main body.
Define the constants within the main body and pass them to the appropriate functions.
The format for basic function is as follows:
Where parm1,parm2,… are the returned values stored in these variables. The file name and the
name of the function should be same.
Lab Tasks:
11. Write the program for the main code for encryption through which the key and fk function are
called. Perform Initial permutation, switching and inverse permutation here. Display the final
ciphertext along with key and plaintext.
14. Write the program for the main code for decryption through which the key and fk function are
called. Perform Initial permutation, switching and inverse permutation here. Display the final
plaintext along with key and plaintext.
LAB#05
Modern Encryption Techniques
Data Encryption Standard (DES)
OBJECTIVE
The purpose of this lab is to implement DES encryption and decryption in MATLAB.
THEORY
Encryption: It takes 64-bit block of plain text and a 58-bit key as input and produces 64-bit block
of cipher text as output.
Decryption: It takes 64-bit block of cipher text and the same 58-bit key used to produce that
ciphertext as input and produces the original 64-bit block of plaintext.
Refer to the detailed figure for encryption and decryption from the lecture notes.
The reference figures are shown below for encryption and key generation:
Lab Tasks:
15. Write the program for sub keys generation of DES 16 rounds.
17. Write the program for the main code for encryption through which the key and fk function are
called. Perform Initial permutation, switching and inverse permutation here. Display the final
ciphertext along with key and plaintext.
18. Write the program for the main code for decryption through which the key and fk function are
called. Perform Initial permutation, switching and inverse permutation here. Display the final
plaintext along with key and plaintext.
LAB#06
Simplified Advance Encryption Standard (S-AES)
OBJECTIVE
The purpose of this lab is to implement S-AES algorithm in MATLAB. The main objectives are to
implement the following:
THEORY
Encryption: It takes 16-bit block of plaintext and creates a 16 bit ciphertext. The key size is 16
bits (8 bit word) for both encryption and decryption. It uses one pre-round transformation and two
rounds. In S-AES there are three round keys, K0, K1 and K2. The structure of the rounds along
with the general encryption flow is shown below:
Algorithm’s Specifications:
The plaintext is 16 bits represented by a data block of 2 columns of nibble which is called state
The data are arranged column wise and not row wise.
It has 3 rounds for the key size of 16 bits
Each other round has the following steps:
Round 0 has only one step (i.e. Add round key ) which XOR the state (i.e. PT) with the original
key
Round 3 has all steps except mix column
Key Generation:
Key expansion routine creates three 16 bit round keys from one single 16 bit cipher key. The first
round key is used for pre-round transformation (AddRoundKey); the remaining round keys are
used for the last transformation at the end of round 1 and round 2.
6 words are made from the original key. The process is as follows
AES ROUND:
Figure shows that each transformation takes a state and creates another state to be used for the next
transformation.
1. Nibble substitution
S-Box Nibble Substitution is used to at the encryption site and Inverse S-Box Nibble Substitution. To
substitute a nibble, the left 2 bits define the row and the right 2 bits define the column of the
substitution. In the process, each nibble is transformed independently.
2. Shift Rows
A circular byte shift in each row
a. Row 0 is unchanged
b. Row 1 is shifted 1 nibble to left
3. Mix Column
The MixColumns transformation operates at the column level; it transforms each column of the state into
a new column. The transformation is actually the matrix multiplication of a state column by a constant
square matrix. The nibbles in the state column and constants are interpreted as 4-bit words (or
polynomials) with coefficients in GF(2). Multiplication of bytes is done in GF(24 ) with modulus (10011).
It is a simple XOR operation between the round key and the state value.
Lab Tasks:
19. Write the program for the main code for encryption. Also write the code for the transform
function.
20. Write the program for generating sub keys for each round.
LAB#7
OPEN ENDED LAB
TITLE:
1. Objective
Design and implement a cipher for secure communication that should have the mixture of atleast two
substitution and transposition ciphers for two rounds (use algorithm of your choice) in Feistel structure.
It is to be noted that the encrypted text should be converted back into the plaintext.
2. Hardware/Software required
3. Diagram
4. Methodology
5. Observation
7. Conclusion
LAB#08
Public Key Cryptography – RSA Algorithm
OBJECTIVE
The purpose of this lab is to implement RSA Algorithm and use it for encryption and to perform digital
signature in MATLAB.
THEORY
Traditional private/secret/single key cryptography uses one key which is shared by both sender
and receiver. If this key is disclosed then communications are compromised. As a result, another
approach uses two keys – a public & a private key which is called Asymmetric since parties use
different keys and they are not equal. If one is encrypting using a key, then the other cannot
decrypt using the same key.
RSA:
Procedure:
d is nothing but the multiplicative inverse of e and vice versa in mod ø(n)
Publish their public encryption key: KU = {e,n}
Keep secret private decryption key: KR = {d,n}
To encrypt a message M the sender obtains public key of recipient KU={e,n}
Computes: C = Me mod n, where 0≤M<n
To decrypt the ciphertext C the owner uses their private key KR={d,n}
Computes: M = Cd mod n
Note that the message M must be smaller than the modulus n
Matlab code:
The only primary operation here is modulo operation. Use mod command for evaluating modulo
of two numbers.
To generate random prime numbers, use the command primes(n).
To find primitive root of a number, use if statement and mod function.
Use gcd(a,b) command to verify whether e and d are relatively prime to ø(n)
To find the multiplicative inverse a number, use series of if statements and mod function.
Lab Tasks:
Perform the following tasks
1. Perform the block shown below such that RSA algorithm is used. Use the following parameters to
create the whole scenario.
User A: generates two prime numbers q = 3 and p = 5 and e = 7. The message M to be sent by this
user to user B is M = [0 1 1 0].
LAB#09
SHA-512 ALGORITHM
OBJECTIVE
The purpose of this lab is to implement SHA-512 algorithm in MATLAB. The main objectives are to
implement the following:
THEORY
Algorithm:
Round Function:
Each 64-bit word is shuffled along one place, and in some cases manipulated using a series of simple
logical functions (ANDs, NOTs, ORs, XORs, ROTates), in order to provide the avalanche &
completeness properties of the hash function. The elements are:
Six of the eight words of the output of the round function involve simply permutation (b, c, d, f, g, h) by
means of rotation. This is indicated by shading in Figure 11.10. Only two of the output words (a, e) are
generated by substitution. Word e is a function of input variables d, e, f, g, h, as well as the round word W
t and the constant Kt. Word a is a function of all of the input variables, as well as the round word W t and
the constant Kt.
Key Generation:
Wt are derived from the 1024-bit message. The first 16 values of Wt are taken directly from the 16 words
of the current block. The remaining values are defined as a function of the earlier values using ROTates,
SHIFTs and XORs as shown. The function elements are:
Thus, in the first 16 steps of processing, the value of Wt is equal to the corresponding word in the
message block. For the remaining 64 steps, the value of Wt consists of the circular left shift by
one bit of the XOR of four of the preceding values of Wt, with two of those values subjected to
shift and rotate operations. This introduces a great deal of redundancy and interdependence into
the message blocks that are compressed, which complicates the task of finding a different message
block that maps to the same compression function output.
Lab Tasks:
21. Write the program for the round function of SHA-512.
22. Write the program for generating sub keys for each round.
LAB#10
Digital Signature Algorithm (DSA)
OBJECTIVE
The purpose of this lab is to implement the DSS (DSA) algorithm in MATLAB for providing a digital
signature to a message.
THEORY
DSS Approach:
US Govt approved this signature scheme which was designed by NIST & NSA in early 90's and
published as FIPS-186 in 199. Further, it was revised in 1993, 1996 & then 2000
Uses the SHA hash algorithm
DSS is the standard, DSA is the algorithm
DSA Algorithm:
It is a digital signature scheme only and cannot be used for other purposes like RSA approach
Creates a 320 bit signature with 512-1024 bit security (i.e. value of L)
Smaller and faster than RSA
Security depends on difficulty of computing discrete logarithms
Choose a large prime p with 2L-1 < p < 2L where L= 512 to 1024 bits and is a multiple of
64
Choose q with 2159 < q < 2160 such that q is a 160 bit prime divisor of (p-1)
Choose g = h(p-1)/q mod p where 1<h<p-1 and h(p-1)/q mod p > 1
Users choose private & compute public key: choose random x<q (Private key)
Compute y = gx mod p (Public key)
Signing:
Verifying:
w = s-1 mod q
u1= [H(M)w ]mod q
u2= (rw)mod q
v = [(gu1 yu2)mod p ]mod q
If v = r then signature is verified
MATLAB Code:
The first step is simply to select the parameters satisfying the above mentioned rules.
The rest of the operations either in signing or verifying is the modulo operation.
Lab Tasks:
Perform the DSS (DSA) by assuming the Hash function and perform necessary modifications in
the global parameters. Choose all the parameters by yourself.
LAB#11
Configure Routers for Syslog, NTP, and SSH Operations
OBJECTIVE
THEORY
The network topology shows three routers. You will configure NTP and Syslog on all routers. You will
configure SSH on R3.
Network Time Protocol (NTP) allows routers on the network to synchronize their time settings with an
NTP server. A group of NTP clients that obtain time and date information from a single source have more
consistent time settings and Syslog messages generated can be analyzed more easily. This can help when
troubleshooting issues with network problems and attacks. When NTP is implemented in the network, it
can be set up to synchronize to a private master clock, or to a publicly available NTP server on the
Internet.
The NTP Server is the master NTP server in this lab. You will configure the routers to allow the software
clock to be synchronized by NTP to the time server. Also, you will configure the routers to periodically
update the hardware clock with the time learned from NTP. Otherwise, the hardware clock will tend to
gradually lose or gain time (drift) and the software clock and hardware clock may become out of
synchronization with each other.
The Syslog Server will provide message logging in this lab. You will configure the routers to identify
the remote host (Syslog server) that will receive logging messages.
You will need to configure timestamp service for logging on the routers. Displaying the correct time and
date in Syslog messages is vital when using Syslog to monitor a network. If the correct time and date of a
message is not known, it can be difficult to determine what network event caused the message.
R2 is an ISP connected to two remote networks: R1 and R3. The local administrator at R3 can perform
most router configurations and troubleshooting; however, since R3 is a managed router, the ISP needs
access to R3 for occasional troubleshooting or updates. To provide this access in a secure manner, the
administrators have agreed to use Secure Shell (SSH).
You use the CLI to configure the router to be managed securely using SSH instead of Telnet. SSH is a
network protocol that establishes a secure terminal emulation connection to a router or other networking
device. SSH encrypts all information that passes over the network link and provides authentication of the
remote computer. SSH is rapidly replacing Telnet as the remote login tool of choice for network
professionals.
The servers have been pre-configured for NTP and Syslog services respectively. NTP will not require
authentication. The routers have been pre-configured with the following:
Enable password: ciscoenpa55
Password for vty lines: ciscovtypa55
Static routing
Addressing Table
R3 to periodically update the hardware clock with the time learned from NTP.
Verify that the hardware clock was updated using the command show clock.
The router console will display a message that logging has started.
From the Config tab of the Syslog server’s dialogue box, select the Syslog services button. Observe the
logging messages received from the routers.
Note: Log messages can be generated on the server by executing commands on the router. For example,
entering and exiting global configuration mode will generate an informational configuration message.
Step 2. Configure users for login from the SSH client on R3.
Create a user ID of SSHadmin with the highest possible privilege level and a secret password
of ciscosshpa55.
Use the local user accounts for mandatory login and validation. Accept only SSH connections.
The router uses the RSA key pair for authentication and encryption of transmitted SSH data. Configure
the RSA keys with a modulus of 1024. The default is 512, and the range is from 360 to 2048.
R3(config)# crypto key generate rsa [Enter]
The name for the keys will be: R3.ccnasecurity.com
Choose the size of the key modulus in the range of 360 to 2048 for your
General Purpose Keys. Choosing a key modulus greater than 512 may take
a few minutes.
Note: The command to generate RSA encryption key pairs for R3 in Packet Tracer differs from those
used in the lab.
Use the show ip ssh command to see the current settings. Verify that the authentication timeout and
retries are at their default values of 120 and 3.
The default SSH timeouts and authentication parameters can be altered to be more restrictive. Set the
timeout to 90 seconds, the number of authentication retries to 2, and the version to 2.
Issue the show ip ssh command again to confirm that the values have been changed.
Open the Desktop of PC-C. Select the Command Prompt icon. From PC-C, enter the command to connect
to R3 via Telnet.
PC> telnet 192.168.3.1
This connection should fail, since R3 has been configured to accept only SSH connections on the virtual
terminal lines.
Open the Desktop of PC-C. Select the Command Prompt icon. From PC-C, enter the command to connect
to R3 via SSH. When prompted for the password, enter the password configured for the
administrator ciscosshpa55.
In order to troubleshoot and maintain the R3 router, the administrator at the ISP must use SSH to access
the router CLI. From the CLI of R2, enter the command to connect to R3 via SSH version 2 using the
SSHadmin user account. When prompted for the password, enter the password configured for the
administrator: ciscosshpa55.
Lab Task:
Configure a topology of four routers for Syslog and NTP. Also provide authentication using SSH
protocol.
LAB#13
Authentication, Authorization &
Accounting (AAA) Server
OBJECTIVE
The purpose of this lab is to configure AAA (RADIUS) for authenticating host on Cisco router in Packet
tracer.
THEORY
RADIUS means Remote Authentication Dial-In User Service server or proxy. It is a distributed
client/server system that secures networks against unauthorized access. . In the Cisco implementation,
RADIUS clients run on Cisco routers and send authentication requests to a central RADIUS server that
contains all user authentication and network service access information. RADIUS is a fully open
protocol, distributed in source code format that can be modified to work with any security system
currently available on the market.
Cisco supports RADIUS under its AAA security paradigm. RADIUS can be used with other AAA
security protocols, such as TACACS+, Kerberos, and local username lookup. RADIUS is supported on
all Cisco platforms, but some RADIUS-supported features run only on specified platforms.
RADIUS has been implemented in a variety of network environments that require high levels of security
while maintaining network access for remote users. It can control the access for all sorts of networks,
wireless, VPN, dial-up, direct device to device like router to router connections, basically wherever put it
can do the control. There is also RADIUS proxy configuration where proxy only receives and accepts the
connection requests but for the decision making it will be connected to other server who will do the
RADIUS role.
RADIUS is not suitable in the following network security situations:
• Multiprotocol access environments. RADIUS does not support the following protocols:
• Router-to-router situations. RADIUS does not provide two-way authentication. RADIUS can be used
to authenticate from one router to a non-Cisco router if the non-Cisco router requires RADIUS
authentication.
• Networks using a variety of services. RADIUS generally binds a user to one service model.
There are two major ways to deploy radius server and that are:
Deployment of Free RADIUS server on UNIX servers. This is by many network engineers basically a
best daemon which implements radius protocol and makes UNIX server a RADIUS enabled server.
Deployment of IAS role – Internet Authentication Service on Windows Server machine will allow to
make Windows Server machine respond to RADIUS requests and act as a real RADIUS server.
It includes some AD stuff implemented in so it will be able to authenticate the users from Active
Directory domain. Which is his biggest advantage over UNIX deployment of course if there is an AD
deployed in the organization, and it’s surely.
RADIUS server connects to user account database which is Active Directory in Windows Server or some
normal user database in UNIX. Can be normal SQL table with users in it and can checks access
credentials. If the user is authorized to access some network that is secured with RADIUS, it will authorize
the access for that user and writes a log of the user entrance to the network.
RADIUS server
RADIUS clients or Access servers the same thing
Access clients
RADIUS proxies
User account databases
Access clients
It is a computer, phone, tabled or some other IP enabled network device who wants to connect to the
network.
RADIUS servers
RADIUS server processes connection requests or accounting messages from RADIUS clients and grants
the connection of some devices to the network or not.
RADIUS proxy
A RADIUS proxy is a mediator between RADIUS clients and servers. It will receive connection requests
and accounting messages from Access server and forward those messages to RADIUS Server.
RADIUS Operation
When a user attempts to log in and authenticate to an access server using RADIUS, the following steps
occur:
The ACCEPT or REJECT response is bundled with additional data that is used for EXEC or network
authorization. You must first complete RADIUS authentication before using RADIUS authorization.
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface FastEthernet0/0
Router(config-if)#ip address 192.168.0.2 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config)#hostname R0
R0(config)#
Enable Service Put your Client name, its IP Address and Select Radius, click on Add button
Define a Username and password, then click on Add button
R0(config)#aaa new-model
R0(config)#line console 0
R0(config-line)#login authentication default
R0(config-line)#end
R0#
%SYS-5-CONFIG_I: Configured from console by console
R0#wri mem
Building configuration...
[OK]
R0#logout
R0>
Lab Tasks:
Adding two more hosts on the topology and perform authentication of them from RADIUS server.
What is AAA?
What is Network Access Server?
LAB#13
IPsec Site-to-Site Virtual Private Network (VPN)
OBJECTIVE
The purpose of this lab is to configure IPsec site-to-site Virtual Private Network (VPN) on Cisco routers
in Packet tracer.
THEORY
Virtual Private Networks (VPNs) can provide a secure method of transmitting data over a public network,
such as the Internet. VPN connections can help reduce the costs associated with leased lines. Site-to-Site
VPNs typically provide a secure (IPsec or other) tunnel between a branch office and a central office.
Another common implementation that uses VPN technology is remote access to a corporate office from a
telecommuter location such as a small office or home office.
Packet tracer commands
Scenario
In this lab, you build a multi-router network and configure the routers and hosts. You use Cisco IOS and
SDM to configure a site-to-site IPsec VPN and test it. The IPsec VPN tunnel is from router R1 to router
R3 via R2. R2 acts as a pass-through and has no knowledge of the VPN. IPsec provides secure
transmission of sensitive information over unprotected networks such as the Internet. IPsec acts at the
network layer, protecting and authenticating IP packets between participating IPsec devices (peers), such
as Cisco routers.
Configure an IP Address on Routers, Switches and PCs according to the following table
The Security Technology Package license must be enabled to complete this activity.
a. Issue the show version command in the user EXEC or privileged EXEC mode to verify that the
Security Technology Package license is activated.
b. If not, activate the securityk9 module for the next boot of the router, accept the license, save the
configuration, and reboot.
c. After the reloading is completed, issue the show version again to verify the Security Technology
Package license activation.
Configure ACL 110 to identify the traffic from the LAN on R1 to the LAN on R3 as interesting. This
interesting traffic will trigger the IPsec VPN to be implemented whenever there is traffic between R1 to
R3 LANs. All other traffic sourced from the LANs will not be encrypted. Due to the implicit deny any,
there is no need to add the statement to the list.
Configure the crypto ISAKMP policy 10 properties on R1 along with the shared crypto key cisco. Default
values do not have to be configured therefore only the encryption, key exchange method, and DH method
must be configured.
Create the transform-set VPN-SET to use esp-3des and esp-sha-hmac. Then create the crypto map VPN-
MAP that binds all of the Phase 2 parameters together. Use sequence number 10 and identify it as an
ipsec-isakmp map.
Finally, bind the VPN-MAP crypto map to the outgoing Serial 0/0/0 interface.
Now configure reciprocating parameters on R3. Configure ACL 110 identifying the traffic from the LAN
on R3 to the LAN on R1 as interesting
Configure the crypto ISAKMP policy 10 properties on R3 along with the shared crypto key cisco.
Like on R1, create the transform-set VPN-SET to use esp-3des and esp-sha-hmac. Then create the crypto
map VPN-MAP that binds all of the Phase 2 parameters together. Use sequence number 10 and identify it
as an ipsec-isakmp map.
Finally, bind the VPN-MAP crypto map to the outgoing Serial 0/0/1 interface. Note: This is not graded.
R3(config)# interface S0/0/1
R3(config-if)# crypto map VPN-MAP
Issue the show crypto ipsec sa command on R1. Notice that the number of packets encapsulated,
encrypted, decapsulated and decrypted are all set to 0.
On R1, re-issue the show crypto ipsec sa command. Now notice that the number of packets is more than 0
indicating that the IPsec VPN tunnel is working.
On R1, re-issue the show crypto ipsec sa command. Finally, notice that the number of packets has not
changed verifying that uninteresting traffic is not encrypted.
Lab Tasks:
LAB#14
OPEN ENDED LAB
TITLE:
1. Objective
Design a scenario for two company networks, you need to synchronize the timings and logging of the
messages/activities and also establish a secure connection between your company and another network.
Also make sure the admin user the network is authorized to configure the router of its respective network
2. Hardware/Software required
3. Diagram
4. Methodology
5. Observation
7. Conclusion