By Sheldon L | Published at 2020-04-29 | Updated at 2020-04-20 |
IP
(Internet Protocol) address2^32, 4.3 * 10^9
2^64, 3.4 * 10^38
DHCP
(Dynamic Host Configuration Protocol)DNS
hostname
cat /etc/hosts
cat /etc/resolv.conf
host linuxfoundation.org
nslookup linuxfoundation.org
dig linuxfoundation.org
# Debian
ls -l /etc/network/
# Fedora and SUSE
ls -l /etc/sysconfig/network/
nmtui
nmcli
net-tools
package, install it if you want to use it.ifconfig enp4s0f2 # enp4s0f2 is the network interface
ip -s link show enp4s0f2
ip address show enp4s0f2
/sbin/ip addr show # interface config, similar to `ifconfig`
/sbin/ip route show # routing table, similar to `route`
ip --brief addr show # more brief
ifconfig # interface config
route -n # routing table
ping -c [n] [address] # ping [n] times
route -n # Show current routing table
ip route # Show current routing table
route add -net [address] # Add static route
ip route add [address] # Add static route
route del -net [address] # Delete static route
ip route del [address] # Delete static route
traceroute [address]
Networking Tools | Description |
---|---|
ethtool |
Queries network interfaces and can also set various parameters such as the speed |
netstat |
Displays all active connections and routing tables. Useful for monitoring performance and troubleshooting |
nmap |
Scans open ports on a network. Important for security analysis |
tcpdump |
Dumps network traffic for analysis |
iptraf |
Monitors network traffic in text mode |
mtr |
Combines functionality of ping and traceroute and gives a continuously updated display |
dig |
Tests DNS workings. A good replacement for host and nslookup |
sudo ethtool [interface]
netstat -r
nmap -sP 192.168.0.0/24
wget
and curl
wget
curl
wget
wget [url] # download
curl [url] # read
curl -o [saved_file_name] [url] # download
/sbin/ifconfig
ip addr show
# if IP address not show
# one of these can restart network
sudo systemctl restart NetworkManager
sudo systemctl restart network
sudo service NetworkManager restart
sudo service network restart
# and try to refresh dhcp address
sudo dhclient [interface]
hostname
sudo ping -c 3 google.com
host google.com
# nameserver conf: /etc/resolv.conf
# If you wanted to override that you could do:
host google.com 8.8.8.8 # google nameserver
# Note that there is another file, /etc/hosts,
# where you can associate names with IP addresses,
# which is used before the DNS server is consulted.
# This is most useful for specifying nodes on your local network.
dig google.com
# Tracing the route to one of the public name server
sudo traceroute 8.8.8.8
# default gate way
ip route show
sudo mtr --report-cycles 3 8.8.8.8 # an enhanced version of traceroute
ftp
has fallen into disfavor on modern systems, as it is intrinsically insecure, since passwords are user credentials that can be transmitted without encryption and are thus prone to interception. So it was removed from rsync
and web browser https. Connecting to an FTP server:ftp [address] # such as ftp.gnu.org
# Hint: The user name for anonymous FTP site is `anonymous`.
# most anonymous FTP sites require you to supply a password, but it does not matter what you give!
> ls
> get [file] # such as fwelcome.msg
> quit
ssh
and scp
scp
(Secure Copy) between two networked hosts. scp
uses the SSH protocol
for transferring data.# ssh
ssh [user]@[address]
# scp
scp [localfile] <user@remotesystem>:/home/user/
scp -r [localfolder] <user@remotesystem>:/home/user/