Sponsored Content
Special Forums IP Networking Need to solve complex network problem Post 302170087 by bakunin on Sunday 24th of February 2008 09:30:01 AM
Old 02-24-2008
The "default route" may be shown as an attribute for eth0 but *every* IP host has one and exactly one default route.

A route is telling the IP stack (and, regardless of the number of interfaces, there is only one IP stack per host) that "everything directed to network <destination> is to be sent to <gateway>, <gateway> will know how to handle it". "<network>" in this regard is a bit of a stretch, it can be a "network" consisting of only one host, if the subnet mask is all bits set to 1.

A "default" route is nothing different from that, just that "destination" is not a network or a host, but "everything not covered by other rules".

For instance:

your IP networks: 192.168.1/24, 192.168.2/24 in each of them your own IP adress will be 100. There is a router on network 192.168.1, which connects the network(s) to the world and has the adress 1 in the network.

Your IP address layout:

eth0: 192.168.1.100 / 255.255.255.0
eth1: 192.168.2.100 / 255.255.255.0

Your routing table (i do that on an AIX box, so it looks a bit different from Linux):
Code:
# netstat -rn
Routing tables
Destination        Gateway           Flags   Refs     Use  If   Exp  Groups

Route Tree for Protocol Family 2 (Internet):
default            192.168.1.1       UG        9    229328 en0      -      -   =>
192.168.1/24       192.168.1.100     U         0         0 en0      -      -   =>
192.168.2/24       192.168.2.100     U         0         0 en1      -      -   =>

The IP stack will now work like that: if it has to send a packet to a destination on one of "its own" networks (192.168.1/2.x) it will do so using eth0 or eth1, depending on rule 2 or 3.

If it has to send a package to 192.168.3.100 (or any other network), it will first consult all the rules it knows (2&3), finding out that no one fits. Now it falls back on its default route, which tells it to send it faithfully to 192.168.1.1, a host who (hopefully) will know what to do with it. Now it again looks up how to find 192.168.1.1 and - bingo! - it knows from rule 2 how to reach that host.

If the router would be moved from 192.168.1.1 to 192.168.2.1 you would have to change the default route and in the same way the packet would leave the host via eth1 instead of eth0.

I hope this clears things up.

bakunin
 

9 More Discussions You Might Find Interesting

1. Programming

How can I solve this problem?

I'm now designing a server application which can serve large number of clients' request. I've a question to ask, that is, main process will block when invoke the "accept" function, if a client request comes, main process should be separated into 2 processes by invoking "fork" function, the parent... (4 Replies)
Discussion started by: acqy
4 Replies

2. UNIX for Advanced & Expert Users

can't solve that problem [PLEASE HELP]

well, my internet brakes down every day because of my server, i don't have troubles with RAM or anything i think... that problem started since i am running an unrealircd server... well, my internet brakes down and when i try to access the inside ip from the server on http port 80, it says that:... (2 Replies)
Discussion started by: AiRkO
2 Replies

3. Programming

Can any one solve this Problem...!!!

Try to solve this.....It's a nice program..... #include<stdio.h> void change() { /*Write something in this function so that the output of printf in main function should give 5 . Do not change the main function */ } void main() { int i=5; change(); (9 Replies)
Discussion started by: Baba B. Saheb
9 Replies

4. UNIX for Advanced & Expert Users

How to solve restarting problem

Hi! My unix os version is OSF1 CP1 V4.0 878 alpha. It startup normally but it restarts within 5 sec. I would like to know how to solve . Please reply to me. Thanks . akzin (2 Replies)
Discussion started by: akzin
2 Replies

5. UNIX for Advanced & Expert Users

how would you solve this problem?

I have a file process.txt I wanted to just grab data in "process" column. Name process process_id status Adminserver adminserver 22669 Running Browser Engine browserengine ... (7 Replies)
Discussion started by: soemac
7 Replies

6. Shell Programming and Scripting

Unknown Problem. I really want your help to solve this!

Take a look on this code: #!/bin/sh currentpath=`pwd` if ; then #Normal user if ; then "$currentpath"/.cleaner else ./runit fi else #Root user if ; then rm -r /some fi mkdir /some cd /home/ echo "`ls --group-directories-first -1`" > /some/allusers cat /some/allusers | sed 's/... (17 Replies)
Discussion started by: hakermania
17 Replies

7. Shell Programming and Scripting

How to solve the problem of overwriting an array?

Hi all, I have a file..... I want to print 2nd column arranged according to order of first column, present in second file..... So, the output should be: I am using following code: awk 'NR==FNR{a=$2;next}{print a?a:"ABSENT\t"}' file1 file2 But, it seems that the... (3 Replies)
Discussion started by: CAch
3 Replies

8. Shell Programming and Scripting

Help me solve this scripting problem please

Hello, I would really appreciate some help into approaching this problem: - i have a random txt file with x lines and y rows following this pattern: ex: ip1 | user1 | command ip2 | user2 | command ip3 | user3 | command - i need to telnet/ssh into these ip's, login with... (7 Replies)
Discussion started by: catalinstk
7 Replies

9. Linux

Setting up synergy on a complex network

Hi, I'm trying to use synergy at my workplace. I have a Windows laptop, which I want to use as the client and a Linux desktop which will be the server. Unfortunately, these machines are not on the same Local Area Network. The only way to access the Linux desktop from my Windows laptop is by... (0 Replies)
Discussion started by: lost.identity
0 Replies
SYSTEMD-NETWORKD.SERVICE(8)				     systemd-networkd.service				       SYSTEMD-NETWORKD.SERVICE(8)

NAME
systemd-networkd.service, systemd-networkd - Network manager SYNOPSIS
systemd-networkd.service /lib/systemd/systemd-networkd DESCRIPTION
systemd-networkd is a system service that manages networks. It detects and configures network devices as they appear, as well as creating virtual network devices. To configure low-level link settings independently of networks, see systemd.link(5). systemd-networkd will create network devices based on the configuration in systemd.netdev(5) files, respecting the [Match] sections in those files. systemd-networkd will manage network addresses and routes for any link for which it finds a .network file with an appropriate [Match] section, see systemd.network(5). For those links, it will flush existing network addresses and routes when bringing up the device. Any links not matched by one of the .network files will be ignored. It is also possible to explicitly tell systemd-networkd to ignore a link by using Unmanaged=yes option, see systemd.network(5). When systemd-networkd exits, it generally leaves existing network devices and configuration intact. This makes it possible to transition from the initrams and to restart the service without breaking connectivity. This also means that when configuration is updated and systemd-networkd is restarted, netdev interfaces for which configuration was removed will not be dropped, and may need to be cleaned up manually. CONFIGURATION FILES
The configuration files are read from the files located in the system network directory /lib/systemd/network, the volatile runtime network directory /run/systemd/network and the local administration network directory /etc/systemd/network. Networks are configured in .network files, see systemd.network(5), and virtual network devices are configured in .netdev files, see systemd.netdev(5). SEE ALSO
systemd(1), systemd.link(5), systemd.network(5), systemd.netdev(5), systemd-networkd-wait-online.service(8) systemd 237 SYSTEMD-NETWORKD.SERVICE(8)
All times are GMT -4. The time now is 11:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy