Difference between revisions of "User:Saul/networking"

From Organic Design wiki
m (ip)
m (ip)
 
(3 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
ping -s 500 -c 3 <HOSTNAME>
 
ping -s 500 -c 3 <HOSTNAME>
  
# Traceroute to show a path to HOSTNAME
+
# Traceroute (UDP) to show a path to HOSTNAME
 
traceroute <HOSTNAME>
 
traceroute <HOSTNAME>
 +
 +
# Traceroute (ICMP) to show a path to HOSTNAME
 +
traceroute -I <HOSTNAME>
 +
 +
# Traceroute (TCP) to show a path to HOSTNAME
 +
traceroute -T <HOSTNAME>
 +
# Alternatively
 +
tcptraceroute <HOSTNAME>
 
</source>
 
</source>
  
Line 31: Line 39:
 
# Show info for the interface IFACE
 
# Show info for the interface IFACE
 
ip address show dev <IFACE>
 
ip address show dev <IFACE>
 +
 +
# Show the MAC addresses
 +
ip link show
 +
 +
# Show the ARP cache.
 +
ip neighbor show
 +
 +
# Show the IPv6 neighbor cache.
 +
ip -6 neighbor show
  
 
# Show configured routes
 
# Show configured routes

Latest revision as of 21:29, 5 November 2020

Useful Commands

General

# Ping with a payload of 500 bytes 3 times
ping -s 500 -c 3 <HOSTNAME>

# Traceroute (UDP) to show a path to HOSTNAME
traceroute <HOSTNAME>

# Traceroute (ICMP) to show a path to HOSTNAME
traceroute -I <HOSTNAME>

# Traceroute (TCP) to show a path to HOSTNAME
traceroute -T <HOSTNAME>
# Alternatively
tcptraceroute <HOSTNAME>

DNS

# Resolve hostname to ip address where type = {A, AAAA, MX, NS...}
dig <TYPE> <HOSTNAME>

# Reverse dns lookup
dig -x <ADDRESS>

# Lookup using host
host <HOSTNAME or ADDRESS>

# Find who is responsible for a subnet.
whois <ADDRESS>

ip

# Show configured interfaces
ip address show

# Show info for the interface IFACE
ip address show dev <IFACE>

# Show the MAC addresses
ip link show

# Show the ARP cache.
ip neighbor show

# Show the IPv6 neighbor cache.
ip -6 neighbor show

# Show configured routes
ip route show
# Alternative
netstat -rn

# Add a static route
ip route add <NETWORK>/<MASK> via <ROUTER>

# Add a default route
ip route add default via <ROUTER>
# Alternatively use 0.0.0.0/0 instead of default

# Add a direct route through an interface
ip route add <NETWORK>/<MASK> dev <IFACE>

# Delete a route from the routing table
ip route delete <NETWORK>/<MASK> dev <IFACE>

tcpdump

tcpdump is the command line alternative to the GUI Wireshark.

# Capture packets on an interface.
tcpdump -i <IFACE>

# Write capture to a file
tcpdump -i <IFACE> -w <FILENAME>

# Read a capture file
tcpdump -r <FILENAME>