SLES: Reconfigure a fixed IP address

We recently had a problem with a SLES virtual machine which was copied and where the network connectivity was broken because we ended up being in a different network. So we needed to reconfigure the IP-Address.

It’s easy to solve temporally:

ifconfig eth0 192.168.190.200 netmask 255.255.255.0
route add default gw 192.168.190.1 eth0

Replace 192.168.190.200 by the IP address you want to set and 192.168.190.1 by the gateway address.

The IP address configuration will probably get lost on reboot.

A permanent fix with yast:

start yast from the command line.
Then select Network Devices > Network Card
Alt-h (Change…)
Delete the card with the old Mac-Address (probably called Ethernet Network…)
Edit the other one
Alt-t (Static address setup)
Alt-i (IP Address)
Type in the IP address you want the server to have (e.g. 192.168.190.200).
Alt-o (Routing)
Type in the IP address of the gateway (e.g. 192.168.190.1)
Alt-o (OK)
Alt-n (Next)
Alt-f (Finish)
Alt-q (Quit)

Execute the following to check that it’s fine:

ifconfig eth0

Then to check that the default gateway is properly setup, connect with putty.

Reboot the computer and check that everything is still OK.

Linux: Disable Address space layout randomization (ASLR) on SLES and Ubuntu

Address space layout randomization (ASLR) is a method to make hacker’s life more difficult by randomizing the position of the heap, stack, executable and libraries in the address space of the process. ASLR is enabled by default in Linux since kernel version 2.6.12.

It’s a nice security feature. Unfortunately it does break some software. If you run some software having this issue, you can switch off ASLR using the following:

sudo bash -c "echo 0 > /proc/sys/kernel/randomize_va_space"

to check the current value of the ASLR setting you can use the following:

cat /proc/sys/kernel/randomize_va_space

Linux: Determine the version of SLES Linux

If you need to find out your SLES (SuSE Linux Enterprise Server) version and service pack level from command line, you can use one of the following:

This one tells you the version, patch level and CPU architecture:

myserver:~ # cat /etc/SuSE-release
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 1

This one will only tell you it is a SLES server and which version:

myserver:~ # cat /etc/SuSE-brand
SLES
VERSION = 11
CO-BRANDS = SLE openSUSE

This one displays a welcome message with the version, service pack and CPU architecture:

myserver:~ # cat /etc/issue

Welcome to SUSE Linux Enterprise Server 11 SP1  (x86_64) - Kernel \r (\l).

This one gives you basically all you need to know:

myserver:~ # cat /etc/products.d/SUSE_SLES.prod
<?xml version="1.0" encoding="UTF-8"?>
<product id="sle-11-server" schemeversion="0">
  <vendor>SUSE LINUX Products GmbH, Nuernberg, Germany</vendor>
  <name>SUSE_SLES</name>
  <version>11.1</version>
  <baseversion>11</baseversion>
  <patchlevel>1</patchlevel>
  <release>1.152</release>
  <arch>x86_64</arch>
  <productline>sles</productline>
  <register>
    <target>sle-11-x86_64</target>
    <release></release>
    <repositories>
      <repository path="obs://build.suse.de/SUSE:SLE-11-SP1:GA/standard" />
      <repository path="obs://build.suse.de/SUSE:SLE-11:Update/snapshot-SP1" />
      <repository path="obs://build.suse.de/SUSE:SLE-11:GA/standard" />
    </repositories>
  </register>
  <upgrades />
  <updaterepokey>A43242DKD</updaterepokey>
  <summary>SUSE Linux Enterprise Server 11 SP1</summary>
  <shortsummary>SLES11_SP1</shortsummary>
  <description>SUSE Linux Enterprise offers a comprehensive
        suite of products built on a single code base.
        The platform addresses business needs from
        the smallest thin-client devices to the worldâs
        most powerful high-performance computing
        and mainframe servers. SUSE Linux Enterprise
        offers common management tools and technology
        certifications across the platform, and
        each product is enterprise-class.</description>
  <linguas>
    <language>cs</language>
    <language>da</language>
    <language>de</language>
    <language>en</language>
    <language>en_GB</language>
    <language>en_US</language>
    <language>es</language>
    <language>fi</language>
    <language>fr</language>
    <language>hu</language>
    <language>it</language>
    <language>ja</language>
    <language>nb</language>
    <language>nl</language>
    <language>pl</language>
    <language>pt</language>
    <language>pt_BR</language>
    <language>ru</language>
    <language>sv</language>
    <language>zh</language>
    <language>zh_CN</language>
    <language>zh_TW</language>
  </linguas>
  <urls>
    <url name="releasenotes">http://www.novell.com/linux/releasenotes/x86_64/SUSE-SLES/11-SP1/release-notes-sles.rpm</url>
    <url name="smolt">http://smolt.novell.com/register.pl</url>
    <url name="register">http://register.novell.com/</url>
  </urls>
  <buildconfig>
    <producttheme>SLES</producttheme>
  </buildconfig>
  <installconfig>
    <defaultlang>en_US</defaultlang>
    <datadir>suse</datadir>
    <descriptiondir>suse/setup/descr</descriptiondir>
    <releasepackage name="sles-release" flag="EQ" version="11.1" release="1.152" />
    <distribution>SUSE_SLE</distribution>
  </installconfig>
  <runtimeconfig />
</product>

zypper will also show you the SLES version and service pack:

myserver:~ # zypper sl
# | Alias                                            | Name                                             | Enabled | Refresh | Type
--+--------------------------------------------------+--------------------------------------------------+---------+---------+------
1 | SUSE-Linux-Enterprise-Server-11-SP1 11.1.1-1.152 | SUSE-Linux-Enterprise-Server-11-SP1 11.1.1-1.152 | Yes     | No      | yast2

You can also use sam to get this piece of information. But it actually does much more. By using the following options you can reduce the time it needs to run (by disabling some checks):

myserver:~ # sam --no-rpm-verify --no-header-sig-check
Supportability Analysis Module 0.8.2
*** Report by 'sam --no-rpm-verify --no-header-sig-check'
*** Installed versions:
  suse-sam-data    0.8.2-0.3.1
  satsolver-tools  0.14.17-0.2.18
  suse-sam         0.8.2-0.3.3
  perl-satsolver   0.14.17-0.2.18
*** Installed products: 1 (known vendors: 1)
  System architecture: x86_64
  Baseproduct: SUSE_SLES.prod
  SUSE_SLES.prod:
    summary:       SUSE Linux Enterprise Server 11 SP1
    name version:  SUSE_SLES 11.1
    SP, release:   1 1.152
    arch:          x86_64
    repository:    obs://build.suse.de/SUSE:SLE-11-SP1:GA/standard
    repository:    obs://build.suse.de/SUSE:SLE-11:Update/snapshot-SP1
    repository:    obs://build.suse.de/SUSE:SLE-11:GA/standard
*** Found package repositories: 1 (reference 12, skipped 12, need refresh 0)
  Repository #1:
    name:          SUSE-Linux-Enterprise-Server-11-SP1 11.1.1-1.152
    label:         SUSE Linux Enterprise Server 11 SP1 (3)
    distribution:  SUSE_SLE
    version:       11
*** Considered packages:
    Packages belonging to defined products:  817
    Signed with accepted key:                not checked
    3rd party packages:                      0
    Skipped gpg-key packages:                9
*** Unsatisfied package dependencies: NOT CHECKED
*** Novell packages depending on 3rd party packages: NONE
*** Package version checks: all up to date
*** Modified filesystem objects: NOT CHECKED
*** Files not owned by any package: NOT CHECKED

*** Summary (see above or log for details):

  Product: SUSE_SLES 11.1 SP:1 release:1.152 x86_64

Statistics:
    Total packages installed:                         826
    Packages signed by Novell:                        817
    Packages matching installed products:             817
    Packages not created by Novell:                   0
    Unsupported Novell packages:                      0
    File modifications:                               (not checked)
    Unsatisfied dependencies:                         (not checked)
    Novell packages depending on 3rd party packages:  0
    Updates needed:                                   0
    Files not belonging to a package:                 (not checked)

Status and recommendations:

    Congratulations, your system has passed the supportability analysis!
      According to the tests performed by SAM, nothing has been detected
      which might exclude your system from receiving support from Novell.
      You may confidently deploy this system with support from Novell.

Note: sam has replaced SPident in SLES 11.

You can get information about the kernel version using:

myserver:~ # rpm -qf /boot/vmlinuz
kernel-default-base-2.6.32.12-0.7.1

or:

myserver:~ # cat /proc/version
Linux version 2.6.32.12-0.7-default (geeko@buildhost) (gcc version 4.3.4 [gcc-4_3-branch revision 152973] (SUSE Linux) ) #1 SMP 2010-05-20 11:14:20 +0200

or simply:

myserver:~ # uname -a
Linux myserver 2.6.32.12-0.7-default #1 SMP 2010-05-20 11:14:20 +0200 x86_64 x86_64 x86_64 GNU/Linux