Softpanorama

May the source be with you, but remember the KISS principle ;-)
Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and  bastardization of classic Unix

Suse /etc/sysconfig/network/routes file

News

Suse

Recommended Books

Recommended Links

 Networking Links

Linux Networking

Linux route command

Routing Postfix Suse NFS VNC on Linux Network Utilities SSH Telnet Protocol
FTP Pure FTP configuration SMTP Mail NTP Rsync Samba SNMP
Ethernet Protocol ethtool Autonegotiation netstat Suse RC Scripts Humor Etc

Introduction

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 need to specify a routing table.  It can be done via Yast or by editing configuration files (which can be overwritten by Yast).

The routing table is set up in SUSE via the configuration files /etc/sysconfig/network/routes and /etc/sysconfig/network/ifroute-*.

All the static routes required by the various system tasks can be entered in the /etc/sysconfig/network/routes file: routes to a host, routes to a host via a gateway, and routes to a network.

For each interface that needs individual routing, define an additional configuration file: /etc/sysconfig/network/ifroute-*.

Replace * with the name of the interface.

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.

Routes are made permanent in Suse by adding routes in Yast

Yast -> Network Devices -> Network card -> Edit -> Routing 

(see Suse network configuration)

Editing /etc/sysconfig/network/routes directly

Or you can edit edit /etc/sysconfig/network/routes if you prefer the CLI.

The routing table is set up in SUSE LINUX via the configuration files /etc/sysconfig/network/routes and /etc/sysconfig/network/ifroute-*.

All the static routes required by the various system tasks can be entered in the /etc/sysconfig/network/routes file: routes to a host, routes to a host via a gateway, and routes to a network.

For each interface that needs individual routing, define an additional configuration file: /etc/sysconfig/network/ifroute-*. Replace * with the name of the interface.

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 structure of the /etc/sysconfig/network/routes file

  1. 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.
  2. 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.
  3. The third column contains netmask.

Top Visited
Switchboard
Latest
Past week
Past month

NEWS CONTENTS

Old News ;-)

How to setup persistent Static Routes in openSUSE 11.0 SUSE & openSUSE

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 openSUSE

To 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

/etc/sysconfig/network/ifroute-eth0


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


DESTINATION GATEWAY NETMASK INTERFACE [ TYPE ] [ OPTIONS ]
Example
192.168.1.1 192.168.233.2 255.255.255.255 eth0

DESTINATION GATEWAY PREFIXLEN INTERFACE [ TYPE ] [ OPTIONS ]
Example
10.1.1.0 192.168.233.2 24

DESTINATION/PREFIXLEN GATEWAY - INTERFACE [ TYPE ] [ OPTIONS ]
10.1.1.0/24 192.168.233.2 -


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
10.1.1.1 192.168.233.2 255.255.255.255 eth0
10.10.10.0 192.168.233.2 24 eth0
172.20.1.0/24 192.168.233.2 – 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

ifup-route

To bring up static routes. This reads the file /etc/sysconfig/network/ifroute-* file.

ifdown-route

To clear the static routes loaded

ifstatus-route

To check the current status of the routes


SAIBABA:~ # /etc/sysconfig/network/scripts/ifstatus-route eth0
Configured routes for interface eth0:
169.254.0.0 – 255.255.0.0 eth0
10.1.1.1 192.168.233.2 255.255.255.255 eth0
10.10.10.0 192.168.233.2 24 eth0
172.20.1.0/24 192.168.233.2 – eth0
Active routes for interface eth0:
10.1.1.1 via 192.168.233.2
172.20.1.0/24 via 192.168.233.2
192.168.233.0/24 proto kernel scope link src 192.168.233.128
10.10.10.0/24 via 192.168.233.2
169.254.0.0/16 scope link
default via 192.168.233.2 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

Thats it! We are done.

Recommended Links

Google matched content

Softpanorama Recommended

Top articles

Sites

Top articles

Sites

...



Etc

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D


Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to to buy a cup of coffee for authors of this site

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Last modified: July, 28, 2019