7. September 2021

Set Up Static IP SUSE or openSUSE

By H. Cemre Günay

Configuring Using – yast

Easiest solution is to enter “yast” at that terminal prompt, then use the arrow and tab keys to get to Network Devices -> Network Settings.

yast

Manual Configuration

To setup Static IP configuration on SUSE Linux we need to we need to edit 3 files.
Please note: If you are ‘root‘ you don’t need to use ‘sudo‘ in your commands!

/etc/sysconfig/network/ifcfg-eth0
/etc/sysconfig/network/routes
/etc/resolv.conf

Determine your network interface

cd /etc/sysconfig/network/
ls -la

Determine if you want to edit “ifcfg-eth0” or “ifcfg-eth1”, ect. In this example we will edit “ifcfg-eth0”.

# sudo nano ifcfg-eth0
or
# sudo vi ifcfg-eth0

Examples of ifcfg-eth0 configuration
” /etc/sysconfig/network/ifcfg-eth0″ 

Example 1:

BOOTPROTO='static'
IPADDR='192.168.2.77'
MTU='1500'
NAME=''
NETMASK='255.255.255.0'
STARTMODE='auto'
USERCONTROL='no'

Example 2:

BOOTPROTO='static'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR='10.0.0.150/24'
MTU=''
NAME='3c940 10/100/1000Base-T [Marvell]'
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'
USERCONTROL='no'

See ‘man ifcfg’ and /etc/sysconfig/network/ifcfg.template

Set DNS and default route

/etc/sysconfig/network/routes
default 192.168.2.1 – –

cd /etc/sysconfig/network/

sudo nano routes
or
sudo vi routes

/etc/resolv.conf
nameserver 192.168.2.1

cd /etc/

sudo nano resolv.conf
or
sudo vi resolv.conf

See ‘man routes’ for an explanation of this file.

If you have any questions, please leave a comment. 🙂