ACN File
ACN File
ACN File
EXP
NO. EXPERIMENT NAME Date of Date of
Performing Checking
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:
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.
Configure default gateways: Set the default gateway for each device,
which is the router's IP address responsible for routing traffic between
networks.
Instructions
In Part 1, you will cable the devices together according to the network topology.
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.
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
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.
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 ]
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.
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: -
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 ]
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.
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.
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.
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
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
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
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.
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
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].
Come back on linuxclient system and try to login from user vikram
upload/download file
Login again from normal user and try to change parent directory
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.
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);
}
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) {
Codes:
Part 1: OpenNMS + SNMPD
# Install OpenNMS
sudo apt-get update
sudo apt-get install opennms
# Install SNMPD
sudo apt-get install snmpd
# Restart SNMPD
sudo service snmpd restart
# Implement NIS
sudo apt-get install nis