Go to Google Groups Home    programming.lang.c++.sources

Alex Vinokur <ale...@users.sourceforge.net>

An attachment contains a message related to the thread titled
"Which entry of the routing table was selected?"
at
* http://groups.google.com/group/comp.protocols.tcp-ip/browse_frm/threa...
in
news:comp.protocols.tcp-ip
news:microsoft.public.win32.programmer.networks

 Alex Vinokur
     email: alex DOT vinokur AT gmail DOT com
     http://mathforum.org/library/view/10978.html
     http://sourceforge.net/users/alexvn

[ routing-table.txt 7K ]

We consider only applications that have to call bind() to specify the source address of an outgoing connection.

                      Part 1. Settings

                      Table 1.1. Routing table

=========================================================================== ==========
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric    Entry#
--------------------------------------------------------------------------- ----------
             A                B                C            D             E
--------------------------------------------------------------------------- ----------
          0.0.0.0          0.0.0.0      138.139.0.1  138.139.92.167       20    R1
         10.1.1.0    255.255.255.0       10.1.1.125      10.1.1.125       20    R2
       10.1.1.125  255.255.255.255        127.0.0.1       127.0.0.1       20    R3
   10.255.255.255  255.255.255.255       10.1.1.125      10.1.1.125       20    R4
        127.0.0.0        255.0.0.0        127.0.0.1       127.0.0.1       1     R5
      138.139.0.0      255.255.0.0   138.139.92.167  138.139.92.167       20    R6
   138.139.92.167  255.255.255.255        127.0.0.1       127.0.0.1       20    R7
  138.139.255.255  255.255.255.255   138.139.92.167  138.139.92.167       20    R8
        224.0.0.0        240.0.0.0       10.1.1.125      10.1.1.125       20    R9
        224.0.0.0        240.0.0.0   138.139.92.167  138.139.92.167       20    R10
  255.255.255.255  255.255.255.255       10.1.1.125      10.1.1.125       1     R11
  255.255.255.255  255.255.255.255   138.139.92.167  138.139.92.167       1     R12
Default Gateway:       138.139.0.1
=========================================================================== ==========
Persistent Routes:
  None

> ipconfig

Ethernet adapter Local Area Connection 2:

        Connection-specific DNS Suffix  . :

        IP Address. . . . . . . . . . . . : 10.1.1.125

        Subnet Mask . . . . . . . . . . . : 255.255.255.0

        Default Gateway . . . . . . . . . :

Ethernet adapter Local Area Connection:

        Connection-specific DNS Suffix  . : <name>

        IP Address. . . . . . . . . . . . : 138.139.92.167

        Subnet Mask . . . . . . . . . . . : 255.255.0.0

        Default Gateway . . . . . . . . . : 138.139.0.1

                      Part 2. Tests

                      Table 2.1. Messages sent and received using UDP sockets
=========================================================================== ==============
               ||                          Receiver
     Sender    ||------------------------------------------------------------------------
               || 138.139.92.167 : 10.1.1.125 : 127.0.0.1 | 138.18.198.178 | 10.1.1.1
--------------------------------------------------------------------------- --------------
      A        ||      B         :      C     :     D     |      E         |     F
--------------------------------------------------------------------------- --------------
138.139.92.167 || Received       : Received   : Received  | Received       | Received
10.1.1.125     || Received       : Received   : Received  | Received       | Received
127.0.0.1      || Received       : Received   : Received  | Not Received   | Not Received
=========================================================================== ==============

                      Table 2.2. Routing for Table 2.1
=========================================================================== =======================================
               |                 | Entries of routing table for the Receiver | Entry selected with longest prefix
               |                 | per Interface according to                | among Interfaces
               |                 | (Netmask && ReceiverIP) == DestinationIP  |------------------------------------
    Sender     |     Receiver    |-------------------------------------------| Interface equal to : Among
               |                 | 138.139.92.167 : 10.1.1.125 : 127.0.0.1   |      SourceIP      : all Interfaces  
--------------------------------------------------------------------------- ---------------------------------------
      A        |        B        |       C        :     D      :      E      |         F          :       G
--------------------------------------------------------------------------- ---------------------------------------
138.139.92.167 | 138.139.92.167  | R6, R1         :            : R7          | R6 (16 bits)       : R7 (32 bits)
               | 10.1.1.125      | R1             : R2         : R3          | R1 ( 0 bits)       : R3 (32 bits)
               | 127.0.0.1       | R1             :            : R5          | R1 ( 0 bits)       : R5 ( 8 bits)
               | 138.18.198.178  | R1             :            :             | R1 ( 0 bits)       : R1 ( 0 bits)
               | 10.1.1.1        | R1             : R2         :             | R1 ( 0 bits)       : R2 (24 bits)
---------------|-----------------|----------------:------------:----------- --|------------------------------------
10.1.1.125     | 138.139.92.167  | R6, R1         :            : R7          | -                  : R7 (32 bits)
               | 10.1.1.125      | R1             : R2         : R3          | R2 (24 bits)       : R3 (32 bits)
               | 127.0.0.1       | R1             :            : R5          | -                  : R5 ( 8 bits)
               | 138.18.198.178  | R1             :            :             | -                  : R1 ( 0 bits)
               | 10.1.1.1        | R1             : R2         :             | R2 (24 bits)       : R2 (24 bits)
---------------|-----------------|----------------:------------:----------- --|------------------------------------
127.0.0.1      | 138.139.92.167  | R6, R1         :            : R7          | R7 (32 bits)       : R7 (32 bits)
               | 10.1.1.125      | R1             : R2         : R3          | R3 (32 bits)       : R3 (32 bits)
               | 127.0.0.1       | R1             :            : R5          | R5 ( 8 bits)       : R5 ( 8 bits)
=========================================================================== =======================================

      Table 2.3. Question: What are routing table's entries selected for Table 2.1?
=========================================================================== ==============
               ||                          Receiver
     Sender    ||------------------------------------------------------------------------
               || 138.139.92.167 : 10.1.1.125 : 127.0.0.1 | 138.18.198.178 | 10.1.1.1
--------------------------------------------------------------------------- --------------
      A        ||      B         :      C     :     D     |      E         |     F
--------------------------------------------------------------------------- --------------
138.139.92.167 || R7 or R6?      : R3 or R1?  : R5 or R1? | R1             | R2 or R1?
10.1.1.125     || R7?            : R3 or R2?  : R5?       | R1?            | R2
127.0.0.1      || R7             : R3         : R5        | -              | -
=========================================================================== ==============

P.S. It seems that the "Interface" column of routing table doesn't matter (for applications calling bind()
to specify the source address of an outgoing connection)? Is it truth?