google.com) into machine-readable IP addresses (e.g., 172.217.160.142).Hosts on The Internet maintains two principal namespaces, the domain name hierarchy and the Internet Protocol (IP) address spaces., which is used for routing and network interface identification. An often-used analogy to explain the Domain Name System is that it serves as the phone book for the Internet by translating human-friendly computer hostnames into IP addresses. For example, the domain name www.example.com translates to the addresses 93.184.216.34 (IPv4) and 2606:2800:220:1:248:1893:25c8:1946 (IPv6). The translation between addresses and domain names is performed by the Domain Name System (DNS), a hierarchical, decentralized, distributed naming system that allows for the subdelegation of namespaces to Internet resources by designating authoritative name servers for each domain, Most prominently, it translates more readily memorized domain names to the numerical IP addresses needed for locating and identifying computer services and devices with the underlying network protocols.
.com, .org, .net, .edu, .gov, and country codes like .uk, .de. They know the addresses of authoritative name servers for second-level domains.google in google.com). These are registered by individuals or organizations.www, mail, ftp in www.example.com).(Image Placeholder - DNS Hierarchy)
The domain name space consists of a tree data structure. Each node or leaf in the tree has a label and zero or more resource records (RR), which hold information associated with the domain name. The domain name itself consists of the label, concatenated with the name of its parent node on the right, separated by a dot. The tree sub-divides into zones beginning at the root name server zone. A DNS zone may consist of only one domain, or may consist of many domains and sub-domains, depending on the administrative choices of the zone manager. A domain name consists of one or more parts, technically called labels, that are conventionally concatenated, and delimited by dots, such as example.com. The right-most label conveys Top-Level Domain (TLD) servers; for example, the domain name www.example.com belongs to the top-level domain COM <parent node>. The hierarchy of domains descends from right to left; each label to the left specifies a subdivision, or subdomain of the domain to the right. As with root name servers, TLD servers keep track of the next level down: Authoritative name servers. When a TLD server receives your request for information, the server passes it down to an appropriate Authoritative name server. Authoritative name servers are used to store DNS records for domains directly. In other words, every domain in the world will have its DNS records stored on an Authoritative name server somewhere or another; they are the source of the information. When your request reaches the authoritative name server for the domain you're querying, it will send the relevant information back to you, allowing your computer to connect to the IP address behind the domain you requested.
(Image Placeholder - DNS Query Process)
DNS Resolvers➡️The client side of the DNS is called a DNS resolver. A resolver is responsible for initiating and sequencing the queries that ultimately lead to a full resolution (translation) of the resource sought. DNS resolvers are classified by a variety of query methods, such as recursive, non-recursive, and iterative. A resolution process may use a combination of these methods. DNS protocol transport primarily uses the UDP port 53 to serve requests. TCP is also used for tasks such as zone transfers. Some resolver implementations use TCP for all queries. Record Caching➡️A standard practice in implementing name resolution in applications is to reduce the load on the Domain Name System servers by caching results locally, or in intermediate resolver hosts. Results obtained from a DNS request are always associated with the time to live (TTL), an expiration time after which the results must be discarded or refreshed. Reverse Lookup➡️A reverse DNS lookup is a query of the DNS for domain names when the IP address is known. Multiple domain names may be associated with an IP address. The DNS stores IP addresses in the form of domain names as specially formatted names in pointer (PTR) records within the infrastructure top-level domain arpa. For IPv4, the domain is in-addr.arpa. For IPv6, the reverse lookup domain is ip6.arpa. The IP address is represented as a name in reverse-ordered octet representation for IPv4, and reverse-ordered nibble representation for IPv6. DNS message format➡️The DNS protocol uses two types of DNS messages, Queries and Replies; both have the same format. Each message consists of a Header + 4 sections: Question, Answer, Authority, & an additional space. A header field controls the content of these 4 sections. The Header section consists of the following field: Identification, Flags, Number of questions, Number of answers, Number of authority resource records (RRs), and Number of additional RRs. Each field is 16 bits long, and appears in the order given. The identification field is used to match responses with queries. DNS over HTTPS (DoH) is a protocol for performing remote Domain Name System (DNS) resolution via the HTTPS protocol. A goal of the method is to increase user privacy and security by preventing eavesdropping and manipulation of DNS data by man-in-the-middle attacks[1] by using the HTTPS protocol to encrypt the data between the DoH client and the DoH-based DNS resolver. DNS over TLS (DoT) is a network security protocol for encrypting and wrapping Domain Name System (DNS) queries and answers via the Transport Layer Security (TLS) protocol. The goal of the method is to increase user privacy and security by preventing eavesdropping and manipulation of DNS data via man-in-the-middle attacks. While DNS-over-TLS is applicable to any DNS transaction, it was first standardized for use between stub or forwarding resolvers and recursive resolvers, in RFC 7858
A Host-Name is assigned to a computer by an administrator, usually at the time of OS installation. The host name needs to be unique on the local network.
A Fully Qualified Domain Name (FQDN) is used to provide a unique identity for a host belonging to a particular Internetwork, to avoid the possibility of duplicate host names on the Internet.
FQDN Structure:
MY.HOST.Domain.TLD (e.g., www.example.com)
MY.HOST: Host Name (unique within its domain)Domain: Second-Level Domain Name (unique within a TLD)TLD: Top-Level Domain (e.g., .com, .org, .net, .gov)Numerous hosts may exist within the same Domain and TLD. The "root" (represented by a dot .) is at the end of the FQDN but is usually omitted in most cases.
A Domain Name is unique within a TLD. Once registered, it cannot be used by another organization. However, the same Domain Name may be registered within different TLDs (e.g., example.com and example.org).
FQDN Rules: FQDNs must follow certain rules:
The Domain Name System (DNS) is a global hierarchy of distributed name server databases that contain information on domains and hosts within those domains.
At the top of the DNS Hierarchy is the Root, which is represented by the null label (just a period .). There are 13 root name servers (A-M).
Below the root are the Top-Level Domains (TLDs). These include:
.com, .org, .net, .biz, .gov. ICANN (Internet Corporation for Assigned Names and Numbers) manages these generic TLDs..uk, .ca, .au. These are generally managed by an organization appointed by the relevant government.The Root DNS Servers have complete information about the TLD Servers. In turn, the TLD Servers have information relating to servers for the second-level domains. No single name server has complete information about all domains. Records within the DNS tell them where an Authoritative Name Server for missing information can be found.
An FQDN reflects this hierarchy, from most specific on the left (the host's resource record with its Name:IP address mapping) to the least specific on the right (the TLD and root).
The process of translating an FQDN into an IP address is known as Name Resolution.
.com, .org, etc.).example.com).Recursive lookup means that if the required server is not authoritative, it takes on the task of querying other name servers until it finds the requested record or times out.
Most Internet-accessible DNS Servers disable recursive queries for external clients. Recursive Resolvers are typically only accessible by authorized clients (e.g., subscribers within an ISP's network or clients on a private LAN).
DNS Resolution Process - Recursive and Iterative Queries:
Figure: DNS resolution showing the complete query process. Client makes recursive query to local DNS server, which performs iterative queries to Root → TLD → Authoritative servers. Each server either provides the answer or refers to the next level in the hierarchy. Final answer is cached at multiple levels with TTL.
A DNS Zone contains numerous resource records. These records allow a DNS name server to resolve queries for names and services hosted in the domain into IP addresses. The most common types of records stored in the DNS database are for Start of Authority (SOA), IP addresses (A and AAAA), SMTP mail exchangers (MX), name servers (NS), pointers for reverse DNS lookups (PTR), and domain name aliases (CNAME)
DNS Servers have Forward Lookup Zones and Reverse Lookup Zones.
in-addr.arpa. For IPv6, each character is expressed in reverse order up to the network prefix as a subdomain and appended with ip6.arpa.
198.51.100.1 becomes 1.100.51.198.in-addr.arpa2001:0db8::abcd:ef12:1234 becomes 4.3.2.1.2.1.f.e.d.c.b.a.d.c.b.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.0.2.ip6.arpaDNS Name Servers maintain DNS namespace in Zones. A single Zone namespace might host records for multiple Domains. A single name server might be configured to manage multiple Zones.
A name server that holds complete records for a domain can be defined as Authoritative. This means that a record in the zone identifies the server as a name server for that namespace. Both Primary & Secondary name servers are authoritative.
Servers that don't maintain a zone are referred to as Cache-Only Servers during the name resolution process. A non-authoritative answer from a server is one that derives from a cached record rather than directly from the zone records.
Each Resource Record can be configured with a default TTL (Time to Live) value, measured in seconds. This value instructs resolvers how long a query result can be kept in cache.
The use of caching and the distributed nature of DNS means that configuration errors can occur in several different places. To investigate name resolution issues:
ipconfig /allhostname -I or ip anslookup (Windows): Troubleshoots DNS name resolution.
nslookup without arguments starts it in interactive mode.nslookup [options] [Host] [DNS Server]options: Specifies lookup subcommand (e.g., -type=ns to query name servers, -type=MX for mail records).Host: Can be a Host Name, Domain Name/FQDN, or an IP address.DNS Server: The IP address of a specific server to use for the query (e.g., 8.8.8.8 for Google DNS).Resolve-DnsName (PowerShell - Windows): Provides a more sophisticated, scripted approach using cmdlets. It allows for more flexible testing of name resolution (e.g., checking HOSTS file, DNS Cache, specific DNS servers).dig (Domain Information Groper - Linux/Unix/macOS): A powerful command-line tool for querying DNS servers.
dig host will search for the A record for the Host, Domain, or FQDN; dig -x [IP Address] will perform a PTR (reverse) lookup.DNS caching is performed by both DNS servers and client computers. Each application on a client computer might also be configured to manage its own DNS cache rather than relying on a shared Operating System cache.
Changes to Resource Records (and subsequent updates) can be relatively slow to propagate around the Internet due to caching.
Planning for a Record Change:
A company will use primary & secondary NS to maintain authoritative zone records for the domains it manages.
subdomain.bigsupport.com would be served from internal name servers, allowing a client PC (pc1.bigsupport.com) to contact a local application server (crm.bigsupport.com). The name servers hosting these internal subdomain records must not be accessible from the Internet for security.bigsupport.com, in order for Internet hosts to use a web server at www.bigsupport.com or send email to an @bigsupport.com address, the zone records for bigsupport.com must be hosted on a name server that is accessible over the Internet.It is generally a good idea to separate the DNS servers used to host zone records (authoritative servers) from the ones used to service client requests for non-authoritative domains (recursive resolvers/forwarders).
Devices will save the DNS Server’s responses to a local DNS cache, this means they don’t have to query the server every single time they want to access a particular destination, this may lead to DNS cache poisoning. For hosts in a network to use dns, you don’t need to configure DNS on the routers , the routers simply forward the DNS messages like any other packets. Cisco router can be configured as a DNS server , although rare. A Cisco Router can also be configured as a DNS client Most devices have a Hosts file which existed before dns to save the Hostname of IP addresses local to a device, which is C:\windows\system32\drivers\etc\hosts or /etc/hosts Normal DNS requests and responses are sent by UDP port 53, DNS can use TCP or generates TCP sessions for only Zone Transfers and query responses that exceed 512bytes—Recursive DNS Search [which allow DNS servers to provide authoritative name resolution to hosts].
A Recursive DNS server is that, when asked for information it does not have, performs a repetitive (recursive) process to ask other DNS servers in sequence, sending repeated DNS messages in an effort to identify the authoritative DNS server or DNS server that knows the information.
Router> enable Router# configure terminal Router(config)# ip dns server -> Configure a Router to act as a DNS server Router(config)# ip host hostname host-IP -> Add an entry to the ip hostname table, Building the router’s own host table with a list of hostname/IP address mappings. Router(config)# ip name-server 8.8.8.8 -> Specify address of name server to use, this Configures an external DNS Server that router will query, if the requested record is not in its own host table. Router(config)# ip domain lookup -> Enable Router to perform DNS queries. Becoming a DNS client. Router(config)# ip domain name FQDN -> Configure the default domain name locally, once done all connected devices to the router, will have a FQDN of hostname.FQDN Router(config)# do show hosts -> To view the routers DNS cache and host table.
DHCP DORA Process Sequence:
Figure: DHCP DORA process showing the four-phase IP address acquisition: (D)iscover → (O)ffer → (R)equest → (A)cknowledge. Client starts with no IP (0.0.0.0), broadcasts to find servers, receives offers, selects one, and gets configuration confirmed. Includes lease management with T1 (renewal) and T2 (rebind) timers.
A DHCP Server must be allocated a static IP Address and configured with a range of IP Addresses and Subnet Masks, plus option values, to allocate as a Scope. To define a scope, you must provide a start & end IP Address along with a Subnet mask.
The server maintains a one-to-one mapping of scopes to subnets (i.e., no scope can cover more than one subnet & no subnet can contain more than one scope). The DHCP Server must be placed in the same Subnet as its clients.
More advanced DHCP servers might be configured to manage & support multiple scopes. Where a server provides IP Config for multiple subnets/scopes, it must choose the pool to service each request based on the subnet from which the request originated.
For fault tolerance and redundancy, Split Scopes can be configured with non-overlapping address ranges. DHCP for multiple subnets is usually handled by configuring Relay Agents to forward requests to a central DHCP server.
An IP Address is leased by the server for a limited period only. A client can attempt to renew or rebind the lease before it expires. If the lease cannot be renewed, the client must release the IP address and start the DHCP DORA process again.
A long lease time means the client doesn't have to renew the lease often. Where the DHCP server's Address pool is not replenished frequently or IP addresses are in short supply, a shorter lease period enables the DHCP Server to allocate addresses previously assigned to hosts that have become inactive on the Network.
If both T1 & T2 timers elapse, the client releases the IP address and broadcasts to discover a new server.
To force a release of a lease, a Windows Client can use IPCONFIG /RELEASE and IPCONFIG /RENEW. Linux clients can use dhclient, Network Manager, or Systemd-Networks.
Failure to renew a lease: A Windows host reverts to Automatic Private IP Addressing (APIPA) (addresses in the range 169.254.0.0/16). Linux might use link-local config, set the Address to unknown, or leave the interface unconfigured.
Each additional Option supplied by a DHCP Server is identified by a byte or decimal Value. Such Options include:
A set of default/global options can be configured on a server-wise basis. Default Options can be overridden by setting scope-specific Options.
One disadvantage of the standard Dynamic Assignment method is that it doesn't guarantee that any given client will retain the same IP Address over time.
The DHCP Relay Agent (configured on RFC 1542 Compliant Routers) intercepts DHCP broadcast frames, then applies a Unicast Address for the appropriate DHCP server(s) and forwards them over the interface for the subnet containing the server. The DHCP Server can identify the original IP Subnet from the packet and offer a lease from the appropriate scope (subnet range). The DHCP relay also performs the reverse process of directing responses from the server to the appropriate client Subnet.
IP Helper functionality can be configured on Routers to allow certain types of broadcast traffic (including DHCP) to be forwarded to an interface. The IP helper function supports the function of the DHCP relay agent. UDP forwarding is a more general application of the same principle.
IPv6's Stateless Address Auto-Configuration (SLAAC) process can locate routers and generate a host address with a suitable network prefix automatically. Therefore, the role of a DHCP Server in IPv6 is different. DHCPv6 is often just used to provide additional option settings, rather than leases for host addresses.
As IPv6 does not support broadcasts, clients use the multicast Address for routers (ff02::1:2) to discover a DHCPv6 server, using Neighbor Discovery Protocol (NDP).
ff02::1:2.Note: There is no mechanism in DHCPv6 for setting the Default Route; the host learns the default gateway from the Router Advertisement (NDP).
Renew lease after T1; if not, check back at timer T2. The countdown is reset if the lease is renewed.
EVERY HOST INTERFACE NEEDS AN IP CONFIG TO COMMUNICATE ON A TCP/IP NETWORK.
DHCP (BootP-Server UDP 67 / BootP-Client UDP 68) is used to allow hosts to automatically/dynamically learn various aspects of their network configuration, such as IP ADDRESS, SUBNET MASK, DEFAULT GATEWAY, DNS SERVER without manual/static configuration. DHCP allows both the permanent assignment of host addresses, but more commonly, DHCP assigns a temporary lease of IP addresses. With these leases, the DHCP server can reclaim IP addresses when a device is removed from the network, making better use of the available addresses. DHCP also enables mobility.
DHCP server ‘lease’ IP address to clients. These leases are usually not permanent, and the client must give up the address at the end of the lease.
ipconfig /release.ipconfig /renew.DHCP operations fall into four phases: client-server discovery, IP lease offer, IP lease request, & IP lease acknowledgement. These stages are often abbreviated as DORA for:
DHCP clients, however, have a somewhat unique problem: they do not have an IP address yet, but they need to send these DHCP messages inside IP packets. To make that work, DHCP messages make use of two special IPv4 addresses that allow a host that has no IP address to still be able to send and receive messages on the local subnet:
Some Network Engineers might choose to configure each router in a network topology as the DHCP sever for its connected LANs to keep the protocol flow local. However, for large enterprises it’s recommended to use a centralized DHCP server. A centralized DHCP server approach has advantages as well. In fact, some Cisco design documents suggest a centralized design as a best practice, in part because it allows for centralized control and configuration of all the IPv4 addresses assigned throughout the enterprise.
If the server is centralized, it won’t receive the DHCP clients’ broadcast DHCP messages (as broadcast messages don’t leave the local subnet). To fix this, we configure a router to act as a DHCP RELAY AGENT. The router-RelayAgent will forward the clients' broadcast DHCP messages to the remote DHCP server as Unicast messages.
In some enterprise networks, that router configuration can be a single command on many of the router’s LAN interfaces (ip helper-address server-ip), which identifies the DHCP server by its IP address. This feature, by which a router relays DHCP messages by changing the IP addresses in the packet header, is called DHCP relay.
A DHCP pool is a subnet of addresses that can be given to DHCP clients, as such as other info such as default gateway and dns server. Ensure to create a separate DHCP pool for each network the router is acting as a DHCP server for.
Router(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.20
Specify a range of addresses that won’t be given to DHCP clients. The server needs to know which addresses in the subnet to not lease. This list allows the engineer to reserve addresses to be used as static IP addresses.
Router(config)# ip dhcp pool LAN_CLIENTs
Specify DHCP pool name.
Router(dhcp-config)# network 192.168.10.0/24
Specify the subnet of addresses to be assigned to clients (excluding the excluded addresses). The DHCP server can use this information to know all addresses in the subnet. (The DHCP server knows to not lease the subnet ID or subnet broadcast address.)
Router(dhcp-config)# default-router IP-ADDR
This is the IP address of the router on that subnet. Specify the default gateway that DHCP client should use. Host Default Router Setting Should Equal Router Interface Address.
Router(dhcp-config)# dns-server 8.8.8.8
Specify the DNS server that DHCP clients should use. This is a list of DNS server IP addresses.
Router(dhcp-config)# domain-name FQDN
Specify the Domain-Name of the Network.
Router(dhcp-config)# lease days hours minutes
The server leases an address for a time (usually a number of days), and then the client can ask to renew the lease. If the client does not renew, the server can reclaim the IP address and put it back in the pool of available IP addresses. The server configuration sets the maximum time for the lease.
Router(dhcp-config)# lease infinite
This configures AUTOMATIC ALLOCATION, which sets the DHCP lease time to infinite. As a result, once the server chooses an address from the pool and assigns the IP address to a client, the IP address remains with that same client indefinitely.
Router(config)# interface Gx/y
Specify the interface connected to the subnet of the client devices.
Router(config-if)# ip helper-address dhcp-server-IP
Configure an interface to forward/“RELAY” DHCP broadcasts across a network to the IP address of the DHCP server.
We first specified an interface on the router serving the subnet that requires a DHCP, and then we configured a relay agent for that interface using the IP address of a centralized DHCP server. Ensure the router has a static or dynamic route to the DHCP server. The DHCP relay feature must be configured for any router interface that connects to a subnet where:
Once such interfaces have been identified, the configuration requires the ip helper-address interface subcommand on each of those interfaces. The ip helper-address server-ip subcommand tells the router to do the following for the messages coming in an interface, from a DHCP client:
ip helper-address command).This command gets around the “do not route packets sent to 255.255.255.255” rule by changing the destination IP address. Once the destination has been set to match the DHCP server’s IP address, the network can route the packet to the server.
NOTE: THE IP HELPER-ADDRESS command configures an interface to forward broadcasts to the following UDP ports for the protocols DNS, TFTP, NetBios, TACACS.
Router(config)# interface Gx/y
Specify the interface connected to the DHCP server.
Router(config-if)# ip address dhcp
Use the command to tell the router to use DHCP to learn its own IP address. The router then adds a default route based on the default gateway (routers do not normally use a default gateway setting; only hosts use a default gateway setting. However, the router takes advantage of that information by turning that default gateway IP address into the basis for a default route) to its IP routing table. In most every case it makes more sense to statically configure router interface IP addresses with the address listed in the ip address address mask interface subcommand. However, configuring a router to lease an address using DHCP makes sense in some cases with a router connected to the Internet; in fact, most every home-based router does just that. A router with a link to the Internet can learn its IP address and mask with DHCP and also learn the neighboring ISP router’s address as the default gateway. Additionally, router can distribute that default route to the rest of the routers using an interior routing protocol like OSPF. To recognize this route as a DHCP-learned default route, look to the administrative distance value of 254. IOS uses a default administrative distance of 1 for static routes configured with the ip route configuration command but a default of 254 for default routes added because of DHCP. Like Windows, macOS adds a default route to its host routing table based on the default gateway, as well as a route to the local subnet calculated based on the IP address and mask learned with DHCP.
Router()# show ip dhcp binding
Displays all the DHCP clients that are currently assigned addresses, as well as information on Lease expiration, Device IP & MAC.
To see more details specific to DHCP, instead use the show dhcp lease command to see the (temporarily) leased IP address and other parameters.
Router()# show dhcp lease
Router()# show ip dhcp pool
Verify the configured IPv4 subnets in a DHCP pool, on a router configured as a DHCP server.
(Image Placeholder - HTTPS Process)
The HTTP (The Hyper Text Transfer Protocol) handles our web requests to servers. HTTP functions as a request–response protocol in the client–server computing model. HTTP uses a set of verbs, like GET, POST, PUT, and HEAD, to retrieve and send data. Anytime a page is loaded, there are multiple web requests to retrieve content like images, text, and formatting code. High-traffic websites often benefit from web “CACHE” servers that deliver content on behalf of upstream servers to improve response time. Web browsers “CACHE” previously accessed web resources and reuse them, when possible, to reduce network traffic. HTTP is a “STATELESS” protocol. A stateless protocol does not require the HTTP server to retain information or status about each user for the duration of multiple requests. However, some web applications implement “Statefulness” or server side sessions using for instance HTTP “COOKIES” or hidden variables within web forms.
To send email, the standard is SMTP is an internet standard connection-oriented, text-based, communication protocol for electronic mail transmission in which a mail sender communicates with a mail receiver by issuing command string & necessary data over a reliable ordered data stream channel(TCP). Mail servers and other Mail/Message Transfer agents use SMTP to send and receive mail messages, SMTP servers commonly use the TCP on port number 25 (for unencrypted plaintext) and 587 (for encrypted communications). The SMTP server performs three basic functions:
Email is submitted by a mail client (mail user agent, MUA) to a mail server (mail submission agent, MSA) using SMTP on TCP port 587 involving a SMTP Handshake. Most mailbox providers still allow submission on traditional port 25. The MSA delivers the mail to its mail transfer agent (mail transfer agent, MTA). Often, these two agents are instances of the same software launched with different options on the same machine. The main difference between an MTA and an MSA is that connecting to an MSA requires SMTP Authentication. The boundary MTA uses DNS to look up the MX (mail exchangers) DNS resource record for the recipient's domain (the part of the email address on the right of @). The MX record contains the name of the target-destination MTA. Based on the target host and other factors, the sending MTA selects a recipient server and connects to it to complete the mail exchange. An MDA (mail delivery agents) saves messages in the relevant mailbox format. As with sending, this reception can be done using one or multiple computers, Once delivered to the local mail server, the mail is stored for batch retrieval by authenticated mail clients (MUAs). Sender MUA >> MSA >> MTA 📤 >> DNS Lookup of MX records Recipient 📥 MTA >> MDA >> MUA >> Forwarded to IMAP/POP
Mail is retrieved by end-user applications, called email clients, using Internet Message Access Protocol (IMAP), a protocol that both facilitates access to mail and manages stored mail, or the Post Office Protocol (POP) which typically uses the traditional inbox mail file format. “SMTP defines message transport, not the message content. Thus, it defines the mail envelope and its parameters, such as the envelope sender, but not the header (except trace information) nor the body of the message itself. STD 10 and RFC 5321 define SMTP (the envelope), while STD 11 and RFC 5322 define the message (header and body), formally referred to as the Internet Message Format.”
IMAP is an Internet standard protocol used by email clients to retrieve email messages from a mail server over a TCP/IP connection. IMAP was designed with the goal of permitting complete management of an email box by multiple email clients, therefore clients generally leave messages on the server until the user explicitly deletes them, This and other characteristics of IMAP operation allow multiple clients to manage the same mailbox. IMAP offers access to the mail storage. Clients may store local copies of the messages, but these are considered to be a temporary cache. An IMAP server typically listens on port number 143. IMAP over SSL/TLS (IMAPS) is assigned the port number 993. Advantages over POP
POP is an application-layer Internet standard protocol used by e-mail clients to retrieve e-mail from a mail server. POP version 3 (POP3) is the version in common use. A POP3 server listens on well-known port number 110 for service requests. Encrypted communication for POP3 is either requested after protocol initiation, using the STLS command, if supported, or by POP3S, which connects to the server using Transport Layer Security (TLS) or Secure Sockets Layer (SSL) on well-known TCP port number 995.
SSH Secure Shell (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network. SSH provides a secure channel over an unsecured network by using a client–server architecture, connecting an SSH client application with an SSH server. IT professionals and engineers use this to help configure and program a system remotely and securely. The standard TCP/UDP/SCTP port for SSH is 22. The encryption used by SSH is intended to provide Confidentiality and Integrity of data over an unsecured network, such as the Internet. SSH uses public-key cryptography to Authenticate the remote computer and allow it to authenticate the user, if necessary. SSH is typically used to log into a remote machine and execute commands, but it also supports tunneling, forwarding TCP ports and X11 connections; it can transfer files using the associated SSH file transfer (SFTP) or secure copy (SCP) protocols.[2]
SSH is a secure alternative to the non-protected login protocols (such as telnet, rlogin) and insecure file transfer methods (such as FTP). Putty is for Windows Operating System. Just a regular GUI interface for SSH protocol.
In SSH, a private key is used for authenticating computers and users. A host key authenticates servers, and an Authorized keys and identity key serves as an authentication credential for a user. Together they are called SSH keys. In SSH, public key cryptography is used for authenticating computers and users. Host keys authenticate hosts. Authorized keys and identity keys authenticate users. The most common type of SSH key is an authorized key, which is a public key.
ssh-keygen - creates a key pair for public key authenticationssh-copy-id - configures a public key as authorized on a serverssh-agent - Authentication Agent to hold private key for Public key authenticationssh-add - Adds private Key identities/fingerprints to the OPENSSH Authentication Agent.SSH (Secure Shell) is a protocol primarily used for secure remote login and other secure network services over an insecure network. It uses the client-server model and supports various forms of tunneling, which can be utilized to securely forward traffic over the network.
Architecture—>The SSH-2 protocol has an internal architecture (defined in RFC 4251) with well-separated layers, namely:
The SSHFP DNS record provides the public host key fingerprints in order to aid in verifying the authenticity of the host.
SSHD_confignetstat -aep | grep ':\*' — >LINUXsudo lsof -i -P | grep -i "listen" —>MacOS[Protocol 2][PermitRootLogin no]ChallengeResponseAuthentication no && HostBasedAuthentication no && PasswordAuthentication no && Pluggable Authentication Modules [UsePAM yes]PermitEmptyPasswords noAllowTcpForwarding no && AllowStreamLocalForwarding no && GatewayPorts no && PermitTunnel noLoginGraceTime should be set to lowest amount in secsLogLevel VERBOSE —> This way, the key fingerprint for any SSH key used for login is logged. No longer needed therefore SyslogFacility AUTH && LogLevel INFOListenAddress host|IPv4_addr|IPv6_addr or ListenAddress host|IPv4_addr:port or ListenAddress [host|IPv6_addr]:portKexAlgorithms option. We recommend ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256MACs option. A good value is hmac-sha2-256,hmac-sha2-512[Ciphers aes128-ctr,aes192-ctr,aes256-ctr HostKeyAlgorithms ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,ssh-dss KexAlgorithms ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2- nistp521,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256 MACs hmac-sha2-256,hmac-sha2-512,hmac-sha1]FTP URL syntax ftp://[user[:password]@]host[:port]/url-path (the bracketed parts are optional). Users could connect to the FTP server anonymously if the server is configured to allow it, meaning that we could use it even if we had no valid credentials. If we look back at our nmap scan result, the FTP server is indeed configured to allow anonymous login: If you need a refresher, the ftp -h command will help you figure out the available commands for the FTP service on your local host.ftp-anon: Anonymous FTP login allowed (FTP code 230) from NMAP SCANLogin successful.ftp://public.ftp-servers.example.com/mydirectory/myfile.txt represents the file myfile.txt from the directory mydirectory on the server public.ftp-servers.example.com as an FTP resource. The URL ftp://user001:secretpassword@private.ftp-servers.example.com/mydirectory/myfile.txt adds a specification of the username and password that must be used to access this resource.Explicit FTPS is an extension to the FTP standard that allows clients to request FTP sessions to be encrypted. This is done by sending the "AUTH TLS" command. The server has the option of allowing or denying connections that do not request TLS.) or entirely replaced by ✅SSH/Secure File Transfer Protocol (SFTP is a network protocol that provides file access, file transfer, and file management over any reliable data stream has a similar command set for users, but uses the Secure Shell protocol (SSH) to transfer files. Unlike FTP, it encrypts both commands and data, preventing passwords and sensitive information from being transmitted openly over the network.) This protocol assumes that it is run over a secure channel, such as SSH, that the server has already authenticated the client, and that the identity of the client user is available to the protocol. It cannot interoperate with FTP software. *SFTP is not FTP run over SSH*Remote Synchronization is an open source utility that provides fast incremental file transfer, Fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. It offers a large number of options that control every aspect of its behavior and permit very flexible specification of the set of files to be copied. It is famous for its delta-transfer algorithm, which reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination. Rsync is widely used for backups and mirroring and as an improved copy command for everyday use. The main concern with FTP is that it is a very old and slow protocol. FTP is a protocol used for copying entire files over the network from a remote server. In many cases there is a need to transfer only some changes made to a few files and not to transfer every file every single time. For these scenarios, the rsync protocol is generally preferred. The changes that need to get transfered are called deltas. Using deltas to update files is an extremely efficient way to reduce the required bandwidth for the transfer as well as the required time for the transfer to complete. It follows directly from the definition of rsync that it's a great tool for creating/maintaining backups and keeping remote machines in sync with each other. Both of these functionalities are commonly implemented in corporate environment. In these environments time is of of the most importance, so rsync is preferred due to the speedup it offers for these tasks.
The main stages of an rsync transfer are the following:
rsync OPTION … USER@{TargetHOSTIP}::SRC DEST
rsync {target_IP}::public/flag.txt flag.txt
where SRC is the file or directory (or a list of multiple files and directories) to copy from, DEST is the file or directory to copy to, and square brackets indicate optional parameters.
The [OPTION] portion of the syntax, refers to the available options in rsync . The list with all valid options is available over at the official manual page of rsync under the section Options Summary .
The [USER@] optional parameter is used when we want to access the the remote machine in an authenticated way. If we don't have any valid credentials at our disposal so we will omit this portion and try an anonymous authentication.
As our first attempt we will try to simply list all the available directories to an anonymous user. Reading through the manual page we can spot the option --list-only , which according to the definition is used to "list the files instead of copying them" ->> rsync --list-only {target_IP}::
✔️Port 135: RPC
svchost.exe. This is one of the main processes in any Windows operating system & it should not be terminated.✔️Port 139: NETBIOS
✔️SMB - Server Message Block Protocol
SMB - Server Message Block Protocol - is a client-server communication protocol used for sharing access to files, printers, serial ports and other resources on a network.
Servers make file systems and other resources (printers, Serial Ports between Endpoints, named pipes, APIs) available to clients on the network. Client computers may have their own hard disks, but they also want access to the shared file systems and printers on the servers.
The SMB protocol is known as a response-request protocol, meaning that it transmits multiple messages between the client and server to establish a connection.
During scanning, we will typically see port 445 TCP open on the target, reserved for the SMB protocol.
Usually, SMB runs at the Application or Presentation layers of the OSI model, pictured below. Due to this, it relies on lower-level protocols for transport. The Transport layer protocol that Microsoft SMB Protocol is most often used with is NetBIOS over TCP/IP (NBT). Clients connect to servers using TCP/IP (actually NetBIOS over TCP/IP {NBT} as specified in RFC1001 and RFC1002). Microsoft Windows operating systems since Windows 95 have included client and server SMB protocol support.
Samba, an open source server that supports the SMB protocol, was released for Unix systems. To access an SMB share, we need a client to access resources on servers (i.e SMBClient). We will be using SMBClient because it's part of the default samba suite.
Smbclient will attempt to connect to the remote host and check if there is any authentication required. If there is, it will ask you for a password for your local username. We should take note of this. If we do not specify a specific username to smbclient when attempting to connect to the remote host, it will just use your local machine's username. That is the one you are currently logged into your Virtual Machine with. This is because SMB authentication always requires a username, so by not giving it one explicitly to try to login with, it will just have to pass your current local username to avoid throwing an error with the protocol.
In this case, we do not have such credentials, so what we will be trying to perform is any of the following:
ADMIN$ Share: This is a special share that exists on Windows machines used primarily for system administration - allowing system admins to have remote access to every disk volume on the Remote system, typically allowing access to the C:\Windows directory on the remote machine. These shares may not be permanently deleted but may be disabled.
IPC$ Share: This share is used for inter-process communication (IPC), allowing programs running on networked computers to communicate with each other via named pipes and is not part of the file system.
C$: Administrative share for the C:\ disk volume. This is where the operating system is hosted - File system of the Windows Machine the SMB server is hosted
WorkShares: Custom share
In the context of Impacket's psexec.py, here's what happens:
connectTree('IPC$') to establish a session for IPC. This connection is crucial for sending commands & managing comms btw the local & remote systems.✔️Telnet
Telnet is an application protocol which allows you, with the use of a telnet client, to connect to and execute commands on a remote machine that's hosting a telnet server.
The telnet client will establish a connection with the server. The client will then become a virtual terminal- allowing you to interact with the remote host.
The user connects to the server by using the Telnet protocol, which means entering "telnet" into a command prompt. The user then executes commands on the server by using specific Telnet commands in the Telnet prompt.
You can connect to a telnet server with the following syntax: "telnet [ip] [port]"
✔️NFS
NFS stands for "Network File System" and allows a system to share directories and files with others over a network.
By using NFS, users and programs can access files on remote systems almost as if they were local files. It does this by mounting all, or a portion of a file system on a server. The portion of the file system that is mounted can be accessed by clients with whatever privileges are assigned to each file.
First, the client will request to mount a directory from a remote host on a local directory just the same way it can mount a physical device. The mount service will then act to connect to the relevant mount daemon using RPC (Remote Procedure Call).
The server checks if the user has permission to mount whatever directory has been requested. It will then return a file handle which uniquely identifies each file and directory that is on the server.
If someone wants to access a file using NFS, an RPC call is placed to NFSD (the NFS daemon) on the server. This call takes parameters such as:
These are used in determining access rights to the specified file. This is what controls user permissions, I.E read and write of files.
Open Network Computing Remote Procedure Call (ONC RPC) / Secure RPC is fundamental to the Secure NFS system. The goal of Secure RPC is to build a system that is at minimum as secure as a time-sharing system (one in which all users share a single computer). A time-sharing system authenticates a user through a login password. With data encryption standard (DES) authentication, the same authentication process is completed. Users can log in on any remote computer just as they can on a local terminal, and their login passwords are their passports to network security.
The first of which is key to interacting with any NFS share from your local machine: nfs-common. It is important to have this package installed on any machine that uses NFS, either as client or server. It includes programs such as: lockd, statd, showmount, nfsstat, gssd, idmapd and mount.nfs.
The fundamental notion behind the end-to-end principle is that for two processes communicating with each other via some communication means, the reliability obtained from that means(protocol) cannot be expected to be perfectly aligned with the reliability requirements of the protocol processes.
*packet* appears in both informal and formal usage, whereas in more precise terminology*segment* refers to the TCP layer protocol data unit (PDU)*datagram* refers to the UDP layer protocol data unit (PDU)*datagram* to the IP protocol data unit (PDU)*frame* to the data link layer protocol data unit (PDU)“Every network host is a node, but not every network node is a host”“HOST is a NODE” that participates in user applications, either as a server, client, or both. A server is a type of host that offers resources to the other hosts. Typically a server accepts connections from clients who request a service function.A firewall is a tool designed to intercept and assess incoming and outgoing packets. Depending on the types of devices we are protecting, and what we are protecting them from, we may choose to use different types of firewalls. They work mostly on the Network & Internet-Protocol Layer. Firewalls implement Network Address Translation.
✔️Packet-Filtering Firewalls
✔️Circuit-Level Firewalls
✔️Stateful Inspection Firewalls
--state option, which categorizes packets based on connection state as described in the following man page excerpt:
INVALID meaning that the packet is associated with no known connection, ESTABLISHED meaning that the packet is associated with a connection which has seen packets in both directions, NEW meaning that the packet has started a new connection, or otherwise associated with a connection which has not seen packets in both directions, and RELATED meaning that the packet is starting a new connection, but is associated with an existing connection, such as an FTP data transfer, or an ICMP error.✔️Application Firewalls
✔️Next-Generation Level Firewalls (NGLF)
Voice over IP (VoIP) and Video Teleconferencing have become standard communication methods. Many networks are upgrading from legacy voice services to IP-based protocols and products. Voice and video communication over IP networks has become ubiquitous, replacing traditional circuit-switched telephony and enabling rich multimedia experiences. These services rely on a suite of specialized protocols to ensure real-time delivery, quality of service (QoS), and session management. This chapter explores the foundational protocols that enable voice (VoIP) and video communication across IP networks. Voice over IP (VoIP) Fundamentals
Voice over IP (VoIP) is a methodology and group of technologies for the delivery of voice communications and multimedia sessions over Internet Protocol (IP) networks, such as the Internet. It functions by converting analog audio signals into digital packets that are then transmitted over the network.
Key Components of a VoIP System: IP Phones: Devices that convert voice into IP packets and vice-versa. Can be hardware or software (softphones). VoIP Gateways: Connect traditional PSTN (Public Switched Telephone Network) lines to IP networks, allowing calls between the two. Call Processors/IP PBX (Private Branch Exchange): Manage call setup, routing, and features like voicemail, conferencing, etc. Codecs: Algorithms used to compress and decompress digital audio signals. Examples include G.711 (PCMU/PCMA), G.729, G.722.
Legacy voice services traditionally use the Public Switched Telephone Network (PSTN). A common residential telephone installation would be serviced by a simple box providing a single analog interface to the local exchange. This analog interface is known as Plain Old Telephone Service (POTS), where each line provides a single channel for incoming and outgoing calls.
For businesses requiring many voice lines, a digital trunk line is used, often referred to as Time Division Multiplexing (TDM). A TDM circuit can multiplex separate voice data channels for transmission over a single cable.
A Private Branch Exchange (PBX) is an automated switchboard providing a single connection point for an organization's voice lines. A TDM-based PBX connects to telecommunication carriers over a digital trunk line, which supports multiple channels (e.g., for multiple concurrent calls). This PBX allows for the configuration of the internal phone system to direct and route calls to local extensions and provides other telephony features such as call waiting, forwarding, music on hold, and voicemail.
A VoIP-enabled PBX replaces the TDM-based PBX. It establishes connections between local VoIP endpoints, with data transmitted over the local Ethernet network. A VoIP PBX can also route incoming/outgoing calls to and from an external network. This might involve calls between internal & external VoIP endpoints or with callers on the voice telephone network. VoIP-based PBXs also support traditional telephony features.
A VoIP PBX would normally be placed at the network edge and protected by a firewall. Internal clients connect to the PBX over Ethernet data cabling, using IP at network layers for addressing. The VoIP PBX uses the organization's Internet link to connect to a VoIP service provider, which facilitates inbound and outbound calling.
VoIP protocols are designed to support real-time services and cover one or more of the following functions:
SIP Endpoints are the end-user devices, also known as User Agents, such as IP-enabled handsets or client-server web conferencing software. Each device, conference, or telephony user is assigned a unique SIP Address, known as a SIP Uniform Resource Indicator (URI). Examples include sip:jamie@support.com or sip:2622136227@support.com. There is also a tel: URI Scheme allowing SIP Endpoints to dial a landline or cell phone. A tel: URI can either use the global telephone format or a local format for internal extensions.
SIP runs over UDP or TCP ports 5060 (unsecured) and 5061 (SIP-TLS). It has its own reliability & retransmission mechanisms, benefiting most from the lower overhead, reduced latency, and jitter of UDP. SIP primarily provides session management. Key SIP Components/Roles:
User Agent (UA): Endpoints that initiate or terminate calls. Divided into:
User Agent Client (UAC): Initiates SIP requests.
User Agent Server (UAS): Receives SIP requests and sends responses.
SIP Proxy Server: Intermediary entities that receive SIP requests, forward them to the next hop, and return responses. Can also handle routing decisions.
SIP Registrar Server: Accepts REGISTER requests from UAs to record their current location.
SIP Redirect Server: Accepts a SIP request, maps the address of the called party to zero or more new addresses, and returns these addresses to the client. The client then contacts the new address directly.
Basic SIP Call Flow (Simplified):
INVITE: UAC sends INVITE to UAS (via proxy) to initiate a call.
100 Trying: Proxy acknowledges INVITE.
180 Ringing: UAS informs UAC that the called party is being alerted.
200 OK: Called party answers, UAS sends 200 OK.
ACK: UAC acknowledges 200 OK, call is established.
RTP: Media (voice/video) flows directly between UAs using RTP.
BYE: Either UA sends BYE to terminate call.
200 OK: Receiver acknowledges BYE.
H.323 is an ITU-T recommendation that defines protocols for providing audio-visual communication sessions on any packet network. While less common for new deployments compared to SIP, it is still used in many legacy enterprise and service provider networks, particularly for video conferencing systems. H.323 is a binary, complex protocol that defines various components and their interactions.
Key H.323 Components/Roles:
H.323 vs. SIP (Key Differences):
| Feature | H.323 | SIP |
|---|---|---|
| Origin | ITU-T (Telecommunications Focus) | IETF (Internet Focus) |
| Complexity | More complex, binary, monolithic | Simpler, text-based, modular |
| Architecture | Gatekeeper-centric, tightly coupled | Client-server, peer-to-peer, loosely coupled |
| Ports | Uses multiple well-defined ports | Primarily UDP/5060, TCP/5060 |
| Scalability | Less scalable in large, distributed environments | Highly scalable |
| Extensibility | Less flexible, harder to extend | Highly extensible, easy to adapt |
| Legacy Use | Common in legacy video conferencing, PSTN gateways | Dominant for modern VoIP/UC deployments |
RTP and RTCP are fundamental protocols for delivering real-time voice and video data over IP networks once a session has been established by signaling protocols like SIP or H.323.
Video communication over IP involves specific protocols and codecs for efficient compression, transmission, and rendering of video streams.
VoIP/SIP Endpoints can be implemented as software (softphones) or as dedicated hardware handsets.
SIP Endpoints can establish communications directly in a peer-to-peer architecture. However, it's more typical to use intermediary servers, directory servers, and VoIP Gateways. A Voice Gateway is a component that translates between a VoIP system and legacy voice equipment and networks (e.g., POTS lines, TDM PBXs).
Hybrid/Hardware-based VoIP PBX Integration (Type 1):
Legacy System Connecting to VoIP Service Provider (Type 2):
Connecting POTS Handsets to VoIP PBX (Type 3):
In essence, a VoIP Gateway is a component in a network that allows calls to be placed to and from voice telephony networks (PSTN) and packetized telephony networks (VoIP).