Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!

Tuesday, November 16, 2010

OpenSUSE -configuring routes

I want SuSE to automatically remember some routes I always have to feed it when it restarts. example:
route add -net gw netmask dev eth0

In MS DOS I can just "route add -p" for persistant. man route didn't help much (I loathe man pages - the way they are written is overly geeky and 87% of the time I haven't got a clue what they're on about. And they are so DULL to read).
Yast - Network Devices - Network settings - Edit - Routing
if you prefer the CLI, edit
network ---- gateway ---- netmask ---- interface eth0
default eth1

How to setup persistent Static Routes in openSUSE 11.0
In openSUSE 11.0, the network setup is by default controller by “NetworkManager” and this is different from the traditional netcontrol. With NetworkManager, users control the Network Interfaces. To confirm this, in GNOME from Computer – Yast – Network Devices – Network Settings, check for option “User Controlled with Network Manager” under Network Setup Method. Or, check for the line ‘NETWORKMANAGER=”yes”‘ in /etc/sysconfig/network/config file.
This may not be a viable option to use on SUSE enterprise Desktop as in a enterprise environment you wouldn’t want the user to modify or control network settings.

Network Manager setup in openSUSETo setup persistent Statis Routes in openSUSE 11.0 when network settings are controlled by NetworkManager, then try the following:
1. Create a ifroute-<*> file for each interface

For every network interface on the system which needs individual persisten static routing table create a “ifroute-<*>” file in the /etc/sysconfig/network/ directory.
where <*> is the name of the interface
For instance, on my system the interface name is eth0 and hence I create a file called

This file should have the static route entries for the hosts or networks in any of the following format:
Example eth0

Example 24


In the above each of the field is seperated by a TAB. [TYPE][OPTIONS] are optional.
If you not in the above, Example 2 & 3 mean exactly the same. Only represented in different formats.
So, I created a file as follows on my system
SAIBABA:~ # cat /etc/sysconfig/network/ifroute-eth0 eth0 24 eth0 – eth0
2. NetworkManager POST_UP Script

With NetworkManager, the POST_UP scripts are fetched from /etc/sysconfig/network/if-up.d/ directory and is set to ‘yes’ (enabled) by default. In simple terms, any script that you want to run once the Network interface up and active, simply drop them into this directory or create a symbolic link to the script file in this directory.
In SUSE and openSUSE, there are the following scripts in /etc/sysconfig/network/scripts/ directory which assist in bring up/down Interface routes and to check the status
To bring up static routes. This reads the file /etc/sysconfig/network/ifroute-* file.
To clear the static routes loaded
To check the current status of the routes
SAIBABA:~ # /etc/sysconfig/network/scripts/ifstatus-route eth0
Configured routes for interface eth0: – eth0 eth0 24 eth0 – eth0
Active routes for interface eth0: via via  proto kernel  scope link  src via  scope link
default via  proto static
3 of 4 configured routes for interface eth0 up
3. Create a Symbolic File for ifup-route

In the POST_UP directory for NetworkManager i.e, /etc/sysconfig/network/if-up.d/ create a Symbolic link as follows to the ifup-route script as follows:
SAIBABA:~ # ln -s /etc/sysconfig/network/scripts/ifup-route /etc/sysconfig/network/if-up.d/ifup-route
Thats it. You can either restart your system or simply restart your Network service for the change to take effect.
SAIBABA:~ # /etc/init.d/network restart
Shutting down the NetworkManager                                     done
Shutting down network interfaces:
eth0      device: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10)                                                                   done
Shutting down service network  .  .  .  .  .  .  .  .  .  .  .  .  . done.
Starting the NetworkManager                                          done

No comments: