Network configuration is the process of setting up and managing network interfaces on Linux systems to enable communication with other devices and networks.
List Network Interfaces
# List network interfaces - ifconfigifconfig# List network interfaces - ipip addr
Setup Network
# Activate network interface - ifconfigsudo ifconfig eth0 up# OR using - ipsudo ip link set eth0 up# Assign IP sudo ifconfig eth0 192.168.1.10# Assign Netmasksudo ifconfig eth0 netmask 255.255.255.0# Assign Gatewaysudo route add default gw 192.168.1.1 eth0# Restart Networksudo systemctl restart networking
Set DNS
# Editing filesudo vim /etc/resolv.conf# Google DNSnameserver 8.8.8.8nameserver 8.8.4.4
# Show all listening ports - netstatnetstat -tuln# Show all listening ports - ssss -tuln# Show listening ports with process informationsudo netstat -tulnp# Show specific port (e.g., 80)sudo netstat -tulnp | grep 80