Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

ACN File

Download as pdf or txt
Download as pdf or txt
You are on page 1of 44

INDEX

EXP
NO. EXPERIMENT NAME Date of Date of
Performing Checking

Configuration and logging to a CISCO Router


1. and introduction to the basic user Interfaces.
Introduction to the basic router configuration
and basic commands.

2. Configuration of IP addressing for a given


scenario for a given set of topologies

3. Configure a DHCP Server to serve


contiguous IP addresses to a pool of four IP
devices with a default gateway and a default
DNS address. Integrate the DHCP server
with a BOOTP demon to automatically serve
Windows and Linux OS Binaries based on
client MAC address.

Configure, implement and debug the


following: Use open source tools for
debugging anddiagnostics.
4.
a. ARP/RARP protocols
b. RIP routing protocols
c. BGP routing
d. OSPF routing protocols
e. Static routes (check using netstat)

Configure DNS: Make a caching DNS


client, and a DNS Proxy; implement
reverse DNS and forwardDNS, using TCP
5. dump/Wireshark characterise traffic when
the DNS server is up and when it isdown.
INDEX

Configure FTP Server on a


6. Linux/Windows machine using a
FTP client/SFTP client
characterise file transfer rate for a
cluster of small files 100k each and
a video file of 700mb.Use a TFTP
client and repeat the experiment.

Configure a mail server for


7. IMAP/POP protocols and write a
simple SMTP client inC/C++/Java
client to send and receive mails.

Implement Open NMS+ SNMPD for


8. checking Device status of devices in
community MIB ofa linux PC. Using yellow
pages and NIS/NFS protocols implement
Network Attached Storage Controller
(NAS).Extend this to serve a windows client
using SMB. Characterise the NAS traffic
using wireshark.
Experiment-1
Aim: - Configuration and logging to a CISCO Router and introduction to the
basic user Interfaces. Introduction to the basic router configuration and basic
commands.
Theory: -
Cisco routers are widely used in networking environments to provide
connectivity and routing between various networks. Configuring and logging
Cisco routers is essential for maintaining network stability and troubleshooting
issues. This guide will provide an overview of basic Cisco router configuration
and logging, as well as an introduction to the basic user interfaces.
Basic User Interface:
Cisco routers offer two primary user interfaces for configuration and
management:
Command-Line Interface (CLI): The CLI provides a text-based interface for
interacting with the router using commands. It is a powerful and flexible tool for
experienced network administrators.
Web-Based Management Interface (WebGUI): The WebGUI offers a graphical
user interface (GUI) for configuring and managing the router. It is a user-friendly
option for those less comfortable with the CLI.

Basic Router Configuration: -


Configuring a Cisco router involves setting up various parameters, such as IP
addresses, routing protocols, and security settings. The specific configuration
steps vary depending on the router model and network requirements. However,
some common configuration tasks include:

Setting the hostname: The hostname is the router's unique identifier on the
network. It is used to identify the router when communicating with other devices.
Configuring IP addresses: IP addresses are assigned to the router's interfaces,
allowing it to participate in the network. Static IP addresses are manually
configured, while dynamic IP addresses are obtained from a DHCP server.

Basic Commands

Here are some commonly used basic commands for Cisco routers:

 show running-config: Displays the current router configuration.

 show ip interface brief: Displays a summary of IP interface information.

 show ip route: Displays the routing table.


 ping: Tests connectivity to a remote device.

 ping summary: Provides a summary of ping results.

Defining routing protocols: Routing protocols enable the router to exchange


routing information with other routers, allowing it to determine the best paths for
traffic to flow. Common routing protocols include RIP, OSPF, and BGP.

Configuring security settings: Security settings, such as access control lists


(ACLs) and firewalls, are implemented to protect the router and the network from
unauthorized access and attacks.
Experiment-2
Aim: - Configuration of IP addressing for a given scenario for a given set of
topologies.
Theory: -
Configuring IP addressing for a given scenario for a given set of topologies
involves determining the appropriate IP address ranges and subnet masks for each
network segment. This process ensures that devices within the same network can
communicate efficiently while preventing conflicts with devices on other
networks.

Steps for Configuring IP Addressing:

 Identify network topology: Determine the layout of the network,


including the number of devices, routers, and switches.

 Determine network requirements: Calculate the number of host


addresses needed for each network segment based on the number of
devices.

 Choose a suitable IP address range: Select an IP address range from the


private IP address ranges (10.0.0.0/8, 172.16.0.0/16, or 192.168.0.0/16)
based on the network size.

 Subnet the IP address range: Divide the IP address range into subnets to
create smaller, more manageable network segments. The subnet mask
determines the number of hosts and networks within a subnet.

 Assign IP addresses to devices: Assign IP addresses within the subnet


ranges to each device on the network. Ensure that no two devices have the
same IP address.

 Configure default gateways: Set the default gateway for each device,
which is the router's IP address responsible for routing traffic between
networks.

 Verify configuration: Test the IP address configuration by pinging devices


within the same network and across different networks.
Scenario: - Networks are constructed of three major components: hosts,
switches, and routers. In this lab, you will build a simple network with two hosts
and a wireless router with at least two switchports. You will apply IP addressing
for this lab to the PCs to enable communication between these two devices. Use
the ping utility to verify connectivity.

Instructions

Part 1: Set Up the Network Topology (Ethernet only): -

In Part 1, you will cable the devices together according to the network topology.

Step 1: Power on the devices.


Power on all devices in the topology.

Step 2: Connect the PCs to the switch.


Connect one end of an Ethernet cable to the NIC port on PC-A. Connect the other
end of the cable to a switchport on the wireless router. After connecting the PC to
the switchport, you should see the light for the switchport turn amber and then
green, indicating that PC-A has been connected correctly.
Repeat the same procedure for PC-B.

Step 3: Visually inspect network connections.


After cabling the network devices, take a moment to carefully verify the
connections to minimize the time required to troubleshoot network connectivity
issues later.

Part 2: Configure PC Hosts


In this lab, all the network configurations are done on a Windows 10 PC.

Step 1: Configure static IP address information on the PCs.

 To configure the Network Settings on PC-A, click Start, then click Settings.
 In the Settings window click Network & Internet.
 In the left pane select Ethernet, then click Change adapter options.
 The Network Connections window displays the available network
interfaces on the PC. Right-click the Ethernet0 interface and select
Properties.
 Select the Internet Protocol Version 4 (TCP/IPv4) option and then click
Properties.

Step 2: Verify PC settings and connectivity.


Use the Command Prompt to verify the PC settings and connectivity.

 From PC-A, click Start and search for Command Prompt.


 The Command Prompt window is where you can enter commands directly
to the PC and view the results of those commands. Verify your PC settings
by using the ipconfig /all This command displays the PC hostname and the
IP address information.
 Type ping 192.168.1.11.
Experiment - 3
Aim: - Configure a DHCP Server to serve contiguous IP addresses to a pool of four IP
devices with a default gateway and a default DNS address. Integrate the DHCP server
with a BOOTP demon to automatically.
Theory: -
1. Configure DHCP Server
 Access the DHCP server's configuration interface, either through a web-based
interface or a command-line interface (CLI).
 Define the DHCP pool: Specify the range of IP addresses from which the DHCP
server will allocate addresses to clients. For instance, if you have four devices, you
can use a range like 192.168.1.100 to 192.168.1.103.
 Set the default gateway: Enter the IP address of the router that serves as the default
gateway for the network. This gateway will handle routing traffic between the
local network and the Internet.
 Configure DNS servers: Specify the IP addresses of the DNS servers that clients
will use to resolve domain names into IP addresses. You can use public DNS
servers like 8.8.8.8 and 8.8.4.4.
2. Integrate DHCP Server with BOOTP Demon
 Install the BOOTP demon on the system running the DHCP server. BOOTP is a
boot protocol that allows DHCP servers to provide boot information to clients,
such as the location of the operating system image to load.
 Configure the BOOTP demon to serve Windows and Linux OS binaries: Specify
the network paths or URLs to the Windows and Linux OS binaries. The BOOTP
demon will automatically serve the appropriate binary based on the client's MAC
address.
3. Verify DHCP and BOOTP Functionality
 Connect the four IP devices to the network.
 Check the DHCP server's logs or client IP addresses to confirm that the DHCP
server has assigned IP addresses to the devices.
 Restart one of the devices and observe whether it boots into the correct operating
system based on its MAC address.
Additional Notes:
 The specific configuration steps will vary depending on the DHCP server and
BOOTP demon software you are using.
 Ensure that the DHCP server and BOOTP demon are configured correctly to avoid
IP address conflicts and boot issues.
 Consult the documentation for your specific DHCP server and BOOTP demon
software for detailed configuration instructions.

Configure DHCP server: -


We are using three systems one Linux server, one Linux client and one window client.
The dhcp package contains an Internet Systems Consortium (ISC) DHCP server.
First, install the package as the superuser:

DHCP server have a static a ip address. First configure the ip address


192.168.0.254 with netmask of 255.255.255.0 on server.
Run setup command form root user

this will launch a new window select network configuration.


now a new window will show you all available LAN card select your LAN card (
if you don't see any LAN card here mean you don't have install driver).

assign IP in this box and click ok.


click on ok, quit and again quit to come back on root prompt.
restart the network service so new ip address can take place on LAN card
#service network restart
main configuration file of dhcp server is dhcpd.conf. This file located on /etc
directory. If this file is not present there or you have corrupted this file, then copy
new file first, if ask for overwrite press y

now open /etc/dhcpd.conf

Default entry in this file look like this

Make these change in this file to configure dhcp server


remove this line # - - - default gatewayset
option routers to 192.168.0.254
set option subnet-mask to 255.255.255.0
option is domain to example.com
option domain-name to example.com
option domain-name-servers to 192.168.0.254
range dynamic-bootp to 192.168.0.10 192.168.0.50;
After changing this file should look like this,

Assign fix Ip address to any host:

locate this paragraph and change hardware Ethernet to client's mac address
and fixed - address to ip address which you want to provide that host.
After making necessary change save file and exit
Now create a blank file use to store the allocated ip address information

Now restart dhcp service and on it with chkconfig commands


Experiment- 4
Aim: - Configure, implement, and debug the following: Use open-source tools
for debugging and diagnostics.
a. ARP/RARP protocols
b. RIP routing protocols
c. BGP routing
d. OSPF routing protocols
e. Static routes (check using netstat)

Theory: -
1) ARP/RARP Protocol: -
ARP (Address Resolution Protocol) and RARP (Reverse ARP) are two
complementary protocols that are used to map IP addresses to MAC addresses.
ARP is used by hosts on a local network to discover the MAC address of a
host that they want to communicate with. RARP is used by diskless
workstations to obtain an IP address from a RARP server.

To configure and implement ARP/RARP, you will need to install and


configure an ARP/RARP server. There are several open-source ARP/RARP
servers available, such as arpd and rarpd. You will also need to configure your
hosts to use the ARP/RARP server.

To debug ARP/RARP, you can use a network sniffer, such as tcpdump or


Wireshark, to capture and analyse ARP/RARP traffic. You can also use the
following tools:

 arp: This command displays the ARP cache on a Linux system.


 rarp: This command displays the RARP cache on a Linux system.
 ping: This command sends an ICMP echo request to a host, which will
cause the host to send an ARP request if the host's IP address is not in
the ARP cache.

Configure ARP:
On each host, enable ARP by running the following command: [ arp -a ]
Implement ARP:
Send an ARP request to a host to resolve its MAC address: [ arp -a <IP
address of Target machine> ]

Debug ARP:
Use the arp command to view the ARP cache: [ arp -a ]

2) RIP routing protocols: -

RIP (Routing Information Protocol) is a dynamic distance vector routing


protocol that is used to exchange routing information between routers. RIP
is a simple and easy to configure protocol, but it is not very scalable.

To configure and implement RIP, you will need to enable RIP on your
routers. You will also need to configure the RIP routing table, which
specifies the networks that the routers will advertise to each other.

To debug RIP, you can use the following tools:

[show ip route] This command displays the routing table on a Cisco


router.
[debug ip rip] This command enables debugging for RIP on a Cisco
router.

Configure RIP:
On each router, enable RIP by running the following command: [ rip ]

Implement RIP:
Send a RIP update to announce its routing table: [ router rip update ]
Debug RIP:
Use the command to view the RIP routing table: [ show ip rip ]

3) BGP routing: -

BGP (Border Gateway Protocol) is an exterior routing protocol that is used by


large networks, such as the Internet, to exchange routing information between
autonomous systems (Acses). BGP is a complex protocol, but it is very
scalable.

To configure and implement BGP, you will need to configure the BGP
neighbours, which are the routers that will exchange routing information. You
will also need to configure the BGP routing table, which specifies the
networks that the routers will advertise to each other.
To debug BGP, you can use the following tools:

show ip bgp: This command displays the BGP routing table on a Cisco
router.
debug bgp: This command enables debugging for BGP on a Cisco router.

Configure BGP:
On each router, enable BGP by running the following command: [ bgp ]

Implement BGP:
Send a BGP update to advertise its routing table: [ router bgp update ]

Debug BGP:
Use the show ip bgp command to view the BGP routing table:[ show ip bgp ]

4) OSPF routing protocols: -

OSPF (Open Shortest Path First) is an interior routing protocol that is used to
exchange routing information within an autonomous system (AS). OSPF is a
link-state routing protocol, which means that it floods the network with
routing information, and the routers then use this information to calculate the
shortest path to each network.

To configure and implement OSPF, you will need to configure the OSPF area,
which is a group of routers that share a common routing table. You will also
need to configure the OSPF neighbours, which are the routers that will
exchange routing information.

To debug OSPF, you can use the following tools:


show ip ospf: This command displays the OSPF routing table on a Cisco
router.
debug ip ospf: This command enables debugging for OSPF on a Cisco
router.

Configure OSPF:
On each router, enable OSPF by running the following command: [ ospf ]

Implement OSPF:
Send an OSPF update to advertise its routing table: [ router ospf update ]

Debug OSPF:
Use the show ip ospf command to view the OSPF routing table: [ show ip
ospf ]

5) Static routes: -

A static route is a manually configured route that tells a router how to reach a
specific network. Static routes are typically used for networks that are not
reachable through a dynamic routing protocol, such as a network that is
connected to a directly connected router.
To configure a static route, you will need to specify the IP address of the
network, the subnet mask of the network, and the next-hop router that the
router should use to reach the network.

To debug static routes, you can use the following tools:


show ip route: This command displays the routing table on a Cisco router.
ping: This command sends an ICMP echo request to a host on the network,
which will cause the router to use the static route to reach the host.
Open-source tools for debugging and diagnostics

Configure static routes:


On each router, add a static route to a specific network: [ ip route <network
address> <subnet mask> <gateway address> ]

Implement static routes:


Use the ip route command to view the static routing table: [ ip route ]

Debug static routes:


Use the command to view the routing table, including both static and
dynamic routes: [ netstat -rn ]
Experminent-5

Aim:- Configure DNS: Make a caching DNS client, and a DNS Proxy
implement reverse DNS and forward DNS, using TCP dump/Wireshark
characterise traffic when the DNS server is up and when it is down.
Theory:-
A DNS server (BIND), or name server, is used to resolve an IP
address to a hostname or vice versa.
You can set up four different types of DNS servers:
 A master DNS server for your domain(s), which stores
authoritative records for your domain.
 A slave DNS server, which relies on a master DNS server for
data.
 A caching-only DNS server, which stores recent requests like a
proxy server. It otherwise refers
 to other DNS servers.
 A forwarding-only DNS server, which refers all requests to
other DNS servers.
Before configuring BIND to create a DNS server, you must
understand some basic DNS concepts.
The entire hostname with its domain such as server.example.com is
called a fully qualified domain name (FQDN). The right-most part of
the FQDN such as .com or .net is called the top level domain,with
the remaining parts of the FQDN, which are separated by periods,
being sub-domains.These sub-domains are used to divide FQDNs
into zones, with the DNS information for each zone being maintained
by at least one authoritative name server.The authoritative server that
contains the master zone file, which can be modified to update DNS
information about the zone, is called the primary master server, or
just master server.
The additional name servers for the zone are called secondary servers
or slave servers. Secondary servers retrieve information about the
zone through a zone transfer from the master server or from another
secondary server. DNS information about a zone is never modified
directly on the secondary server.
Configure dns server
In this example we will configure a dns server and will test from
client side.For this example we are using three systems one linux
server one linux clients and one window clients.bind and caching-
nameserver rpm is required to configure dns. check them for install
if not found install them.

Set hostname to server.example.com and ip address to 192.168.0.254

main configuration file for dns server is named.conf. By default this file is not
created in /var/named/chroot/etc/ directory. Instead of named.conf a sample
file with the name /var/named/chroot/etc/named.caching-nameserver.conf
is created. This file is use to make a caching only name server. You can also do
editing in this file after changing its name to named.conf to configure master
dns server or you can manually create a new named.conf file.
In this example we are creating a new named.conf file

save this file with :wq and exit


Configure zone file
We have defined two zone files example.com.zone for forward zone and
0.168.192.in-addr.arpa for reverse zone. These files will be store in
/var/named/chroot/var/named/ location. We will use two sample files for
creating these files.
Change directory to /var/named/chroot/var/named and copy the sample files
to name which we have set in named.conf

Now open forward zone file example.com.zone


By default this file will look like this

Change this file exactly as shown in image below

Now open reverse lookup zone file 0.168.192.in-addr.arpa

By default this file will look like this

Change this file exactly as shown in image below


Now changed the ownership of these zone files to named group

Now start the named service


Experiment-6
Aim: - Configure FTP Server on a Linux/Windows machine using a FTP
client/SFTP client characterise file transfer rate for a cluster of small files 100k
each and a video file of 700mb.Use a TFTP client and repeat the experiment.
Theory: -
FTP stand for File Transfer Protocol. As the name suggest this network protocol
allows you to transfer files or directories from one host to another over the
network whether it is your LAN or Internet.
Configure FTP Server
vsftpd package is required for FTP Server. Check whether package is installed or
not. If package is missing install it first.

Configure vsftpd service to start at boot

Current status of vsftpd service must be running. Start if it is stopped. Restart


vsftpd service whenever you made any change in configuration file.

FTP Server is by default configured to listen on port 21. Port 21 must be opened
if you have configured firewall. The configuration of a firewall for an FTP server
is a relatively simple process.
#iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT

Create 2 normal user accounts for testing. Create a normal user.


Create another normal user

That's all configure we need on server right now.


Configure FTP client
You will not be able to run ftp command. By default, you will get following
error.

-bash: ftp: command not found error


To run ftp command ftp package is required. Install it if it is not installed.

Check connectivity with FTP Server.


Now try again to run ftp command

We have successfully connected with FTP server.


Go on Server system and open main ftp configuration file
/etc/vsftpd/vsftpd.conf

vsftpd.conf is the main configuration file of FTP server and it contains lot of
directives. Configuration of an anonymous-only download is relatively simple.
Default configuration of vsftpd.conf already supports anonymous-only
download. But it also supports access from local users. All you need to do is
disable the directive which allows locally configured users to login with their
accounts.
Comment following directives and save the file

Restart the vsftpd service

When a user connects on the FTP server with anonymous username, actually that
user connects on the server as a user named ftp. RHEL6 automatically create this
account with following setting.
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin

With these setting users are not allowed to login as the user named ftp. So they
need to use anonymous as user name. So whenever an anonymous user logged
in, he is taken to ftp user's home directory /var/ftp. So if you want to change the
default directory associated with anonymous logins, change the home directory
associated with the local user named ftp. Create a file on the root of the ftp
directory /var/ftp/pub. This file will be downloaded by anonymous user.
# dd if=/dev/null of=/var/ftp/pub/file bs=1024 count=1000

If you are running Linux without SELinux that's all setting which we need for
this exercise. SELinux is listed in RHCE6 exam objective. So if you have
configured SELinux, also configure following boolean option.
# chcon -R -t public_content_t /var/ftp/pub/

Go on linuxclient system and login to the FTP server as anonymous user and
download test_file.

Most commonly commands used on ftp prompt are


put To upload files on server
get To download files from server
mput To upload all files
mget To download all files
? To see all available command on ftp prompts cd To change remote directory
lcd To change local directory.

Create a sample file


Login from anonymous again and try to upload.
Try to login form normal user

Restrict anonymous user to ftp directory.


To test this login form anonymous user again.

Try to change parent directory

FTP non-anonymous server:

In this exercise we will configure FTP server that allow local users logins to their
home directories. Download/upload must be allowed for these users. Go on server
system and open /etc/vsftpd/vsftpd.conf file.
Comment anonymous_login=YES, uncomment local_enable and save the file

open /etc/vsftpd/user_list file

Users listed on /etc/vsftpd/user_list are not allowed to login on FTP server. Add
user vikarm in it. This file also have an entry for root user that why root user is
denied from FTP login. If you want to enable root user for ftp session just remove
its entry from this file [Enable root for FTP session is not recommended in any
circumstances, change at your own risk].

Configure SELinux to allow upload/download in user's home directory

Restart the vsftpd service


Login from normal user sanjay and create a example_file

Come back on linuxclient system and try to login from user vikram

Now try to login from user sanjay

upload/download file
Login again from normal user and try to change parent directory

It allows you to navigate the / directory which serious security issue.


Configure FTP to chroot local users in their home directory
Go on server and open /etc/vsftpd/vsftpd.conf file

Uncomment following directive and save the file


chroot_local_user=YES

Restart the vsftpd restart

Come back on linux client system and login form sanjay and try again to change
directory to /

Now normal user will not be able to navigate outside the home director
Experminent-7

Aim:- To set up and configure a mail server that supports IMAP and POP
protocols. Additionally, students will develop a simple SMTP client in
C/C++/Java to demonstrate the process of sending and receiving emails.
Theory:-
In the realm of email communication, various protocols play distinct roles in
facilitating the sending, receiving, and management of emails. This practical
focuses on the configuration of a mail server supporting Internet Message Access
Protocol (IMAP) and Post Office Protocol (POP) and the development of a
Simple Mail Transfer Protocol (SMTP) client in C/C++/Java.
Mail Server Configuration:
IMAP (Internet Message Access Protocol):
IMAP is a widely used protocol that allows users to access and manage their
email accounts on a remote mail server. The key feature of IMAP is its
synchronization capability, enabling multiple devices to mirror the same mailbox
state. When an email is read or deleted on one device, the changes are reflected
across all connected devices. This makes IMAP suitable for users who access
their emails from various locations and devices. IMAP operates over port 143 by
default and uses Secure IMAP (IMAPS) over port 993 for encrypted
communication.
POP (Post Office Protocol):
POP is another email retrieval protocol that facilitates the download of emails
from a mail server to a local device. Unlike IMAP, which keeps emails on the
server, POP typically downloads emails to a single device, removing them from
the server. This makes POP less suitable for users who access emails from
multiple devices, as changes made on one device do not affect others. POP
operates over port 110, and Secure POP (POP3S) over port 995 ensures secure
communication.
SMTP Client Development:
SMTP is a protocol for sending emails, and developing a basic SMTP client
involves creating a program that can connect to an SMTP server, compose an
email, and send it to a recipient. This section will outline the key components and
steps involved in developing an SMTP client in C/C++/Java.
1. SMTP Protocol Overview:
SMTP follows a client-server model, where the client (sender) communicates
with the server (recipient) to transfer emails. It operates over port 25 by default
and uses Simple Authentication and Security Layer (SASL) mechanisms for
secure authentication.
Connecting to SMTP Server:
The client initiates a connection to the SMTP server using the server's address
and port number.
Handshaking:
The client and server establish terms of successful communication.
Sending Email:
The client sends the sender's email address, recipient's email address, email
content, and other relevant details to the server.
Server Acknowledgment:
The server acknowledges the receipt of the email or notifies the client of the
issues.
Closing Connection:
The client closes the connection after the email is successfully sent.

2. SMTP Client Development in C/C++/Java:


• Language Selection:
• Choose the programming language for SMTP client development
based on Preference and requirements.
• Socket Programming:
• Utilize socket programming libraries to establish a connection to the
SMTP server.
• SMTP Commands:
• Implement SMTP commands such as EHLO, MAIL FROM, RCPT
TO, DATA, and QUIT to interact with the server.
• Email Composition:
• Develop functions to compose email content, including the subject,
body, and recipient details.
• Error Handling:
• Implement error-handling mechanisms to deal with potential issues
during the communication process.

Steps to Perform the Experiment:


Part 1: Mail Server Configuration
1. Install and Configure a Mail Server:
• Choose a mail server software (e.g., Postfix, Dovecot) and install it
on a server machine.
• Configure the mail server to support both IMAP and POP protocols.
2. Create Mailboxes:
• Set up user mailboxes on the mail server.
3. Test IMAP and POP Access:
• Use an email client (e.g., Thunderbird, Outlook) to test IMAP and
POP access to the configured mailboxes.
Part 2: Develop SMTP Client in C/C++/Java
4. SMTP Client Development:
• Choose a programming language (C, C++, Java) for developing the
SMTP client.
• Implement a basic console-based SMTP client that can:
• Connect to an SMTP server.
• Send an email with subject, body, and recipient.
• Receive acknowledgment from the server.
• We can use the following C++ code to create the SMTP Client

CODE:-
#include "lib.h"
#include "deliver.h"
#include "smtp-client.h"
#include <unistd.h>
#include <sys/wait.h>
structsmtp_client { FILE *f;
pid_tpid;
};
staticstructsmtp_client *smtp_client_devnull(FILE **file_r)
{
structsmtp_client *client;
client = i_new(structsmtp_client, 1);
client->f = *file_r = fopen("/dev/null", "w"); if (client->f == NULL)
i_fatal("fopen() failed: %m"); client->pid = (pid_t)-1;
return client;
}
static void ATTR_NORETURN smtp_client_run_sendmail(const char
*destination,
const char *return_path, intfd)
{
const char *argv[7], *sendmail_path;
/* deliver_set's contents may point to environment variables. deliver_env_clean()
cleans them up, so they have to be copied. */
sendmail_path = t_strdup(deliver_set->sendmail_path);
argv[0] = sendmail_path; argv[1] = "-i"; /* ignore dots */ argv[2] = "-f"; argv[3]
= return_path != NULL && *return_path != '\0' ? return_path : "<>"; argv[4] =
"--"; argv[5] = destination;
argv[6] = NULL;
if (dup2(fd, STDIN_FILENO) < 0)
i_fatal("dup2() failed: %m"); deliver_env_clean(); (void)execv(sendmail_path,
(void *)argv); i_fatal("execv(%s) failed: %m", sendmail_path);
}

structsmtp_client *smtp_client_open(const char *destination, const char


*return_path, FILE **file_r)
{
structsmtp_client *client; intfd[2]; pid_tpid;

if (pipe(fd) < 0) {
i_error("pipe() failed: %m"); returnsmtp_client_devnull(file_r);
}
if ((pid = fork()) == (pid_t)-1) { i_error("fork() failed: %m"); (void)close(fd[0]);
(void)close(fd[1]); returnsmtp_client_devnull(file_r);
}
if (pid == 0) {
/* child */ (void)close(fd[1]); smtp_client_run_sendmail(destination,
return_path, fd[0]);
}
(void)close(fd[0]);
client = i_new(structsmtp_client, 1); client->f = *file_r = fdopen(fd[1], "w"); if
(client->f == NULL)
i_fatal("fdopen() failed: %m"); return client;
}
intsmtp_client_close(structsmtp_client *client)
{
int ret = EX_TEMPFAIL, status;
fclose(client->f);
if (client->pid == (pid_t)-1) {
/* smtp_client_open() failed already */
} else if (waitpid(client->pid, &status, 0) < 0) i_error("waitpid() failed: %m");
else if (WIFEXITED(status)) {
ret = WEXITSTATUS(status); if (ret != 0) {

i_error("Sendmail process terminated abnormally, " "exit status %d", ret);


}
} else if (WIFSIGNALED(status)) {
i_error("Sendmail process terminated abnormally, " "signal %d",
WTERMSIG(status));
} else if (WIFSTOPPED(status)) {
i_error("Sendmail process stopped, signal %d", WSTOPSIG(status));
} else {
i_error("Sendmail process terminated abnormally, " "return status %d", status);
}

i_free(client); return ret;


}

5. Compile and Run the SMTP Client:


• Compile the developed SMTP client code using an appropriate
compiler (gcc, g++, javac).
• Run the compiled executable or Java class file.
6. Test Sending Emails:
• Execute the SMTP client and test sending emails to a specified email
address.
• Verify successful email transmission and check the recipient's
mailbox.
7. Test Receiving Emails:
• Use the previously configured IMAP/POP-enabled email client to
test receiving emails sent by the SMTP client.
• Verify the correct reception and content of the emails.
Experiment - 8
AIM:- To implement OpenNMS + SNMPD for Device Status Checking and
NAS Controller Using Yellow Pages, NIS/NFS, and SMB.
Theory:-
1. OpenNMS + SNMPD:
 OpenNMS: An enterprise-grade network management platform that
includes features for discovering and monitoring devices on a
network.
 SNMPD (Simple Network Management Protocol Daemon):
SNMPD is an SNMP agent that collects and organizes information
about devices on a network and makes it available for monitoring.
2. NAS Controller using Yellow Pages, NIS/NFS, and SMB:
 Yellow Pages (YP): A directory service used for centralized
administration of network information, providing a way for
administrators to manage and distribute configuration files.
 NIS (Network Information Service)/NFS (Network File System):
Protocols that enable sharing files and resources across a network.
NIS is used for centralized authentication, while NFS facilitates file
sharing between systems.
 SMB (Server Message Block): A protocol for sharing files, printers,
and other resources between devices on a network. Commonly used
in Windows environments.
Steps to Perform the Experiment:
Part 1: OpenNMS + SNMPD for Device Status Checking
1. Install OpenNMS:
 Install OpenNMS on a Linux PC using the distribution's package
manager.
2. Configure SNMPD:
 Install SNMPD on the Linux PC.
 Configure SNMPD to listen for SNMP requests and set up the
community MIB for device status monitoring.
3. Integrate OpenNMS with SNMPD:
 Configure OpenNMS to discover devices using SNMPD.
 Monitor the device status using OpenNMS dashboards.
Part 2: NAS Controller with Yellow Pages, NIS/NFS, and SMB
4. Set Up Yellow Pages:
 Configure Yellow Pages on the Linux PC for centralized
administration.
5. Implement NIS/NFS:
 Set up NIS for centralized authentication.
 Configure NFS for sharing files across the network.
6. Extend to Serve a Windows Client with SMB:
 Install and configure Samba on the Linux PC to enable SMB sharing.
 Set up shared directories accessible by a Windows client.
7. Characterize NAS Traffic with Wireshark:
 Install Wireshark on the Linux PC.
 Capture and analyze network traffic related to NAS operations
(NFS, SMB) using Wireshark.

Codes:
Part 1: OpenNMS + SNMPD
# Install OpenNMS
sudo apt-get update
sudo apt-get install opennms

# Install SNMPD
sudo apt-get install snmpd

# Configure SNMPD (edit /etc/snmp/snmpd.conf)


# Set community string for device status monitoring
com2sec notConfigUser default public
group notConfigGroup v1 notConfigUser
view systemview included .1
access notConfigGroup "" any noauth exact systemview none none

# Restart SNMPD
sudo service snmpd restart

Part 2: NAS Controller with Yellow Pages, NIS/NFS, and SMB


# Set Up Yellow Pages (YP)
sudo apt-get install ypserv

# Implement NIS
sudo apt-get install nis

# Follow the NIS configuration steps


# Implement NFS
sudo apt-get install nfs-kernel-server
# Configure /etc/exports for NFS sharing
# Extend to Serve a Windows Client with SMB
sudo apt-get install samba
# Configure /etc/samba/smb.conf for SMB sharing
sudo service smbd restart

Part 3: Characterize NAS Traffic with Wireshark


# Install Wireshark
sudo apt-get install wireshark
# Start Wireshark and capture network traffic on the relevant interface
wireshark
# Analyze captured traffic to understand NAS operations (NFS, SMB)

You might also like