Networking
# See hostname and all IP addresses associated
# with the client.
hostname
hostname -I
# Get IP address and network info
ifconfig # (old, deprecated)
# or (following are all the same)
ip address
ip addr
ip add
ip a
# Show current default gateway.
ip route
ip route show # (equivalent)
# List all available network interfaces.
ip link show
# List all nodes on the network and their info.
nmap 10.133.0.*
# Lists all nodes within this subnet.
# Set network configuration in Ubuntu.
# This includes setting static IP, gateway, netmask, etc.
# for each network adapter.
sudo vim /etc/network/interfaces
# Add any of the following lines under
# the relevant adapter(s) as needed.
address 192.168.1.58 # static client IP
netmask 255.255.255.0 # static netmask
gateway 192.168.1.1 # static gateway
# Apply changes.
sudo systemctl restart networking
# Restart networking service to
# apply any changes made to
# network configurations.
sudo systemctl restart networking
# Check internet connection.
ping 1.1.1.1 # (Cloudflare DNS server)
# Check DNS status (which DNS is active).
systemd-resolve --status
# Active DNS IP should appear at the
# top of the output if one is active.
# Set the DNS servers in Ubuntu.
sudo vim /etc/systemd/resolved.conf
# Under section "[Resolve]"...
# Edit the following lines:
DNS=1.1.1.2
FallbackDNS=1.0.0.2
# Apply DNS changes.
service systemd-resolved restart
# List active TCP connections (deprecated in favor of 'ss').
netstat
# List active TCP connections.
ss
# Open, close, transmit messages, and scan ports over TCP and UDP.
netcat
# Simple firewall manager for linux.
# Allow or deny access to specific ports.
# Interface to IP tables.
ufw
# Test network speed
tcptrack
iperf
iftop
Last updated