109 Networking Fundamentals KT Flashcards
109.1 Fundamentals of internet protocols
The following is a partial list of the used files, terms and utilities:
/etc/services
IPv4, IPv6
Subnetting
TCP, UDP, ICMP
/etc/services
/etc/services file contains a list of network services and ports mapped to them.
IPv4, IPv6
IPv4: Internet Protocol version 4 is a 32 bit addressing scheme that is used to identify machines on a network.
IPv6: Internet Protocol version 6 is a 128 bit addressing scheme that is used to identify machines on a network.
Subnetting
A subnetwork or subnet is a logical subdivision of an IP network.
TCP, UDP, ICMP
TCP: Transmission Control Protocol is a connection oriented internet protocol suite.
UDP: User Datagram Protocol is a connectionless internet protocol suite.
ICMP: Internet Control Messaging Protocol is used by network devices to send error messages, as well as operational messages indicating success or failure.
109.2 Persistent network configuration
The following is a partial list of the used files, terms and utilities:
/etc/hostname /etc/hosts /etc/nsswitch.conf /etc/resolv.conf nmcli hostnamectl ifup ifdown
/etc/hostname
/etc/hostname contains name of the machine, as known to applications that run locally.
/etc/hosts
The /etc/hosts file hosts is an operating system file that maps hostnames to IP addresses. It is a plain text file.
/etc/nsswitch.conf
The Name Service Switch (NSS) configuration file, /etc/nsswitch.conf, is used by the GNU C Library and certain other applications to determine the sources from which to obtain name-service information in a range of categories, and in what order.
/etc/resolv.conf
The /etc/resolv.conf configuration file contains information that allows a computer to convert alpha-numeric domain names into the numeric IP addresses.
nmcli
Command: nmcli is a command-line tool for controlling NetworkManager and getting its status.
nmcli [ OPTIONS ] OBJECT { COMMAND | help }
OBJECT := { nm | con | dev }
OPTIONS := { -t[erse] -p[retty] -m[mode] tabular | multiline -f[ields] | all | common -e[scape] yes | no -v[ersion] -h[elp] }
hostnamectl
Command: hostnamectl may be used to query and change the system hostname and related settings.
hostnamectl [OPTIONS…] {COMMAND}
ifup
Command: The ifup and ifdown commands may be used to configure (or, respectively, deconfigure) network interfaces based on interface definitions in the file /etc/network/interfaces.
ifup [-nv] [–no-act] [–verbose] [-i FILE|–interfaces=FILE] [–state-dir=DIR] [–allow CLASS] -a | IFACE…
ifdown [-nv] [–no-act] [–verbose] [-i FILE|–interfaces=FILE] [–state-dir=DIR] [–allow CLASS] -a | IFACE…
ifdown
Command: The ifup and ifdown commands may be used to configure (or, respectively, deconfigure) network interfaces based on interface definitions in the file /etc/network/interfaces.
ifup [-nv] [–no-act] [–verbose] [-i FILE|–interfaces=FILE] [–state-dir=DIR] [–allow CLASS] -a | IFACE…
ifdown [-nv] [–no-act] [–verbose] [-i FILE|–interfaces=FILE] [–state-dir=DIR] [–allow CLASS] -a | IFACE…
109.3 Basic network troubleshooting
The following is a partial list of the used files, terms and utilities:
ip hostname ss ping ping6 traceroute traceroute6 tracepath tracepath6 netcat ifconfig netstat route
ip
Command: Show / manipulate routing, network devices, interfaces and tunnels.
ip [ OPTIONS ] OBJECT { COMMAND | help }
hostname
Command: Hostname is used to display the system’s DNS name, and to display or set its hostname or NIS domain. name.
hostname [-a|–alias] [-d|–domain] [-f|–fqdn|–long]
[-A|–all-fqdns] [-i|–ip-address] [-I|–all-ip-addresses]
[-s|–short] [-y|–yp|–nis]
ss
Command: ss is used to dump socket statistics. It allows showing information similar to netstat. It can display more TCP and state informations than other tools.
ss [options] [ FILTER ]
ping
Command: ping uses the ICMP protocol’s mandatory ECHO_REQUEST datagram to elicit an ICMP ECHO_RESPONSE from a host or gateway.
Used with a -4 or -6 it can ping IPv4 or IPv6.
ping [-aAbBdDfhLnOqrRUvV46] [-c count] [-F flowlabel]
[-i interval] [-I interface] [-l preload] [-m mark]
[-M pmtudisc_option] [-N nodeinfo_option] [-w deadline] [-W timeout] [-p pattern] [-Q tos] [-s packetsize] [-S sndbuf] [-t ttl] [-T timestamp option] [hop…] destination
ping6
Command: ping uses the ICMP protocol’s mandatory ECHO_REQUEST datagram to elicit an ICMP ECHO_RESPONSE from a host or gateway.
Used with a -4 or -6 it can ping IPv4 or IPv6.
ping [-aAbBdDfhLnOqrRUvV46] [-c count] [-F flowlabel]
[-i interval] [-I interface] [-l preload] [-m mark]
[-M pmtudisc_option] [-N nodeinfo_option] [-w deadline] [-W timeout] [-p pattern] [-Q tos] [-s packetsize] [-S sndbuf] [-t ttl] [-T timestamp option] [hop…] destination
traceroute
Command: traceroute tracks the route packets taken from an IP network on their way to a given host. It
utilizes the IP protocol’s time to live (TTL) field and attempts to elicit an ICMP TIME_EXCEEDED response from each gateway along the path to the host.
traceroute6 is equivalent to traceroute -6
traceroute [-46dFITUnreAV] [-f first_ttl] [-g gate,…]
[-i device] [-m max_ttl] [-p port] [-s src_addr] [-q nqueries] [-N squeries] [-t tos] [-l flow_label] [-w waittimes]
[-z sendwait] [-UL] [-D] [-P proto] [–sport=port]
[-M method] [-O mod_options] [–mtu] [–back]
host [packet_len]
traceroute6
Command: traceroute tracks the route packets taken from an IP network on their way to a given host. It
utilizes the IP protocol’s time to live (TTL) field and attempts to elicit an ICMP TIME_EXCEEDED response from each gateway along the path to the host.
traceroute6 is equivalent to traceroute -6
traceroute [-46dFITUnreAV] [-f first_ttl] [-g gate,…]
[-i device] [-m max_ttl] [-p port] [-s src_addr] [-q nqueries] [-N squeries] [-t tos] [-l flow_label] [-w waittimes]
[-z sendwait] [-UL] [-D] [-P proto] [–sport=port]
[-M method] [-O mod_options] [–mtu] [–back]
host [packet_len]
tracepath
Command: It traces path to destination discovering MTU along this path. It uses UDP port port or some random port. It is similar to traceroute, only does not not require superuser privileges and has no fancy options.
tracepath6 is the IPv6 equivalent to tracepath.
tracepath [ -n] [ -l pktlen] destination [ port]
tracepath6
Command: It traces path to destination discovering MTU along this path. It uses UDP port port or some random port. It is similar to traceroute, only does not not require superuser privileges and has no fancy options.
tracepath6 is the IPv6 equivalent to tracepath.
tracepath [ -n] [ -l pktlen] destination [ port]
netcat
Command: netcat is a simple unix utility which reads and writes data across network connections, using TCP or UDP protocol.
nc [-options] hostname port[s] [ports] …
ifconfig
Command: Ifconfig is used to configure the kernel-resident network interfaces.
ifconfig [-v] [-a] [-s] [interface]
netstat
Command: Netstat prints information about the Linux networking subsystem. The type of information printed is controlled by the first argument.
netstat [address_family_options] [–tcp|-t] [–udp|-u] [–udplite|-U] [–sctp|-S] [–raw|-w] [–l2cap|-2] [–rfcomm|-f] [–listening|-l] [–all|-a] [–numeric|-n] [–numeric-hosts] [–numeric-ports] [–numeric-users] [–symbolic|-N] [–extend|-e[–extend|-e]] [–timers|-o] [–program|-p] [–verbose|-v] [–continuous|-c] [–wide|-W]
route
Command: Route manipulates the kernel’s IP routing tables. Its primary use is to set up static routes to specific hosts or networks via an interface after it has been configured with the ifconfig(8) program.
route [-CFvnNee] [-A family |-4|-6]
109.4 Configure client side DNS
The following is a partial list of the used files, terms and utilities:
/etc/hosts /etc/resolv.conf /etc/nsswitch.conf host dig getent
/etc/hosts
The /etc/hosts file hosts is an operating system file that maps hostnames to IP addresses. It is a plain text file.
/etc/resolv.conf
The /etc/resolv.conf configuration file contains information that allows a computer to convert alpha-numeric domain names into the numeric IP addresses.
/etc/nsswitch.conf
The Name Service Switch (NSS) configuration file, /etc/nsswitch.conf, is used by the GNU C Library and certain other applications to determine the sources from which to obtain name-service information in a range of categories, and in what order.
host
Command: host is a simple utility for performing DNS lookups. It is normally used to convert names to IP addresses and vice versa.
host [-aCdlnrsTUwv] [-c class] [-N ndots] [-R number]
[-t type] [-W wait] [-m flag] [[-4] | [-6]] [-v] [-V] {name} [server]
dig
Command: dig (domain information groper) is a flexible tool for interrogating DNS name servers. It performs DNS lookups and displays the answers that are returned from the name server(s) that were queried.
dig [@server] [-b address] [-c class] [-f filename] [-k filename] [-m] [-p port#] [-q name] [-t type] [-x addr] [-y [hmac:]name:key] [-4] [-6] [name] [type] [class] [queryopt…]
getent
Command: The getent command displays entries from databases supported by the Name Service Switch libraries, which are configured in /etc/nsswitch.conf.
getent [option]… database key…