Networking is an essential component of the Linux operating system, including SUSE Linux Enterprise Server (SLES). Network management includes configuring IP addresses, DNS, gateways, firewalls, and remote access services such as SSH.
SLES provides tools like YaST (Yet Another Setup Tool) to manage networks through a graphical interface or command line.
Open YaST:
sudo yast
Select Network Settings.
Configure the network adapter:
Viewing Network Configuration
Use the following command to check the network configuration:
ip addr
Setting an IP Address
Set a static IP address:
sudo ip addr add 192.168.1.100/24 dev eth0
Setting a Gateway
Set the default gateway:
sudo ip route add default via 192.168.1.1
DNS Setting
Edit the /etc/resolv.conf
file to add DNS servers:
nameserver 8.8.8.8
nameserver 8.8.4.4
An IP address is the identity of a device within a network. There are two types of IP addresses:
IPv4
: Common format (example: 192.168.1.1
).
IPv6
: Newer format supporting more devices (example: 2001:db8::1
).
Dynamic IP Configuration
To use DHCP:
Ensure the dhclient
package is installed:
sudo zypper install dhclient
Run DHCP to obtain an IP address:
sudo dhclient eth0
Static IP Configuration
Edit the configuration file in /etc/sysconfig/network/ifcfg-eth0
:
BOOTPROTO='static'
IPADDR='192.168.1.100'
NETMASK='255.255.255.0'
GATEWAY='192.168.1.1'
Restart the network service:
sudo systemctl restart network
DNS (Domain Name System) converts domain names into IP addresses. DNS configuration is done in the /etc/resolv.conf
file.
Adding a DNS server:
Add the DNS server in the file:
nameserver 8.8.8.8
nameserver 8.8.4.4
DHCP (Dynamic Host Configuration Protocol) automatically assigns IP addresses to devices on a network.
Configuring a DHCP Server
Install the DHCP server package:
sudo zypper install dhcp-server
Edit the DHCP configuration file at /etc/dhcpd.conf
:
subnet 192.168.1.0 netmask 255.255.255.0
{ range 192.168.1.100 192.168.1.200;
option routers 192.168.1.1;
option domain-name-servers 8.8.8.8, 8.8.4.4;
}
Restart the DHCP service:
sudo systemctl restart dhcpd
A gateway is a device that connects a local network to another network, such as the internet.
sudo ip route add default via 192.168.1.1
SUSE Linux supports two types of firewalls: firewalld
and SuSEfirewall2
.
Firewalld
is a modern zone-based firewall.
Installing Firewalld
Ensure firewalld
is installed:
sudo zypper install firewalld
Basic Firewalld
Commands
Start firewalld
:
sudo systemctl start firewalld
Adding a rule:
sudo firewall-cmd --add-port=22/tcp –permanent
Reload configuration:
sudo firewall-cmd –reload
SuSEfirewall2
is the older firewall in SLES.
Configuring SuSEfirewall2
Edit the configuration file at /etc/sysconfig/SuSEfirewall2
FW_SERVICES_EXT_TCP="22 80"
Restart SuSEfirewall2
sudo systemctl restart SuSEfirewall2
SSH (Secure Shell) is a protocol for securely accessing devices over a network.
Install the SSH package:
sudo zypper install openssh
Start the SSH service:
sudo systemctl start sshd
Configure the SSH settings in the /etc/ssh/sshd_config
file as needed.
Access a remote server:
ssh user@hostname
Copy files using SCP:
scp file.txt user@hostname:/path/to/destination
NTP (Network Time Protocol) is a protocol for synchronizing system time with a time server.
Install the NTP package:
sudo zypper install ntp
Edit the configuration file at /etc/ntp.conf
:
server 0.pool.ntp.org
server 1.pool.ntp.org
Start the NTP service:
sudo systemctl start ntpd
Manually synchronize the time:
sudo ntpdate -u 0.pool.ntp.org