Networking
Module 6: Networking
Lesson 1: Network Configuration
1.1 Configuring Network Interfaces
1.1.1 Checking Network Interfaces
ifconfig or ip addr: Display information about network interfaces.
ifconfig
1.1.2 Configuring Network Interfaces
ifconfig or ip addr: Manually configure network interfaces.
sudo ifconfig eth0 192.168.1.2 netmask 255.255.255.0
ip Command:
sudo ip addr add 192.168.1.2/24 dev eth0
1.1.3 Network Configuration Files
/etc/network/interfaces (Debian/Ubuntu):
auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
/etc/sysconfig/network-scripts/ifcfg-eth0 (Red Hat/CentOS):
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.2
NETMASK=255.255.255.0
1.2 Troubleshooting Network Issues
ping: Check network connectivity.
ping google.com
traceroute or tracepath: Trace the route to a destination.
traceroute google.com
netstat or ss: Display network statistics and connections.
netstat -tuln
Lesson 2: Firewall Configuration
2.1 Introduction to iptables or firewalld
2.1.1 iptables
Viewing Rules:
sudo iptables -L
Allowing Connections:
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
Blocking Connections:
sudo iptables -A INPUT -p tcp --dport 80 -j DROP
2.1.2 firewalld
Checking Zones:
sudo firewall-cmd --get-active-zones
Opening Ports:
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
Reloading Firewall:
sudo firewall-cmd --reload
In Module 6, we explored the intricacies of networking in Linux system administration. We delved into network configuration, learning how to check and manually configure network interfaces using tools like ifconfig, ip, and configuration files. Troubleshooting network issues was addressed through commands like ping, traceroute, and netstat. Additionally, we introduced firewall configuration with a focus on iptables and firewalld, covering the basics of allowing and blocking connections. As we advance in our Linux journey, mastering networking concepts is essential for maintaining connectivity, resolving issues, and securing our systems against potential threats.