0% found this document useful (0 votes)
9 views78 pages

Ch04 Network Applications

Uploaded by

deti1234erbamo
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)
9 views78 pages

Ch04 Network Applications

Uploaded by

deti1234erbamo
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
You are on page 1/ 78

Network Applications

CHAPTER Four

1 Ch04_Network_Applications (Prep. By
Werkineh E)
Outline
 4.1. Introduction  4.3. DNS
 4.3.1. DNS principles and Operations
 4.2. DHCP
 4.3.2. Basic Name Server and Client Configuration
 4.2.1. DHCP Principle
 4.3.3. Caching Only name server
 4.2.2. DHCP Server Configuration
 4.3.4. Primary and Slave Name Server
 4.2.3. DHCP Options, Scope,  4.3.5. DNS Zone Transfers
Reservation and Relaying  4.3.6. DNS Dynamic Updates
 4.2.4. DHCP Troubleshooting  4.3.7. DNS Delegation

 4.3.8. DNS Server Security

 4.3.9. Troubleshooting
2 Ch04_Network_Applications (Prep. By Werkineh E)
Outline ….
 4.4. Web and Proxy Server Configuration  4.5. FTP, File and Print Server
 4.4.1. HTTP Server Configuration Basics  4.5.1. FTP Principles

 4.4.2.Virtual Hosting  4.5.2. Anonymous FTP Server

 4.4.3. HTTP Caching  4.5.3. General Samba Configuration

 4.4.4. Proxy Caching Server Configuration  4.5.4. SAMBA SWAT


 4.4.5. Proxy ACL  4.5.5. NFS and NFS Client Configuration
 4.4.6. Proxy-Authentication Mechanisms  4.5.6. CUPS configuration basics
 4.4.7. Troubleshooting
 4.5.7. Troubleshooting

3 Ch04_Network_Applications (Prep. By Werkineh E)


Outline ….
 4.6. Mail Server basics
 4.7. Remote Administration and Management
 4.6.1. SMTP, POP and IMAP principles
 4.7.1. Router Configuration
 4.6.2. SMTP Relaying Principles
 4.7.2. Webmin/usermin
 4.6.3. Mail Domain Administration
 4.7.3. Team Viewer
 4.6.4. Basic Mail Server Configuration
 4.7.4. Telnet
(Sendmail, postfix, qmail, exim...)
 4.7.5. SSH
 4.6.5. SPAM control and Filtering

 4.6.6. Troubleshooting

4 Ch04_Network_Applications (Prep. By Werkineh E)


Introduction
 Application layer. Programs use application layer protocols to access network
resources.
 Application layer protocols includes:
 DHCP: IP configuration protocol
 HTTP/s:web browsers and web servers communication, s for secure
 FTP: transfer files between FTP clients and servers.
 SMB: Used by servers and client computers for file and printer sharing.
 SMTP: transfer email messages over the Internet
 DNS: names to ip address Resolution
 POP3:retrieve messages from email servers, mailbox cleared and saved to local machine
 SNMP: transfer email messages over the Internet
 Internet Message Access Protocol (IMAP) Used to retrieve messages from some email
5 Ch04_Network_Applications (Prep. By Werkineh E)
servers.
DHCP(Dynamic Host Configuration Protocol)
 a standard tcp/ip protocol that distributes ip configurations to clients
 The alternative to dhcp is manually entering the ip configuration on each
client computer.
 The Need for Dynamic Address Assignment
▪ Portable computers increased
▪ Scarcity of address space
 Configuration parameters for network hosts
▪ IP address
▪ Router
▪ Subnet Mask
▪ Others..

6 Ch04_Network_Applications (Prep. By Werkineh E)


Benefits of Using DHCP
DHCP reduces the complexity and amount of administrative work by using automatic IP
configuration

Automatic IP Configuration Manual IP Configuration

IP addresses are supplied IP addresses are entered


automatically manually
Correct configuration IP address could be entered
information is ensured incorrectly
Client configuration is Communication and
updated automatically network issues can result
A common source of Frequent computer moves
network problems is increase administrative
eliminated effort
7
Ch04_Network_Applications (Prep. By Werkineh E)
How DHCP Allocates IP Addresses
Non-DHCP DHCP Client2:
Client: Static IP IP configuration
configuration from DHCP server
Lease Renewal
Lease
Generation
DHCP Server

DHCP Client1: DHCP


IP configuration Database
from DHCP
server
IP Address1: Leased to DHCP Client1
IP Address2: Leased to DHCP Client2
IP Address3: Available for lease
8 Ch04_Network_Applications (Prep. By Werkineh E)
How DHCP Lease Generation Works
DHCP
Server2

DHCP
Server1 DHCP
Client

11 DHCP
DHCP client
client broadcasts
broadcastsaaDHCPDISCOVER
DHCPDISCOVERpacket
packet
Note: All four broadcasts are layer
22 DHCP servers
DHCP servers broadcast
broadcastaaDHCPOFFER
DHCPOFFERpacket
packet 2 ethernet broadcast to mac
address ff:ff:ff:ff:ff:ff and a layer 3
33 DHCP
DHCP client
client broadcasts
broadcastsaaDHCPREQUEST
DHCPREQUESTpacket
packet ip broadcast to 255.255.255.255.

44 DHCP
DHCP Server1 broadcastsaaDHCPACK
Server1 broadcasts DHCPACKpacket
packet with
Configuration parameters
Ch04_Network_Applications (Prep. By Werkineh E)
How DHCP Lease Renewal Works
DHCP
DHCP
Server2
Server2

DHCP
Client
DHCP Client
DHCP
DHCP
Server1
Server1

50%
50%of
87.5%
100% oflease
of
of lease
lease
lease
duration
duration has
durationhas has
expired
expired
expired
expired

If the
1 client
DHCP fails
clientto renew
sends it’s lease, after
a DHCPREQUEST 87.5% of the
packet
If1theDHCP
clientClient
fails sends a DHCPREQUEST
to renew its lease, afterpacket
50% of the lease
lease has expired, then the DHCP lease generation process
duration has expired, then the DHCP lease renewal process
starts
2 over
begins DHCPagain
again Server1
after with a DHCP
sends
87.5% client
a DHCPACK broadcasting
packet a
2 DHCP Server1 sends a of the
DHCPACK lease duration
packet has expired
DHCPDISCOVER

10 Ch04_Network_Applications (Prep. By Werkineh E)


What Is a DHCP Relay Agent
A DHCP relay agent listens for DHCP broadcasts from
DHCP clients and then, relays them to DHCP servers in
different subnets

DHCP Relay Agent DHCP Server

Unicast

Broadcast Broadcast
Subnet A Subnet B
Routers
(Non–RFC
1542
Compliant)
Client Client Client Client

11 Ch04_Network_Applications (Prep. By Werkineh E)


DHCP Server Authorization
DHCP authorization registers the DHCP Server service in the
Active Directory domain to support DHCP clients
If DHCP
DHCP Server1
Server1 finds with
checks its IPthe
address on
domain
controller toservice
the list, the obtain starts
a list of
andauthorized
supports
DHCP
DHCP servers
clients
Domain DHCP Server1
Controller
Authorized
Services DHCP
AD DS requests

DHCP Server2
DHCP Client Unauthorized
Does not service
DHCP requests
DHCP Server2
If DHCP checks
Server2 does with
notthe domain
find its IP
DHCP client receives IP address
address on
controller to the list,athe
obtain list service does not
of authorized DHCP
12 from authorized DHCP Server1
Ch04_Network_Applications
start and support DHCP clients (Prep. By Werkineh E)
servers
DEPLOYING AND CONFIGURING THE
DHCP SERVICE

13 Ch04_Network_Applications (Prep. By Werkineh E)


Configuration of DHCP on Debian Server
Step 1: Installing DHCP Server
1.Run the command below to install the DCHP server package, which was
formerly known as dhcp3-server.
 $ sudo apt install isc-dhcp-server
2. When the installation completes, edit the file /etc/default/isc-dhcp-server to
define the interfaces DHCPD should use to serve DHCP requests, with the
INTERFACES option.
 For example, if you want the DHCPD daemon to listen on eth0, set it like so:
 INTERFACES="eth0"

14 Ch04_Network_Applications (Prep. By Werkineh E)


Configuration of DHCP on Debian Server…
Step 2: Configuring DHCP Server
 The main DHCP configuration file is located at /etc/dhcp/dhcpd.conf,
which should contain settings of what to do, where to do something and all
network parameters to provide to the clients.
 And, there are two types of statements defined in the DHCP configuration
file, these are:
 parameters – specify how to perform a task, whether to carry out a task, or
what network configuration options to send to the DHCP client.
 declarations – define the network topology, state the clients, offer addresses
for the clients, or apply a group of parameters to a group of declarations.
 Now, open and edit the configuration file to configure your DHCP server.

15 Ch04_Network_Applications (Prep. By Werkineh E)


Configuration of DHCP on Debian Server…
4. Now, open and modify the main configuration file, define your DHCP server
options:

 $ sudo nano /etc/dhcp/dhcpd.conf


 Start by defining the global parameters which are common to all supported
networks, at the top of the file. They will apply to all the declarations:
 option domain-name "example.org";
 option domain-name-servers ns1.example.org, ns2.example.org;
 default-lease-time 600;
 max-lease-time 7200;

16 Ch04_Network_Applications (Prep. By Werkineh E)


Configuration of DHCP on Debian Server…
 5. Now, define a subnetwork; here, we’ll setup DHCP for 192.168.63.0/24 LAN
network (use parameters that apply to your scenario).

subnet 192.168.63.0 netmask 255.255.255.0 {


range 192.168.63.180 192.168.63.190;
option routers 192.168.63.2;
}

17 Ch04_Network_Applications (Prep. By Werkineh E)


Configuration of DHCP on Debian Server…
 Step 3: Configure Static IP on DHCP Client Machine
6. To assign a fixed (static) IP address to a particular client computer, add the section below
where you need to explicitly specify it’s MAC addresses and the IP to be statically assigned:

host centos-node {
hardware ethernet 00:f0:m4:6y:89:0g;
fixed-address 192.168.10.105;
}

host fedora-node {
hardware ethernet 00:4g:8h:13:8h:3a;
fixed-address 192.168.10.106;
}

18 Ch04_Network_Applications (Prep. By Werkineh E)


Configuration of DHCP on Debian Server…
 Save the file and close it.
7. Next, start the DHCP service for the time being, and enable it to start automatically
from the next system boot, like so:

$ sudo systemctl start isc-dhcp-server.service


$ sudo systemctl enable isc-dhcp-server.service

8. Next, do not forget to permit DHCP service (DHCPD daemon listens on port
67/UDP) on firewall as below:

$ sudo ufw allow 67/udp


$ sudo ufw reload
$ sudo ufw show

19 Ch04_Network_Applications (Prep. By Werkineh E)


Configuration of DHCP on Debian Server…
Step 4: Configuring DHCP Client Machines
9. At this point, you can configure your clients computers on the network to
automatically receive IP addresses from the DHCP server.

 Login to the client computers and edit the Ethernet interface configuration file
to be automatic
 At this point, if all settings are correctly configured, your client machine should
be receiving IP addresses automatically from the DHCP server.

20 Ch04_Network_Applications (Prep. By Werkineh E)


Domain Name System
 If you want to…
 Call someone, you need to ask for their phone number
 You can’t just dial “P R O F G I L L ”
 Mail someone, you need to get their address first
 What about the Internet?
 If you need to reach Google, you need their IP
 Does anyone know Google’s IP?
 Problem:
 People can’t remember IP addresses
 Need human readable names that map to IPs
 Addresses are used to locate objects
 Names are easier to remember than numbers

21 Ch04_Network_Applications (Prep. By Werkineh E)


Internet Names and Addresses
 Addresses, e.g. 129.10.117.100
 Computer usable labels for machines
 Conform to structure of the network
 Names, e.g. www.northeastern.edu
 Human usable labels for machines
 Conform to organizational structure
 How do you map from one to the other?
 Domain Name System (DNS)

22 Ch04_Network_Applications (Prep. By Werkineh E)


History
 Before DNS, all mappings were in hosts.txt
 /etc/hosts on Linux
 C:\Windows\System32\drivers\etc\hosts on Windows
 Centralized, manual system
 Changes were submitted to SRI via email
 Machines periodically FTP new copies of hosts.txt
 Administrators could pick names at their discretion
 Any name was allowed
 alans_server_at_sbu_pwns_joo_lol_kthxbye

23 Ch04_Network_Applications (Prep. By Werkineh E)


Towards DNS
 Eventually, the hosts.txt system fell apart
 Not scalable, SRI couldn’t handle the load
 Hard to enforce uniqueness of names
 e.g MIT
 Massachusetts Institute of Technology?
 Melbourne Institute of Technology?

 Many machines had inaccurate copies of hosts.txt


 Thus, DNS was born

24 Ch04_Network_Applications (Prep. By Werkineh E)


DNS at a High-Level
 Domain Name System
 Distributed database
 No centralization
 Hierarchical namespace
 As opposed to original, flat namespace
 e.g. .com → google.com → mail.google.com

25 Ch04_Network_Applications (Prep. By Werkineh E)


Domains
 Domains are “namespaces”
 Everything below .com is in the com domain.
 Everything below ripe.net is in the ripe.net domain and in the net domain.


com domain
net edu com
• • •
google
ripe.net domain ripe isi sun tislabs

moon •
www disi
net domain ftp • www
ws2 ws1

26 Ch04_Network_Applications (Prep. By Werkineh E)


Zones and Delegations
 Zones are “administrative spaces”
 Zone administrators are responsible for portion of a domain’s name space
 Authority is delegated from a parent and to a child


net zone
net edu com
net domain •
google
• •

ripe.net zone ripe isi sun tislabs


moon


www disi
disi.ripe.net zone ftp
• www
27 ws2By Werkineh
Ch04_Network_Applications (Prep. ws1 E)
Iterative Resolution and Recursive Resolution
▪ Resolution Iterative resolution
▪ mapping a name to an address or an address to a name is
called name-address resolution
▪ Resolver
▪ a host that needs to map an address to a name or a name
to an address calls a DNS client named a resolver
▪ Resolvers ask the questions to the DNS system on behalf
of the application.
▪ the resolver accesses the closest DNS server with a
mapping request Recursive resolution
▪ if the server has the information it satisfies the resolver;
otherwise, it either refers the resolver to other servers
(called Iterative Resolution) or asks other servers in
place of client to provide full information (called
Recursive Resolution)

28
28 Ch04_Network_Applications (Prep. By Werkineh E)
Forward and Reverse Lookups Queries

29 Ch04_Network_Applications (Prep. By Werkineh E)


DNS Resolver/Local DNS name server
 does not strictly belong to hierarchy
 each ISP (residential ISP, company, university) has one
 also called “default name server”
 when host makes DNS query, query is sent to its local DNS server
 has local cache of recent name-to-address translation pairs (but may be out of date!)
 acts as proxy, forwards query into hierarchy

2-30 Ch04_Network_Applications (Prep. By Werkineh E)


DNS: root name servers
 There are 13 sets of RNS, named as letter(a-m).root-server.net
 Each set has a number of server around the world
 Operated by 12 organization around the world
 contacted by local name server that can not resolve name
 root name server:
 contacts authoritative name server if name mapping not known
 gets mapping
 returns mapping to local name server
 For example the F root server(http://f.root-servers.org)
consists of 46 physical machines that all behave as one (using anycast).

2-31 Ch04_Network_Applications (Prep. By Werkineh E)


TLD, authoritative servers
top-level domain (TLD) servers:
 responsible for com, org, net, edu, aero, jobs, museums, and all top-level country
domains, e.g.: uk, fr, ca, jp
 Network Solutions maintains servers for .com TLD
 Educause for .edu TLD
authoritative DNS servers:
 organization’s own DNS server(s), providing authoritative hostname to IP mappings
for organization’s named hosts
 can be maintained by organization or service provider
 Stores the website ip address

2-32 Ch04_Network_Applications (Prep. By Werkineh E)


DNS name resolution example
 Suppose you want to access and write the following URL in your Browser

http://www.somecompany.com/closing/shirt.php

protocol Host name Domain TLD Folder File


name
FQDN

IP
74.45.56.17
2-33
10001010.11110010.10101111.11011011
root DNS server

DNS name resolution example


1. OS checks weather www.somedomain.com is cached
<<IP:.com tld>>
recently in cache memory 3 4
2. If not it will Forwards the query to DNS Resolver (nearest <<A www.somebody.com>>
DNS which can be ISP DNS) How the Host knows it? 5

www.somecompany.com
Com TLD
3. DNS resolver checks it’s cheche and if there is no record, DNS serve
it will forward the request to the most large domain (the DNS Resolver
Root domain the dot(.)) <<IP address for
www.somedomain.com>> (how it knows the root?)
2
4. The Root name server doesn’t know www.somedomain
but it knows were .com is so it gives IP for .com TLD to
the DNS resolver <<TLD(.com) Name Server IP authoritative DNS server

A:
somedomain.com
address>> requesting host
5. The DNS resolver requests .com TLD IP of 1
<<www.somedomain.com>> Cashe Memory
www.somedomain.com
2-34 Ch04_Network_Applications (Prep. By Werkineh E)
root DNS server

DNS name resolution example


6. TLD server replies ip address of authoritative name server
<<IP:.com tld>>
<<somedomain.com>> 3 4
7. The DNS resolver requests ip of ww.somedomain.com to <<A www.somebody.com>>
somedomain authoritative name server <<IP: 5 Com TLD

www.somecompany.com
www.somedomain.com>> 6 DNS serve
<<IP:somedomain.com
8. The authoritative name server will reply ip address to DNS DNS >>
Resolver

<<IP: x.x.x.x>>
resolver <<IP: www.somedomain.com
9. DNS resolver maintaines new information in it’s chache 2 8
7
memory and forward the ip reply to the requesting DNS client 10

10. Requesting client receives IP address stores it to its cache for authoritative DNS server

A:
later use somedomain.com
requesting host
11. DNS starts TCP connection to the server 11
1
www.somedomain.com
Cashe Memory
www.somedomain.com
2-35 Ch04_Network_Applications (Prep. By Werkineh E)
Primary and Secondary
 Primary dns server.
 This server will have a readable and writable copy of the zone database.
 secondary dns server: For reasons of fault tolerance, performance or load balancing
you may decide to set up another dns server with authority over that zone.

36 Ch04_Network_Applications (Prep. By Werkineh E)


DNS: caching, updating records
 once (any) name server learns mapping, it caches mapping
 cache entries timeout (disappear) after some time (TTL)
 TLD servers typically cached in local name servers
 thus root name servers not often visited
 cached entries may be out-of-date (best effort name-to-address translation!)
 if name host changes IP address, may not be known Internet-wide until all TTLs expire
 update/notify mechanisms proposed IETF standard
 RFC 2136

2-37 Ch04_Network_Applications (Prep. By Werkineh E)


DNS records
DNS: distributed db storing resource records (RR)
RR format: (name, value, type, ttl)

type=A type=CNAME
▪ name is hostname ▪ name is alias name for some “canonical” (the
▪ value is IPv4 address real) name
▪ www.ibm.com is really
type=NS servereast.backup2.ibm.com
▪ value is canonical name
 name is domain (e.g., foo.com)
 value is hostname of authoritative name type=MX
server for this domain ▪ value is name of mailserver associated with
name
type=AAAA SOA record
▪ name is hostname
The SOA record of a zone contains meta information
▪ value is IPV6 address
2-38
about the zone itself. There is exactly one SOA record
Ch04_Network_Applications (Prep. By Werkineh E)
each zone.
Configuring DNS service: BIND
 BIND or BIND 9 is an open source implementation of DNS, available for
almost all Linux distributions.
 BIND stands Berkeley Internet Name Domain & it allows us to publish
DNS information on internet as well as allows us to resolve DNS queries
for the users.
 BIND is by far the most used DNS software on Internet.

40 Ch04_Network_Applications (Prep. By Werkineh E)


Working Env’t
 Step 1: Installation of Bind 9 on Debian Bind Server IP (Debian)=192.168.171.1
 $ sudo apt-get install bind9 bind9utils bind9-doc dnsutils Domain Name = hu.local
Private Network = 192.168.171.0/24
 By default it is active and running after installation But if it is not
 Systemctl start bind9
 to start it when system booted
 Systemctl enable bind9
 The BIND daemon is called named. (A daemon is a piece of software that runs in the
background.)
 The main BIND configuration file /etc/bind/named.conf sources the settings from 3
other files.
 /etc/bind/named.conf.options
 /etc/bind/named.conf.local
 /etc/bind/named.conf.default-zones

41 Ch04_Network_Applications (Prep. By Werkineh E)


 Step 2: Configuration of bind 9
 All configuration files for BIND are located in folder ‘/etc/bind’.
 From /etc/bind/named.conf.options “ file we can set the followings parameters:
 Allow Query to your dns from your private network (As the name suggests only the
systems from your private network can query dns sever for name to ip translation
and vice-versa)
 Allow recursive query
 Specify the DNS port ( 53)
 Forwarders (DNS query will be forwarded to the forwarders when your local DNS
server is unable to resolve query)

42 Ch04_Network_Applications (Prep. By Werkineh E)


 sudo vi /etc/bind/named.conf.options
options {
directory "/var/cache/bind";
auth-nxdomain no; # conform to RFC1035
listen-on port 53 { localhost; 192.168.171.129/24; };#ns ip
allow-query { localhost; 192.168.171.0/24; };
forwarders {
8.8.8.8;
8.8.4.4;
};
recursion yes;
};

43 Ch04_Network_Applications (Prep. By Werkineh E)


 in “/etc/bind/named.conf.local“, file we will define the zone files for our domain, edit
the file add the following entries:
$cd /etc/bind
$sudo nano named.conf.local
zone “hu.local" {
type master;
file "/etc/bind/forward.hu.local"; // forward look up zone file path
};

zone “81.168.192.in-addr.arpa" {//sh’d match network in reverse order


type master;
file "/etc/bind/reverse.hu.local"; //reverse lookup zone file path
};

44 Ch04_Network_Applications (Prep. By Werkineh E)


 Save the file & exit. Here we have mentioned locations for our forward lookup
zone file & reverse lookup zone files. Next we will create the mentioned
forward & reverse zone files.
 The forward zone file is where we define DNS records for forward DNS
lookups. That is, when the DNS receives a name query, “hu.local” for example,
it will look in the forward zone file to resolve host’s corresponding private IP
address.
 Firstly create the forward lookup zone file, Sample zone files (db.local) are
already there in ‘/etc/bind folder‘, we can use and copy sample zone file,

45 Ch04_Network_Applications (Prep. By Werkineh E)


 The original db.local file looks like this

46 Ch04_Network_Applications (Prep. By Werkineh E)


47 Ch04_Network_Applications (Prep. By Werkineh E)
 Next we can check name resolution
 root@my-deb-pc:/etc/bind# systemctl restart bind9
 root@my-deb-pc:/etc/bind# host www.hu.local
 www.hu.local has address 192.168.171.130
 root@my-deb-pc:/etc/bind#

48 Ch04_Network_Applications (Prep. By Werkineh E)


 Next we will create a reverse lookup zone file at the same location,sample
reverse lookup zone file is present at ‘/etc/bind‘ folder.

49 Ch04_Network_Applications (Prep. By Werkineh E)


 Save file & exit. Now all we have to do is to restart the BIND service to
implement the changes made,
 $ sudo systemctl restart bind9
 $ sudo systemctl enable bind9
 In case OS firewall is running on your bind server then execute the below
command to allow 53 port
 Validating Syntax of bind9 configuration and Zone files
 $sudo ufw allow 53
 Step 3:Validating Syntax of bind9 configuration and Zone files
 If you want to cross verify the syntax of your bind 9 configuration file
(named.conf.local). Use the command “named-checkconf“,
 linuxtechi@bind-server:~$ sudo named-checkconf /etc/bind/named.conf.local

50 Ch04_Network_Applications (Prep. By Werkineh E)


 To cross verify the syntax your forward and reverse lookup zone files , use the
command “named-checkzone“, example is shown below:
linuxtechi@bind-server:~$ sudo named-checkzone linuxtechi.local
/etc/bind/forward.linuxtechi.local
zone linuxtechi.local/IN: loaded serial 6
OK
linuxtechi@bind-server:~$
linuxtechi@bind-server:~$ sudo named-checkzone linuxtechi.local
/etc/bind/reverse.linuxtechi.local
zone linuxtechi.local/IN: loaded serial 21
OK
linuxtechi@bind-server:~$

51 Ch04_Network_Applications (Prep. By Werkineh E)


 Step 4: Testing the DNS server with dig & nslookup
 To test out our BIND 9 DNS server, we will use another Ubuntu machine & will change its
DNS to point out our DNS server. To change the DNS server, open ‘/etc/resol.conf‘ & make
the following DNS entry,

linuxtechi@nixworld:~$ sudo vi /etc/resolv.conf


search linuxtechi.local
nameserver 192.168.0.40
 save the file & exit. We now have our client ready with DNS pointing to our server. We will
now use a CLI tool called ‘dig‘ command , which is used to get find out DNS & its related
information. Execute the following command from terminal,
linuxtechi@nixworld:~$ dig www.hu.local
 While running dig command, if you get ‘command not found’ error than we need to install
‘dnsutils’ package as dig command is part of ‘dnsutils’ package,
linuxtechi@nixworld:~$ sudo apt-get install dnsutils -y

52 Ch04_Network_Applications (Prep. By Werkineh E)


 Also we can run ‘nslookup‘ command against our DNS server to confirm the
output of dig command,
linuxtechi@nixworld:~$nslookup www.hu.local

53 Ch04_Network_Applications (Prep. By Werkineh E)


Configuration Assignment
1) Configuring Mail Transfer Agents (PostFix)
2) Configuring a Proxy Caches (Squid)
3) Configuring a DHCP server
4) Configuring FTP, File and Print Server(Samba, cups)
5) Configuring SSH,Telnet,

54 Ch04_Network_Applications (Prep. By Werkineh E)


Introduction to squid/proxy servers
 Proxy server is an intermediary server
between client and the internet.
 Proxy servers offers the following basic
functionalities:
 To control internet usage of employees and
children
 Bandwidth savings and improved speeds:
 Privacy benefits
 Improved security
 Data caching
 Etc…

55 Ch04_Network_Applications (Prep. By Werkineh E)


Squid configuration
 Squid is the most popular Proxy server for Unix like operating systems
 Step 1 – Install Squid on Debian
 Login to your Debian 9 system using root or sudo privileges user. Then run
the following commands on the console to install Squid on Debian 9 system
from the default package repository.

sudo apt update


sudo apt install squid

56 Ch04_Network_Applications (Prep. By Werkineh E)


Squid configuration…
 Step 2 – Configure Squid Port
 Squid default runs on port 3128. It is your choice to keep running squid on
default port or change it to some different port. To change port edit squid
configuration file and change http_port value.

/etc/squid/squid.conf
http_port 3128
 After making changing let’s restart Squid service to reload the configuration
changes

sudo service squid restart

57 Ch04_Network_Applications (Prep. By Werkineh E)


Squid configuration…
 Step 3 – Allow All Traffic
 Sometimes you are required to allow all traffic on your proxy server. In Squid
server open Squid configuration file. Comment the http_access deny all line
and add the http_access allow all entry this file.

#http_access allow all


#http_access deny all

58 Ch04_Network_Applications (Prep. By Werkineh E)


Squid configuration…
 Step 4 – Block Specific Website with Squid
 Let’s start with the additional configuration like blocking any website using
squid proxy server. Add below rules to block specific website before any allow
all rules. Below example will block yahoo.com and www.rediff.com.

acl blocksite1 dstdomain yahoo.com


acl blocksite2 dstdomain www.rediff.com
http_access deny blocksite1
http_access deny blocksite2

59 Ch04_Network_Applications (Prep. By Werkineh E)


Squid configuration…
 If you have a long list of domain names, Create a file
/etc/squid/blockwebsites.lst and put domain names one per line and
add below rule in the squid configuration file.

acl blocksitelist dstdomain "/etc/squid/blockwebsites.lst"


http_access deny blocksitelist

 blockwebsites.lst file content example:

cat /etc/squid/blockwebsites.lst
yahoo.com
www.rediff.com

60 Ch04_Network_Applications (Prep. By Werkineh E)


Squid configuration…
 Step 5 – Block Specific Keyword with Squid
 Add below rules to block specific website before any allow all rules. Below
example will block all pages having keyword yahoo or Gmail.

acl blockkeyword1 url_regex yahoo


acl blockkeyword2 url_regex gmail
http_access deny blockkeyword1
http_access deny blockkeyword2

61 Ch04_Network_Applications (Prep. By Werkineh E)


Squid configuration…
 If you have a long list of keywords, Create a file
/etc/squid/blockkeywords.lst and put keywords one per line and add
below rule in the squid configuration file.

acl blockkeywordlist url_regex "/etc/squid/blockkeywords.lst"


http_access deny blockkeywordlist
 blockkeywords.lst file content example:

cat /etc/squid/blockkeywords.lst
yahoo
gmail
facebook
 Congratulation’s you have successfully install and configured Squid proxy server. Read
next article to Configure Squid for Mac Address Based Filtering.

62 Ch04_Network_Applications (Prep. By Werkineh E)


What is Samba??
 Samba is an Open Source Suite, that provides seamless file and print services
to SMB/CIFS clients.
 Samba is freely available.
 With Samba, you can share a Linux files ystem with Windows and vice versa.
 You can also share printers connected to either Linux or a system with
Windows.
 Samba enables a Linux or Unix server to function as a file server for client
PCs running Windows software.

63 Ch04_Network_Applications (Prep. By Werkineh E)


What is Samba??
 What is SMB?
 SMB stands
. for – Server Message Block.
• It is a protocol by which a lot of PC-related machines share files and
printers and other information such as lists of available files and printers.
• Operating systems that support this natively include Windows, OS/2, and
Linux.
 What is CIFS?
• CIFS – Common Internet File System is a protocol that is basically an
updated SMB

64 Ch04_Network_Applications (Prep. By Werkineh E)


How to setup Samba Server
 Let’s take a look at setting up a Samba Server on Linux to share files with
Windows clients.
 We can create two forms of Samba server,
 one setup won’t require a password to share files with any client on the network
which is the anonymous share
 and another setup will require setting up users and permissions.

1. Installation Of Samba
sudo apt-get update
sudo apt-get install samba

65 Ch04_Network_Applications (Prep. By Werkineh E)


How to setup Samba Server…
2. Configure File Server – Anonymous Share
a. Create a shared folder called “shared folder”.
sudo mkdir -p /srv/samba/sharedfolder
b. Allow anyone to access and store files in folder.
sudo chown nobody:nogroup /srv/samba/sharedfolder/
c. Edit configuration file to enable sharing.
 Make a backup of the configuration file before editing
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.old
 Open the conf file and make the following changes –
sudo <a href="http://www.linuxandubuntu.com/home/how-to-use-vi-
editor">vi</a> /etc/samba/smb.conf
 Add the following at the end of the file to enable sharing –
d. Restart smbd service –
sudo systemctl restart smbd.service nmbd.service

66 Ch04_Network_Applications (Prep. By Werkineh E)


How to setup Samba Server…
3. Configure File Server – Secured Share
a. Create shared folder called “securedfolder”.
sudo mkdir -p /srv/samba/securedfolder
b. Create a new user group named “selected”.
sudo addgroup selected
c. Modify permission and ownership for the folder.
sudo chown root:selected /srv/samba/securedfolder/
sudo chmod 770 /srv/samba/securedfolder/

67 Ch04_Network_Applications (Prep. By Werkineh E)


How to setup Samba Server…
d. Edit configuration file to allow sharing
 Make a backup of the configuration file before editing.
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.old
 Open the conf file and make the following changes –
sudo vi /etc/samba/smb.conf
 Add the following at the end of the file to enable sharing –
[sharedfolder]
comment = secured shared folder
path = /srv/samba/securedfolder
Valid users = @selected
guest ok = no
writable = yes
browsable = yes

68 Ch04_Network_Applications (Prep. By Werkineh E)


How to setup Samba Server…
e. Restart smbd service –
sudo systemctl restart smbd.service nmbd.service
f. Once Samba has restarted, use this command to check your smb.conf for any
syntax errors. testparm g. Add new users
 We are going to create and add a user “Jack” to the user group “selected”
with restricted shell access. sudo useradd jack -s /usr/sbin/nologin -G selected
To add a password for the user –
sudo smbpasswd -a jack
h. Add existing user Jane to the group to the group “selected”.
sudo usermod jane -G selected

69 Ch04_Network_Applications (Prep. By Werkineh E)


FTP: the file transfer protocol
file transfer
FTP FTP FTP
user client server
interface
user
at host remote file
local file system
system

❖ transfer file to/from remote host


❖ client/server model
▪ client: side that initiates transfer (either to/from remote)
▪ server: remote host
❖ ftp: RFC 959
❖ ftp server: port 21

2-70 Ch04_Network_Applications (Prep. By Werkineh E)


FTP: separate control, data connections
 FTP client contacts FTP server at port TCP control connection,
21, using TCP server port 21

 client authorized over control


TCP data connection,
connection FTP server port 20 FTP
client server
 client browses remote directory, sends
commands over control connection ❖ server opens another TCP data
 when server receives file transfer connection to transfer another file
command, server opens 2nd TCP data ❖ control connection: “out of band”
connection (for file) to client ❖ FTP server maintains “state”: current
directory, earlier authentication
 after transferring one file, server closes
data connection

2-71 Ch04_Network_Applications (Prep. By Werkineh E)


72 Ch04_Network_Applications (Prep. By Werkineh E)


FTP commands, responses
sample commands: sample return codes
 sent as ASCII text over control channel  status code and phrase (as in HTTP)
 USER username  331 Username OK, password
 PASS password required
 LIST return list of file in current  125 data connection already
directory open; transfer starting
 RETR filename retrieves (gets) file  425 Can’t open data
connection
 STOR filename stores (puts) file
onto remote host  452 Error writing file

2-73 Ch04_Network_Applications (Prep. By Werkineh E)


outgoing

Electronic mail message queue


user mailbox
user
Three major components: agent
 user agents mail user
 mail servers server agent

 simple mail transfer protocol: SMTP SMTP mail user


server agent

User Agent SMTP


SMTP user
 a.k.a. “mail reader” agent
mail
 composing, editing, reading mail messages server
user
 e.g., Outlook, Thunderbird, iPhone mail client agent

 outgoing, incoming messages stored on server user


agent

2-74 Ch04_Network_Applications (Prep. By Werkineh E)


Electronic mail: mail servers
mail servers: user
 mailbox contains incoming messages for user agent

 message queue of outgoing (to be sent) mail mail user


server
messages agent

 SMTP protocol between mail servers to send SMTP mail user


server agent
email messages
SMTP
 client: sending mail server
SMTP user
 “server”: receiving mail server agent
mail
server
user
agent
user
agent

2-75 Ch04_Network_Applications (Prep. By Werkineh E)


Electronic Mail: SMTP [RFC 2821]
 uses TCP to reliably transfer email message from client to server, port 25
 direct transfer: sending server to receiving server
 three phases of transfer
 handshaking (greeting)
 transfer of messages
 closure
 command/response interaction (like HTTP, FTP)
 commands:ASCII text
 response: status code and phrase
 messages must be in 7-bit ASCI

2-76 Ch04_Network_Applications (Prep. By Werkineh E)


Scenario: Alice sends message to Bob
1) Alice uses UA to compose message “to” 4) SMTP client sends Alice’s message over the
[email protected] TCP connection
2) Alice’s UA sends message to her mail 5) Bob’s mail server places the message in
server; message placed in message queue Bob’s mailbox
3) client side of SMTP opens TCP 6) Bob invokes his user agent to read message
connection with Bob’s mail server

1 user mail user


mail agent
agent server server
2 3 6
4
5
Alice’s mail server Bob’s mail server
2-77 Ch04_Network_Applications (Prep. By Werkineh E)
Mail message format
SMTP: protocol for exchanging
email msgs header
blank
RFC 822: standard for text line
message format:
 header lines, e.g.,
 To: body
 From:
 Subject:
different from SMTP MAIL
FROM, RCPT TO:
commands!
 Body: the “message”
 ASCII characters only

2-78 Ch04_Network_Applications (Prep. By Werkineh E)


Mail access protocols
Mail Access Protocols protocols Remarks
Simple mail Transfer protocol SMTP Used to only send Email over a network

Post Office Protocol 3 POP3 the whole mailbox will be cleared (transferred) from server to local
computer; view mail only once

Multipurpose Internet Mail MIME allows non-ASCII data to be sent using the existing mail programs and
protocols
Extensions
it transforms non-ASCII data at the sender site to ASCII and back to non-
ASCII at the receiving site

Internet Mail Access Protocol IMAP IMAP is similar to POP3 but with the following additional features
a user can: check the email header prior to downloading, search the
contents of the email for a specific string, partially download, email;

allows you to download emails from your email server onto multiple devices.
It keeps your messages on the email server.

Webmail some websites provide email service to anyone


examples are Yahoo and Hotmail

2-79 Ch04_Network_Applications (Prep. By Werkineh E)

You might also like