###Common Network Utilities###
Features:
 1. Find other hosts - PING
 2. Check service availability | ability - Telnet
 3. Network statistics - netstat
 4. Interface configuration - ifconfig
 5. Path to remote systems - traceroute, tracepath
 6. Name resolutions - nslookup , dig, host, whois
 
 
Tasks:
 1. Packet Internet Network Groper (PING) - Diagnostics Utility
  a. 'ping hostname' - sends an unlimited number of packets, by default
   a1. 'ping -c 3 hostname' - sends 3 packets to remote host
Note: PING generates ICMP echo-requests and expects ICMP echo-replies from the target
 
 2. Telnet - tests availability of remote ports | also provides TTYs
  a. 'telnet 192.168.75.1 80' - checks connectivity to TCP:80
Note: You may test ports: 0-65535 || 2^16
 
 3. Netstat
  a. 'netstat -a' - returns ALL sockets: UDP:TCP:Unix
  b. 'netstat -nulp' - reveals UDP listeners sans name resolution, but with programs/PIDs
  c. 'netstat -ntlp' - "" TCP ""
  d. 'netstat -i' - dumps active interfaces
  e. 'netstat -rn' - dumps routing table
 
 4. Address Resolution Protocol (ARP) - translates between layer2 & layer3 addresses
Note: Every NIC contains a unique layer-2 MAC address
  a. 'arp' - dumps the ARP table
  b. 'arp -n' - excludes name resolution
  c. 'arp -d IP' - deletes entry from ARP table
 
Note: Arp will use the entry for your gateway when communicating with routed hosts
 
 5. Traceroute - traces path between client & server || host-A & host-B
Supports multiple methods: ICMP, UDP, TCP
Uses ICMP TTL to determine number of hops between source and destination
Note: Initial ICMP TTL = 1 - for your default gateway
Note: After discerning default GW, traceroute increments ICMP TTL to 2.
Note: Default method is to use UDP:33434 & increment per hop found
Note: However, default method isn't always fruitful. Try other methods: ICMP, TCP
  a. 'traceroute 192.168.75.1' - default route
  b. 'traceroute www.linuxcbt.com'
 
ICMP TTL HOST Probe1 Probe2 Probe3
  1  192.168.75.1 (192.168.75.1)  0.643 ms  0.471 ms  0.547 ms
 2  bras11-l0.mrdnct.sbcglobal.net (204.60.4.47)  12.760 ms  14.205 ms  16.387 ms
 
  c. 'tracepath www.linuxcbt.com' - returns route and MTUs if possible
 
Nslookup - Non-interactive | Interactive - searches default DNS servers: /etc/resolv.conf
  1. 'nslookup www.linuxcbt.com' - non-interactive query
  2. 'nslookup' - enters interactive mode
 
DIG - non-interactive
  1. 'dig www.linuxcbt.com'
  2. 'dig linuxcbt.com mx | ns' - returns mx | ns records respectively
  3. ' dig -x IP ' - reverses the query and returns the PTR record
 
Host - non-interactive
  1. 'host www.linuxcbt.com' - returns forward IP address
  2. 'host -C linuxcbt.com' returns SOA records
 
Whois - Searches for various objects: IPs, domains, etc.
  1. 'whois linuxcbt.com'
 
 
###IPv4 Configurations###
Features:
 1. Interface Configuration - 'ifconfig'
 2. DHCP and/or Static Configuration support
 3. Virtual (sub) interfaces - IPv4 aliases
 4. Displays important metadata for various OSI layers, errors, diagnostics, etc.
 
Tasks:
 1. 'ifconfig' - dumps current configuration of active interfaces
Note: You should ALWAYS see the 'loopback' interface
Note: 'gnome-nettool' - provides ifconfig info., as well as various utilities
 
 2. Use 'ifconfig' to define a new IPv4 sub-interface of: eth0
  a. 'ifconifg eth0:1 192.168.75.31' - temporarily assigns the address for the uptime of the box
Note: Sub-interfaces allow applications, i.e. Apache, to bind services to them
 
 3. Restart 'networking' service and confirm interface availability
Note: temporary sub-interface survives restart of 'networking' service, but NOT stop|start
 
 4. Ensure that sub-interface persists reboots
  a. '/etc/network/interfaces' - primary interface configuration file
   'ping -I 192.168.75.32 ping 192.168.75.31'
 5. Explore ALL interfaces:
  a. 'ifconfig -a' - enumerates ALL active | non-active interfaces
 
 6. Remove interfaces:
  a. 'ifconfig del eth0:1 192.168.75.31' - removes for the session: eth0:1
  b. 'ifconfig del eth0:2 192.168.75.32' - removes for the session: eth0:2
 
 
###IPv6 Configuration###
Features:
 1. Self-configuring
 2. Based on 128-bit addresses, vs. 32-bit address space for: IPv4 approx. 4billion addresses
 3. Enabled by default
 4. Typically configured via router
 5. Incorporates the MAC address of the connecting NIC
Note: MAC addresses use 48-bits
 6. IPv6 addresses are subnetted with /64, which means: /64 for nets & /64 for hosts
 
Tasks:
 1. Explore ifconfig configuration
inet6 addr: ::1/128 Scope:Host - loopback configuration
 
'ifconfig'
eth0      Link encap:Ethernet  HWaddr 00:0c:29:4d:e5:2c 
          inet addr:192.168.75.30  Bcast:192.168.75.255  Mask:255.255.255.0
          inet6 addr: 2002:4687:db25:2:20c:29ff:fe4d:e52c/64 Scope:Global
          inet6 addr: fe80::20c:29ff:fe4d:e52c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2269277 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2204154 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:159602581 (152.2 MiB)  TX bytes:1029103297 (981.4 MiB)
          Interrupt:18 Base address:0x1400
 
 
Note: Routable IPv6 interfaces define by default a link-local address that is routable on the layer-2 broadcast domain (VLAN)
Note: Routable IPv6 interfaces will also auto-configure IPv6 addresses from edge devices: routers, firewalls, layer-3 switches
 
inet6 addr: fe80::20c:29ff:fe4d:e52c/64 Scope:Link
Note: IPv6 safely ignores leading zeroes
 
6-to-4 Address configured on router and distributed automatically:
6-to-4 Addresses include:
 1. 2002 prefix - 48-bits
 2. Embedded IPv4 routable address - 32-bits
 3. MAC address of the host - 48-bits
inet6 addr: 2002:4687:db25:2:20c:29ff:fe4d:e52c/64 Scope:Global
 
Note: IPv6 address fully reveal your client's, or NIC's identity, as well as your IPv4 Internet presence if using 6-to-4 routing
 
Note: Edge devices, including DHCP6 servers, simply provide the IPv6 prefix. i.e. /64