getent networks
getent protocols
getent services | grep oracle
ip address
or
ip a
To see IP address information for a specified interface...
ip a show eth0
ifconfig -a
To see your external IP address...
curl -s http://whatismyip.akamai.com/
You can also use dig to see your external IP address...
dig +short myip.opendns.com @resolver1.opendns.com
dig TXT +short o-o.myaddr.l.google.com @ns1.google.com
To determine if a connection is using a TCP/IP connection or a UNIX Socket use...
netstat -ln | grep 'mysql'
To count connections on default MySQL Port...
netstat -an | grep 3306
netstat -an | grep 3306 | wc -l
netstat -an | grep 3306 | grep ESTABLISHED | wc -l
netstat -an | grep 3306 | grep TIME_WAIT | wc -l
netstat -an | grep 3306 | grep CLOSE | wc -l
To kill connections in CLOSE-WAIT state...
ss --tcp state CLOSE-WAIT --kill
tcpdump --list-interfaces
tcpdump --interface eth0
tcpdump host 10.1.0.6
tcpdump -c 5
tcpdump -n
tcpdump -nn
To see list of interfaces you can filter by
To see network packets on a specific interface
To see network packets from a specific host on any interface
Stop reporting after 5 packets
Disable name resolution
Disable name and port resolution
tcpdump example typical output format breakdown...
(with each piece of whitespace replaced with a linefeed, carriage return for readability)10:55:31.186895
IP
10.1.6.10.40050
>
10.2.7.15.1521:
Flags
[P.],
seq 82:123,
ack 455,
win 32661,
options
[nop,nop,TS val 1681688067 ecr 1664080743],
length 41
Timestamp HH:MI:SS.ms
Protocol. Generally IP or IP6
Source IP (or hostname) and Port (or Port name)
Direction
Target IP (or hostname) and Port (or Port name)
TCP Flags
S(SYN) F(FIN) P(PUSH) R(RST) .(ACK)
Sequence# (byte 82 through to byte 123 in this example)
1 if sending, otherwise the next expected byte (data)
bytes available in the receiving buffer
TCP Options
length, in bytes, of the payload data
TCP Flags
SYN = Connection StartFIN = Connection FinishPUSH = Data PushRST = Connection ResetACK = AcknowledgementTCP Options
nop = No OperationTS val = (TSVal) Timestamp value of the sending TCPecr = (TSecr) Echo Reply Timestampmss = Max Segment Sizewscale = Window Scale (host buffer space for receiving data)unknown-33 = unknown-14 =lsconf | grep -i gateway
netstat -rn
From mybox001...
ping mybox002
ping uses ICMP and does not use any porttraceroute mybox002
By default traceroute uses ICMPtraceroute -p 3306 -T mybox002
This tells traceroute to use port 3306 over TCP.This is useful if firewalls are preventing ICMP traffic with only specifc TCP ports open.The -T option is not available in the standard AIX implementation of traceroute.telnet mybox002 3306
This opens a connection on the specified port.nc mybox002 3306
Ncat works in a similar way to telnetSee also: prettyping, mtr, oping
To show listening ports on current server....
netstat --listening --numeric --programs | grep '\bLISTEN\b'
To limit to MySQL ports only...
netstat --listening --numeric --programs | grep '\bLISTEN\b' | grep -E '/ndb|/mysqld'
To list open ports for a target server...
In this example the target server is 172.16.16.4 (you can use a hostname instead)nmap 172.16.16.4
To get some limited version information...
nmap -sV 172.16.16.4
Note how much longer this takes; not a problem but be aware.To get more information...
nmap -p 1433 -A 172.16.16.4
speedtest
speedtest-cli is an open-source command line interface for testing internet bandwidth using speedtest.netNote that "Selecting best server based on ping..." can take some time, be patient.Initial testing suggests the download speed is accurate but the upload speed is inaccurate. Two tests to the same host gave ~3.4Mbps/CLI and ~18.43Mbps/Web (speedtest.net).