03 Networking and Network Management


  • .

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.

Basic Network Configuration in SLES

SLES provides tools like YaST (Yet Another Setup Tool) to manage networks through a graphical interface or command line.

Network Configuration with YaST

  1. Open YaST:

    sudo yast
  2. Select Network Settings.

  3. Configure the network adapter:

    • Choose the network adapter to configure.
    • Set the IP address (static or dynamic).
    • Configure the gateway and DNS.

Network Configuration via Command Line

  1. Viewing Network Configuration
    Use the following command to check the network configuration:

    ip addr
  2. Setting an IP Address
    Set a static IP address:

    sudo ip addr add 192.168.1.100/24 dev eth0
  3. Setting a Gateway
    Set the default gateway:

    sudo ip route add default via 192.168.1.1
  4. DNS Setting
    Edit the /etc/resolv.conf file to add DNS servers:

    nameserver 8.8.8.8
    nameserver 8.8.4.4

Management of IP Addresses, DNS, DHCP, and Gateways

IP Addresses

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).

  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
  2. 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

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

DHCP (Dynamic Host Configuration Protocol) automatically assigns IP addresses to devices on a network.

  • Configuring a DHCP Server

    1. Install the DHCP server package:

      sudo zypper install dhcp-server
    2. 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;
      }
    3. Restart the DHCP service:

      sudo systemctl restart dhcpd

Gateway

A gateway is a device that connects a local network to another network, such as the internet.

  • Use the following command to add a gateway:
    sudo ip route add default via 192.168.1.1

Firewall in SUSE Linux

SUSE Linux supports two types of firewalls: firewalld and SuSEfirewall2.

Firewalld

Firewalld is a modern zone-based firewall.

  1. Installing Firewalld
    Ensure firewalld is installed:

    sudo zypper install firewalld
  2. 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

SuSEfirewall2 is the older firewall in SLES.

  1. Configuring SuSEfirewall2
    Edit the configuration file at /etc/sysconfig/SuSEfirewall2

    FW_SERVICES_EXT_TCP="22 80"
  2. Restart SuSEfirewall2

    sudo systemctl restart SuSEfirewall2

SSH and Remote Access Management

SSH (Secure Shell) is a protocol for securely accessing devices over a network.

Configuring SSH in SLES

  1. Install the SSH package:

    sudo zypper install openssh
  2. Start the SSH service:

    sudo systemctl start sshd
  3. Configure the SSH settings in the /etc/ssh/sshd_config file as needed.

Basic SSH Commands

  1. Access a remote server:

    ssh user@hostname
  2. Copy files using SCP:

    scp file.txt user@hostname:/path/to/destination

NTP for Time Synchronization

NTP (Network Time Protocol) is a protocol for synchronizing system time with a time server.

Configuring NTP in SLES

  1. Install the NTP package:

    sudo zypper install ntp
  2. Edit the configuration file at /etc/ntp.conf :

    server 0.pool.ntp.org
    server 1.pool.ntp.org
  3. Start the NTP service:

    sudo systemctl start ntpd
  4. Manually synchronize the time:

    sudo ntpdate -u 0.pool.ntp.org