Softpanorama

May the source be with you, but remember the KISS principle ;-)
Contents Bulletin Scripting in shell and Perl Network troubleshooting History Humor

Setting up static routing in SUSE

News

Suse

Recommended Books

Recommended Links

 Networking Links

Linux Networking

Linux route command

Routing Suse /etc/sysconfig/network/route file netstat Tips Horror Stories Humor

Etc

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 edition configuration files (which are overwritten by YAST).

There are two configuration files /etc/sysconfig/network/routes and /etc/sysconfig/network/ifroute-*.

 The entries in the routing configuration files look like this:

DESTINATION           GATEWAY NETMASK   INTERFACE [ TYPE ] [ OPTIONS ]
DESTINATION           GATEWAY PREFIXLEN INTERFACE [ TYPE ] [ OPTIONS ]
DESTINATION/PREFIXLEN GATEWAY -         INTERFACE [ TYPE ] [ OPTIONS ]

To omit GATEWAY, NETMASK, PREFIXLEN, or INTERFACE, write - instead. The entries TYPE and OPTIONS may just be omitted.

The following scripts in the directory /etc/sysconfig/network/scripts/ assist with the handling of routes:

ifup-route
for setting up a route
ifdown-route
for disabling a route
ifstatus-route
for checking the status of the routes

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.


Top Visited
Switchboard
Latest
Past week
Past month

NEWS CONTENTS

Old News ;-)

[May 14, 2010] Chapter 10 SuSE's scheme of network configuration

Setting up static routing
  
192.168.0.0   0.0.0.0         255.255.255.128  eth0  
default       192.168.0.1

This routing table is typical for a simple network host. It could be any host in Network A from Figure 9-2. As you can see, comment lines start with a hash sign (#) in the first column. Comment lines and empty lines are ignored when the route script sets up the kernel routing table.

The other lines represent routing table entries. The format is very close to the output of the route command, as we demonstrate in Chapter 9.

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.

To clearly illustrate this, we refer back to Figure 9-2 and have a look at the entries of the routing tables of the hosts and routers in this network.

Hosts in Network A These hosts use the table shown above. They can reach the subnet 192.168.0.0/25 directly over their ethernet card, and send everything else to Router A/B at 192.168.0.1.

Hosts in Network B Here we have two routers, Router A/B for traffic to Network A, and Router B/C for everything else:

# route to local subnet 'Network B'  
192.168.0.128 0.0.0.0         255.255.255.128  eth0 

# route to 'Network A'  
192.168.0.0   192.168.0.130   255.255.255.128

# default gateway is 'Router B/C'  
default       192.168.0.129

This example illustrates a very important point. All router addresses must be within a network that can be reached directly through an interface of this machine. This seems to be pretty obvious, because how should a host send packages to a router if it is not in the same network segment? And yet, this is a common mistake that is made when one is setting up routing tables. The address used for Router A/B must be 192.168.0.130 and not 192.168.0.1, because the latter one is not part of this subnet.

Hosts in Network C Same situation as in Network A. One router gets all the traffic not destined to the local subnet:

# route to local subnet 'Network C'  
192.168.1.0   0.0.0.0         255.255.255.0    eth0

# default router is 'Router B/C'  
default 192.168.1.1  

Router A/B This machine is directly connected to two subnets and forwards all traffic destined to Router B/C:

# route to 'Network A' (local)  
192.168.0.0   0.0.0.0         255.255.255.128  eth0  

# route to 'Network B' (local)  
192.168.0.128 0.0.0.0         255.255.255.128  eth1  

# default gateway is 'Router B/C' default 192.168.0.129

Router B/C This machine is your connection to the Internet. We assume that it uses an ISDN link (which also is a point-to-point connection) to some router located at the ISP. As we stated previously, this router has the IP address 204.179.13.1. So besides setting up the routes for the local environment, you need to set up a route to this machine and then you can use this machine as the default gateway:

# route to 'Network C' (local)  
192.168.1.0   0.0.0.0         255.255.255.0    eth1  

# route to 'Network B' (local)  
192.168.0.128 0.0.0.0         255.255.255.128  eth0  

# route to 'Network A' (via 'Router A/B')  
192.168.0.0   192.168.0.130   255.255.255.128  

# route to ISP router  
204.179.13.1  0.0.0.0         255.255.255.255  isdn0 

# default router is ISP's machine  
default       204.179.13.1  

Again you can see that you first need a route to the default gateway before you can use it as a hop to other hosts. Because the ISDN connection is point-to-point, this route is a host route. The netmask for a route to a single host is 255.255.255.255, which means that all bits of the netmask are set. There are no bits left to distinguish between different hosts in this address because it points to only one machine.

The basic principle of routing is to forward packages not destined to a local subnet to another router which knows how handle them. The example shown doesn't reflect this strategy, that is, the hosts in Network B could send all packages that don't go to machines in the same subnet to Router B/C. This router knows that traffic for Network A has to go to Router A/B. So why do you need the extra entry in the routing table for Network A? Well, you don't really need it; the setup would work without it. As soon as a host from Network B sends packages for a host in Network A to Router B/C (you still know what's going on?), it would get an ICMP redirect from Router B/C that tells it to send those traffic directly to Router A/B.

Add Persistant Route

Guest:

I want SuSE to automatically remember some routes I always have to feed it when it restarts. How do I do that?

example:
route add -net 134.135.2.0 gw 136.131.1.22 netmask 255.255.255.0 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).

Any help greatly appreciated!
Thanks.

ken_yap

[/b] Yast -> Network Devices -> Network card -> Edit -> Routing

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

SUSE 10 Setting up static route for two NICs same subnet suse, route, static, add

I have a machine I am using that has 2 NIC cards being used as a snort/ntop box. I use one NIC for listening to traffic and one for browsing the ntop reports and ACID reports. I have been able to get the computer up and running, performing beautifully, collecting data and giving reports. The problem I have run into comes from making these settings permanent after a reboot/power failure. With all the different distributions and most interest in IPChains for 2 NICs, I can't seem to find any relevant (to SUSE 10) articles on the Internet that show where I need to place the settings I need. I've looked in the /etc/sysconfig/network/ifcfg* files and /etc/sysconfig/network/scripts but I can't seem to get my head around what to make changes to.

To get the following setup:

eth0 Link encap:Ethernet HWaddr 00:B0:D0:17:E4:8C
inet addr:172.16.26.178 Bcast:172.16.27.255 Mask:255.255.254.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

eth1 Link encap:Ethernet HWaddr 00:A0:CC:7C:07:33
inet addr:172.16.26.177 Bcast:172.16.27.255 Mask:255.255.254.0
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1

Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
short.abc.com * 255.255.255.255 UH 0 0 0 eth0
172.16.26.0 * 255.255.254.0 U 0 0 0 eth0
172.16.26.0 * 255.255.254.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 0 0 0 eth0
loopback * 255.0.0.0 U 0 0 0 lo
default 172.16.26.60 0.0.0.0 UG 0 0 0 eth0

the steps/commands I run to get this setup after a reboot are:
eth0 [E4:8C] (.178) Talk: nothing
1) Set eth1 [07:33] (.177) to listen (promisc): ifconfig eth1 promisc
2) remove the default eth1 subnet route: route del -net 172.16.26.0 netmask 255.255.254.0 eth1
3) add eth0 as host: route add -host 172.16.26.178 eth0
4) add route for subnet traffic to eth0: route add -net 172.16.26.0 netmask 255.255.254.0 eth0
5) add default gateway for all traffic: route add default gateway 172.16.26.60 eth0

Anyone know where the settings must be placed so that I don't have to go to the console and rekey the route commands? I know this should be easy, but I'm at a loss.



Etc

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 in our efforts to advance understanding of environmental, political, human rights, economic, democracy, scientific, and social justice issues, etc. We believe this constitutes a 'fair use' of any such copyrighted material as provided for in section 107 of the US Copyright Law. In accordance with Title 17 U.S.C. Section 107, the material on this site is distributed without profit exclusivly for research and educational purposes.   If you wish to use copyrighted material from this site for purposes of your own that go beyond 'fair use', you must obtain permission from the copyright owner. 

ABUSE: IPs or network segments from which we detect a stream of probes might be blocked for no less then 90 days. Multiple types of probes increase this period.  

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


Copyright © 1996-2016 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. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License.

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.

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 make a contribution, supporting development of this site and speed up access. In case softpanorama.org is down you can use the at softpanorama.info

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 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: October 20, 2015