Friday, May 14, 2010

Routing Tables

Definition:

A routing table is a file containing a human readable table structure
used by network routers which use TCP/IP.
This table is used to calculate the destinations of messages it is responsible for forwarding.
The table is a small in-memory database managed by the router's built-in hardware and software.

ROUTABLE

Static and Dynamic Routing tables:

Dynamic: Home routers set up their routing tables automatically when connected to the ISP, a process called dynamic routing.
For most of the residential network routers one cannot manually override or change the routing table.

Static: Business routers typically allow network administrators to manually update or manipulate routing tables.
This so-called static routing can be useful when optimizing for network performance and reliability.

Windows:

C:\>route print
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 18 de 2f d2 bf ...... Intel(R) PRO/Wireless 3945ABG Network Connection - McAfee NDIS Intermediate Filter Miniport
0x3 ...00 17 08 38 ac 51 ...... Broadcom NetXtreme Gigabit Ethernet #2 - McAfee NDIS Intermediate Filter Miniport
===========================================================================
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      16.181.44.1    16.181.47.27       20
      16.181.44.0    255.255.252.0     16.181.47.27    16.181.47.27       20
     16.181.47.27  255.255.255.255        127.0.0.1       127.0.0.1       20
   16.255.255.255  255.255.255.255     16.181.47.27    16.181.47.27       20
        127.0.0.0        255.0.0.0        127.0.0.1       127.0.0.1       1
        224.0.0.0        240.0.0.0     16.181.47.27    16.181.47.27       20
  255.255.255.255  255.255.255.255     16.181.47.27    16.181.47.27       1
  255.255.255.255  255.255.255.255     16.181.47.27               2       1
Default Gateway:       16.181.44.1
===========================================================================
Persistent Routes:
  None

C:\>netstat -r

Route Table
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 18 de 2f d2 bf ...... Intel(R) PRO/Wireless 3945ABG Network Connection - McAfee NDIS Intermediate Filter Miniport
0x3 ...00 17 08 38 ac 51 ...... Broadcom NetXtreme Gigabit Ethernet #2 - McAfee NDIS Intermediate Filter Miniport
===========================================================================
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      16.181.44.1    16.181.47.27       20
      16.181.44.0    255.255.252.0     16.181.47.27    16.181.47.27       20
     16.181.47.27  255.255.255.255        127.0.0.1       127.0.0.1       20
   16.255.255.255  255.255.255.255     16.181.47.27    16.181.47.27       20 0
        127.0.0.0        255.0.0.0        127.0.0.1       127.0.0.1       1
        224.0.0.0        240.0.0.0     16.181.47.27    16.181.47.27       20
  255.255.255.255  255.255.255.255     16.181.47.27    16.181.47.27       1
  255.255.255.255  255.255.255.255     16.181.47.27               2       1
Default Gateway:       16.181.44.1
===========================================================================
Persistent Routes:
  None

Linux

saptarshi@master:~$ netstat -r
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.10.0    *               255.255.255.0   U         0 0          0 eth1
localnet        *               255.255.252.0   U         0 0          0 eth2
link-local      *               255.255.0.0     U         0 0          0 eth2
default         192.168.10.1    0.0.0.0         UG        0 0          0 eth1
default         cup44lime-oae-g 0.0.0.0         UG        0 0          0 eth2

saptarshi@master:~$ cat /etc/iproute2/rt_tables
#
# reserved values
#
255     local
254     main
253     default
0       unspec
#
# local
#
#1      inr.ruhep

saptarshi@master:~$ ip route
192.168.10.0/24 dev eth1  proto kernel  scope link  src 192.168.10.10
15.244.28.0/22 dev eth2  proto kernel  scope link  src 15.244.29.48
169.254.0.0/16 dev eth2  scope link  metric 1000
default via 192.168.10.1 dev eth1  metric 100
default via 15.244.28.1 dev eth2  metric 100

saptarshi@master:~$ ip rule
0:      from all lookup local
32766:  from all lookup main
32767:  from all lookup default

[root@siebelweb1 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.10.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
0.0.0.0         192.168.10.10   0.0.0.0         UG    0      0        0 eth0

  • Flags : Possible flags include
    • U (route is up)
    • H (target is a host)
    • G (use gateway)
    • R (reinstate route for dynamic routing)
    • D (dynamically installed by daemon or redirect)
    • M (modified from routing daemon or redirect)
    • A (installed by addrconf)
    • C (cache entry)
    • ! (reject route)

    man ip

    IP(8)                                                               Linux                                                               IP(8)

    NAME
           ip - show / manipulate routing, devices, policy routing and tunnels

    SYNOPSIS
           ip [ OPTIONS ] OBJECT { COMMAND | help }

           OBJECT := { link | addr | route | rule | neigh | tunnel | maddr | mroute | monitor }

           OPTIONS := { -V[ersion] | -s[tatistics] | -r[esolve] | -f[amily] { inet | inet6 | ipx | dnet | link } | -o[neline] }

           ip link set DEVICE { up | down | arp { on | off } |
                   promisc { on | off } |
                   allmulti { on | off } |
                   dynamic { on | off } |
                   multicast { on | off } |
                   txqueuelen PACKETS |
                   name NEWNAME |
                   address LLADDR | broadcast LLADDR |
                   mtu MTU }

           ip link show [ DEVICE ]

           ip addr { add | del } IFADDR dev STRING

           ip addr { show | flush } [ dev STRING ] [ scope SCOPE-ID ] [ to PREFIX ] [ FLAG-LIST ] [ label PATTERN ]

           IFADDR := PREFIX | ADDR peer PREFIX [ broadcast ADDR ] [ anycast ADDR ] [ label STRING ] [ scope SCOPE-ID ]

           SCOPE-ID := [ host | link | global | NUMBER ]

           FLAG-LIST := [ FLAG-LIST ] FLAG

           FLAG := [ permanent | dynamic | secondary | primary | tentative | deprecated ]

           ip route { list | flush } SELECTOR

           ip route get ADDRESS [ from ADDRESS iif STRING  ] [ oif STRING ] [ tos TOS ]

           ip route { add | del | change | append | replace | monitor } ROUTE

           SELECTOR := [ root PREFIX ] [ match PREFIX ] [ exact PREFIX ] [ table TABLE_ID ] [ proto RTPROTO ] [ type TYPE ] [ scope SCOPE ]

           ROUTE := NODE_SPEC [ INFO_SPEC ]

           NODE_SPEC := [ TYPE ] PREFIX [ tos TOS ] [ table TABLE_ID ] [ proto RTPROTO ] [ scope SCOPE ] [ metric METRIC ]

           INFO_SPEC := NH OPTIONS FLAGS [ nexthop NH ] ...

           NH := [ via ADDRESS ] [ dev STRING ] [ weight NUMBER ] NHFLAGS

  • No comments:

    Post a Comment