Softpanorama
(slightly skeptical) Open Source Software Educational Society

May the source be with you, but remember the KISS principle ;-)

Google   


Suse 10 network configuration

News

Suse 10

Recommended Books

Recommended Links

SLES Documentation

Network Utilities

Linux route command

ethtool

 

 

VMware Virtualization Humor

Etc

The SuSE manual covers how YaST performs setting up network interfaces, so we review where YaST stores the setup, and show you how to can modify these settings manually.

Interface configuration

A network interface is any device that connects a machine to network. The most popular interfaces are ethernet cards.
 
SuSE stores the configuration of all network interfaces in  various file but mostly in /etc/sysconfig/network directory.  For Suse it doesn't make any difference whether network settings are created by YaST or added manually. YaST  accepts manual changes from valid files.  The /etc/sysconfig/network directory contain a dozen of files and subdirectories, for example:

-rw-r--r-- 1 root root 9254 Aug 21 12:06 config
-rw-r--r-- 1 root root 6615 Aug 22 12:15 dhcp
drwxr-xr-x 2 root root 4096 May 3 2007 if-down.d
drwxr-xr-x 2 root root 4096 Aug 21 12:09 if-up.d
-rw-r--r-- 1 root root 266 Sep 19 14:55 ifcfg-eth-id-00:1e:c9:b5:28:45
-rw-r--r-- 1 root root 376 Nov 11 08:26 ifcfg-eth-id-00:1e:c9:b5:28:47
-rw-r--r-- 1 root root 141 Apr 21 2008 ifcfg-lo
-rw-r--r-- 1 root root 27701 Apr 21 2008 ifcfg.template
-rw-r--r-- 1 root root 239 Apr 21 2008 ifroute-lo
drwxr-xr-x 2 root root 4096 Aug 21 12:06 ifservices.template
drwx------ 2 root root 4096 May 3 2007 providers
-rw-r--r-- 1 root root 282 Nov 13 13:20 routes
-rw-r--r-- 1 root root 306 Nov 6 16:04 routes.YaST2save
drwxr-xr-x 2 root root 4096 Nov 4 09:48 scripts

The first important file are ifcfg-eth*  files. Each of them corresponds to an installed ethernet interface. They have suffixes equal to thier MAC addresses. Each file contains a list on variable that are set to certain values, one variable in the line.  For example:

BOOTPROTO='static'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR='10.10.1.1'
MTU=''
NAME='Broadcom NetXtreme II BCM5708 Gigabit Ethernet'
NETMASK='255.255.255.0'
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'
UNIQUE='JNkJ.swy66v437tA'
USERCONTROL='no'
_nm_name='bus-pci-0000:03:00.0'

The most important thing is that all settings for each interface have the same suffix. Each interface has to have an IP address. This address is stored in IPADDR variable.

Virtual interfaces

So far, we've talked only about real (meaning actual or physical) network interfaces. Linux provides support for virtual interfaces as well. The fact is, most people don't need virtual interfaces. But if you are running a server that acts as host for Web or ftp sites, and you want to host more than one server for a single service (for example, a multi-homes server), you may want to think about using virtual interfaces.
 
A virtual interface involves assigning more than one IP address to a real interface. This concept is also known as aliasing interfaces. You simply take one existing interface (which has to be real) and let it "listen" to additional IP addresses. This way, you can configure your Web server and/or ftp server to distinguish between traffic directed to these different IPs and point the request to separate document trees, depending on the IP address the request went to.
 
In Linux, virtual interfaces are specified by adding a colon (:) and an increasing number to the device name of the real interface. For example, if you have the device eth0 and you'd like to add more addresses to this device, you would use eth0:1 for the second address, eth0:2 for the third, and so on. Nothing else is needed. You can use these devices just as you'd use any real device. Of course, the primary concern is that you must set up the real device (in this case, eth0) before setting up the virtual interfaces.  Here is how they are reflated in the ifcfg files:

BOOTPROTO='static'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR='10.29.129.8'
IPADDR1='10.29.129.13'
IPADDR2='10.29.129.17'
MTU=''
NAME='Broadcom NetXtreme II BCM5708 Gigabit Ethernet'
NETMASK='255.255.255.0'
NETMASK1='255.255.255.0'
NETMASK2='255.255.255.0'
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'
UNIQUE='rBUF.swy66v437tA'
USERCONTROL='no'
_nm_name='bus-pci-0000:07:00.0'

Virtual interfaces are also useful if your network is set up in such a way that different subnets share one network segment, and you like to have your host be part of both (or all) subnets. The conventional method requires that you have a separate ethernet card for each subnet you want to participate, even if they run on the same wire. With the virtual interface option, you can configure one card to listen to each subnet by assigning it one address for each subnet. It's even possible to set this up for routing, or to masquerade from one subnet to the other so that hosts that don't support virtual interfaces can communicate to the host of another subnet through the Linux machine.
 

Setting up static routing

We've discussed network configurations and what routing is used for. Now you're ready for setting up routing in SuSE Linux. YaST allows you to specify a default router in the format that you used to configure an interface. This is fine for a leaf node in a simple network. However, if the network has more than one router, or you actually want to set up a router, you'll need more than this. You need to specify a routing table. Even if YaST doesn't provide a way to set up a routing table, the SuSE Linux distribution has a fairly easy way to do this.
 
The file routes contains a routing table, which will be set up by the script /sbin/init.d/route whenever a networking runlevel (by default runlevels two and three) is reached. For example: 

10.29.9.100 10.29.129.1 255.255.255.255 -
10.4.33.238 10.29.129.1 255.255.255.255 -
10.29.2.13 10.29.129.1 255.255.255.255 -
10.29.2.18 10.29.129.1 255.255.255.255 -
10.29.7.0 10.29.129.1 255.255.255.0 -
10.192.0.0 10.29.129.1 255.192.0.0 -
default 10.29.129.3 - -
	
The first column specifies a destination. This can be either a network address, a host address, or the string default for the default gateway. Whether the given address is a host or a network is determined by the netmask given in the third column. The network mask for a host is always 255.255.255.255. Everything else specifies a network route. Network route means a route to a network, whereas a host route is a route to a single host.

The second column gives either the IP address of the router, which should be used to reach the destination given in the first column, or the special value 0.0.0.0, which means that all traffic headed to the destination will be given to1 the device specified in the last column. If a gateway address is given, the device specification is optional.

The third column contains netmask.

Configuration files

/etc/sysconfig/network/ifcfg-*

These are the systems's configuration files for every network interface where "*" can be the name of the inteface (eth0, eth1, lo, ppp0...), its MAC address (ex: 00c09f2dc8a4) or indicate what hardware is used (usb, pcmcia).

The main parameters used in these files are:
BOOTPROTO - Can be static (IP configured manually), dhcp (IP oubtained through DHCP)

IPADDR BROADCAST NETMASK NETWORK - Define typical IP parameters: IP address, broadcast, netmask and network address

MTU - Defines the Maximum Transfer Unit (the size of every IP packet). Default on ethernet devices is 1500.

STARTMODE - Indicates the to activate the interface: onboot (at system's boot), hotplug (when a pluggable network device is inserted), manual (manually).
Other parameters can be used and can vary according to the interface type.

/etc/sysconfig/network/config

Contains various, well commented, variables that are applied to every interface, they include also what actions can be done when the interface status is changed. The same values can be specified in the single

/etc/sysconfig/network/dhcp, similarly, sets parameters related to dhcp use (logging, lease time, timouts, modification of system's settings, wait time at boot and so on).

/etc/sysconfig/network/wireless sets and describes the various parameters that can be applied to wireless devices (wieless mode, essid, frequency, sensibility, encryption key...). As usual they can be used in the ifcfg files of the single wireless devices, but it's useful to know the options than can be used.

/etc/sysconfig/network/routes
Defines all the (general) static routes. It's possible to specify routes exclusively related to the activation of single interfaces with the files /etc/sysconfig/network/ifroute-interface.

The format of this file is:
DESTINATION  GATEWAY  NETMASK|PREFIX INTERFACE [TYPE] [OPTIONS]

/etc/resolv.conf
Defines, as in most Unixes, the address of the DNS server to be used by the system.
Some services (pppd, ipppd, dhcpclient, hotplug, pcmcia, pptpclient) can temporarily modify this file in order to use, according to the new connection established, the appropriate DNS server. This is done by Suse's nice shell script /sbin/modify_resolvconf which has various options to handle and manage different dynamic entries in /etc/resolv.conf and /etc/named.conf.

/etc/hosts
As in most Unixes, in this file you can statically assign IP addresses to host names. You can also use /etc/networks for IP networks. The resolver by default first checks this file, before querying the DNS servers in /etc/resolv.conf. This order and other settings about how the system assigns names to resources can be changed (as in every Linux) in /etc/host.conf (old configuration file used by libc4 and libc5 linked programs) or /etc/nsswitch.conf (used by every recent program linked with glibc libraries).

/etc/HOSTNAME
Contains the hostname of the system, used by various startup scripts.

Network Utilities

SuSE features GNU variants of standard network utilities ifconfig, route, netstat. Several linux specific commands like ipifstatus  are also installed by default.

Status of network daemon can be displayed of changed with the service. To register init script you ca use chkconfig script.  command.

Here is the list of useful commands:

 

Old News ;-)

[Nov 12, 2008] Suse Enterprise Linux server Set Network card (NIC) to Full duplex setting

Jul 12, 2007 |  nixcraft.com

Changing your Network Interface Speed, Duplex or Auto Negotiate settings on Suse Enterprise Linux server.

1 # Login as root user

2 # Change directory to /etc/sysconfig/network/scripts
 

Code:
cd /etc/sysconfig/network/scripts
3 # Create a file called eth0-setup
 
Code:
vi eth0-setup
4 # Set eth0 to 100 duplex full, add following config line:
 
Code:
#!/bin/sh
/usr/sbin/ethtool -s eth0 speed 100 duplex full autoneg off
5 # Softlink /etc/sysconfig/network/scripts/eth0-setup to /etc/sysconfig/network/if-up.d
 
Code:
ln -s /etc/sysconfig/network/scripts/eth0-setup /etc/sysconfig/network/if-up.d
6 # More information - read man page
 
Code:
man ethtool
Also chk out : Linux add ethtool duplex settings to a network card permanently | nixCraft

 

[Sep 06, 2005] Virtual PC Guy's WebLog Making networking more robust under SuSE 9.3 under Virtual PC

 

I do not know when this happened - but in the last couple of releases of SuSE Linux they have taken a weird dependency on the MAC address of the network card.  To be precise - once you have configured your network card under SuSE - changing it's MAC address will cause SuSE to not initialize that network card (unless you remove and reconfigure it through YAST).

This is quite painful because - as I outlined here - Virtual PC can and will change the MAC address of the virtual network card from time to time.  And in my case (as I regularly move my virtual machines between Virtual PC and Virtual Server on different physical computers) the MAC address is getting changed almost constantly.

Thankfully there is a relatively easy (though not intuitive) way to solve this.  What you need to do is to get to a command prompt and type in the following commands:

  1. cd /etc/sysconfig/network

     

  2. ls

    At this stage you should see a file called 'ifcfg-eth-id-00:03:ff:xx:xx:xx' (substitute the 'xx:xx:xx' appropriately).  This is the cause of the problem.

     

  3. sudo mv ifcfg-eth-id-00\:03\:ff\:xx\:xx\:xx ifcfg-eth0

    Once again you should substitute the 'x's appropriately

Once you have done this you should be able to reboot the virtual machine and have the networking continue to work no matter what the MAC address is of the virtual network card.

Cheers,
Ben

Published Tuesday, September 06, 2005 7:46 PM by Virtual PC Guy
Filed under:

SuSE Networking - Professional Sysadmin's OpenSource Documentation Project

This is actually Red Hat config...

Changing Hostname Temporarly

Example: hostname newhostname.com

Changing Hostname Permanently

Edit the file /etc/HOSTNAME and change the value in it, Save and exit
To avoid dns errors edit the file /etc/hosts and create a line as below
192.168.1.50 newhostname alias
Change ip with your server ip and newhostname and alias with anything you have setup

Changing/Setting main ip

Edit the file /etc/sysconfig/network/ifcfg-eth0 and change the value of IPADDR, NETMASK , NETWORK and BROADCAST
Example ifcfg-eth0 file:
DEVICE=eth0
BOOTPROTO=none
BROADCAST=192.168.1.255
IPADDR=192.168.1.50
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes
USERCTL=no
PEERDNS=no
TYPE=Ethernet
Description: Dont forget to restart network after the change with below command
/sbin/rcnetwork restart
Connect again using new ip if all is well.

Adding more IPs

# Copy the config file to create an alias ip
cp /etc/sysconfig/network/ifcfg-eth0 /etc/sysconfig/network/ifcfg-eth0:1
#Now edit the new file /etc/sysconfig/network/ifcfg-eth0:1 and change "DEVICE=eth0" to "DEVICE=eth0:1" and change ip to the new ip you want to assign. Save and exit. Then use tbe below command to bring it live.
/sbin/rcnetwork restart

 

Recommended Links

Linux Headquarters Network Configuration Using SuSE YaST

Network Performance Fine Tuning in openSUSE & SUSE SUSE & openSUSE

SuSE + network - SWiK

Table Of Contents



Copyright © 1996-2008 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

Standard disclaimer: The statements, views and opinions presented on this web page are those of the author and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.

Last modified: November 13, 2008