Configure Static Ip using the Terminal

Hello,

I was trying to configure a static Ip on openSUSE but didn’t get very far…

I even googled but I couldn’t find anything.
Oh yeah I would like to do it through the terminal.

Would be cool if someone could tell me how this is done.

Cheers and Greetings
TempleClause

I found out that i have to change the seetings in

/etc/sysconfig/network

but with which parameters?

I would like to set the following settings:

IP: 192.168.2.77
Subnet:255.255.2550
DNS:192.168.2.1
Gateway:192.168.2.1

Thx for the answers

TempleClause

On 01/24/10 16:26, TempleClause wrote:
>
> I found out that i have to change the seetings in
>
> /etc/sysconfig/network
>
> but with which parameters?
>
> I would like to set the following settings:
>
> IP: 192.168.2.77
> Subnet:255.255.2550
> DNS:192.168.2.1
> Gateway:192.168.2.1

The file you need to make or edit is called ifcfg-<nic>, where <nic>
could be e.g. eth0 or eth1.
As example my ifcfg-eth0 file:

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

The DNS is configured in another file: /etc/resolv.conf
The default gateway is configured in yet another place:
/etc/sysconfig/network/routes
See ‘man routes’ for an explanation of this file.

Theo

You need to edit three files:

/etc/sysconfig/network/ifcfg-eth0
BOOTPROTO=‘static’
IPADDR=‘192.168.2.77’
MTU=‘1500’
NAME=’’
NETMASK=‘255.255.255.0’
STARTMODE=‘auto’
USERCONTROL=‘no’

/etc/sysconfig/network/routes
default 192.168.2.1 - -

/etc/resolv.conf
nameserver 192.168.2.1

Another idea, not nearly as geeky or sexy, would be to enter “yast” at that terminal prompt, then use the arrow and tab keys to get to Network Devices -> Network Settings. :slight_smile:

If you insist on knowing how to do it manually, just look at the contents of the files named above after you use Yast to see what it did. :wink:

(My theory is, the Suse people went to a LOT of trouble to perfect both the GUI and NCurses versions of Yast; why not use them?)