Port & Network Management
Port management, network configuration, and connectivity commands for CentOS/RHEL
Port Management Commands
Port checking, monitoring, and management commands
# Check if port is open
netstat -tulpn | grep :80
# Check listening ports
ss -tulpn | grep LISTEN
# Check specific port
nmap -p 80 localhost
# Check port with telnet
telnet localhost 80
# Check port with nc (netcat)
nc -zv localhost 80
# Show all open ports
netstat -tulpn
# Show ports by process
lsof -i :80
# Check port range
nmap -p 1-1000 localhost
# Check UDP ports
netstat -ulpn
# Check port with timeout
timeout 5 telnet localhost 80
Individual commands:
netstat -tulpn | grep :80
ss -tulpn | grep LISTEN
nmap -p 80 localhost
telnet localhost 80
nc -zv localhost 80
netstat -tulpn
lsof -i :80
nmap -p 1-1000 localhost
netstat -ulpn
timeout 5 telnet localhost 80
Network Configuration
Network interface configuration and management
# Show network interfaces
ip addr show
# Show routing table
ip route show
# Show network statistics
ip -s link show
# Configure IP address
ip addr add 192.168.1.100/24 dev eth0
# Bring interface up/down
ip link set eth0 up
ip link set eth0 down
# Show ARP table
ip neigh show
# Flush ARP table
ip neigh flush all
# Show network connections
ss -tulpn
# Show network statistics
cat /proc/net/dev
# Show network interface details
ethtool eth0
Individual commands:
ip addr show
ip route show
ip -s link show
ip addr add 192.168.1.100/24 dev eth0
ip link set eth0 up
ip link set eth0 down
ip neigh show
ip neigh flush all
ss -tulpn
cat /proc/net/dev
ethtool eth0
Firewall Commands (firewalld)
Firewall configuration and management with firewalld
# Check firewall status
systemctl status firewalld
# Start/stop firewall
systemctl start firewalld
systemctl stop firewalld
# Enable/disable firewall
systemctl enable firewalld
systemctl disable firewalld
# List firewall zones
firewall-cmd --get-zones
# List active zones
firewall-cmd --get-active-zones
# Add port to firewall
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --reload
# Remove port from firewall
firewall-cmd --permanent --remove-port=80/tcp
firewall-cmd --reload
# List open ports
firewall-cmd --list-ports
# Add service to firewall
firewall-cmd --permanent --add-service=http
firewall-cmd --reload
# List services
firewall-cmd --list-services
# Block IP address
firewall-cmd --permanent --add-rich-rule="rule family='ipv4' source address='192.168.1.100' reject"
firewall-cmd --reload
Individual commands:
systemctl status firewalld
systemctl start firewalld
systemctl stop firewalld
systemctl enable firewalld
systemctl disable firewalld
firewall-cmd --get-zones
firewall-cmd --get-active-zones
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --reload
firewall-cmd --permanent --remove-port=80/tcp
firewall-cmd --reload
firewall-cmd --list-ports
firewall-cmd --permanent --add-service=http
firewall-cmd --reload
firewall-cmd --list-services
firewall-cmd --permanent --add-rich-rule="rule family='ipv4' source address='192.168.1.100' reject"
firewall-cmd --reload