免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 5179 | 回复: 18
打印 上一主题 下一主题

求高手帮助,路由问题,急!!! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-12-14 00:55 |只看该作者 |倒序浏览
最近碰到客户的问题,大概描述如下:
local server(我们的设备,OS是solaris 10) 配了2个ip: 192.168.109.241/30 和 192.168.109.245/30
remote server 也有2个ip: 163.162.130.8/28 和163.162.130.23/28
现在local server的2个ip分别直连到Router1的VLAN1,192.168.109.242/30和Router2的VLAN2,192.168.109.246/30,然后Router1和Router2会把路由指向remote server的2个ip. Router1和Router2可以互通。
local server的路由表(netstat -nr)如下:

Routing Table: IPv4
Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ---------- ---------
default                        163.162.126.193      UG     1     4403
163.162.126.192        163.162.126.214      U       1     4317 e1000g0
163.162.130.0            192.168.109.242      UG     1     3
163.162.130.16          192.168.109.246      UG     1     2
192.168.0.0                192.168.0.31            U       1     6328 e1000g1:1
192.168.0.0                192.168.0.31            U       1     0       e1000g1
192.168.0.0                192.168.0.31            U       1     4125 nxge1
192.168.109.240        192.168.109.241      U       1     1       nxge2
192.168.109.244        192.168.109.245      U       1     10     e1000g2
224.0.0.0                    163.162.126.214      U       1     0       e1000g0
127.0.0.1                    127.0.0.1                  UH     221 24374 lo0

现在的路由形成了2个通路:
192.168.109.241<->192.168.109.242<->163.162.130.8
192.168.109.245<->192.168.109.246<->163.162.130.23

目前的问题是:
客户需要实现如下功能:
当同时shutdown 192.168.109.241和163.162.130.23时,需要192.168.109.245和163.162.130.8仍然能够互通。
当同时shutdown 192.168.109.245和163.162.130.8时,需要192.168.109.241和163.162.130.23仍然能够互通。

但是当shutdown 192.168.109.241时,192.168.109.242就没有路由(因为192.168.109.240        192.168.109.241      U       1     1       nxge2 被删掉了),所以163.162.130.8无法ping通(因为163.162.130.0            192.168.109.242      UG     1     3 需要通过192.168.109.242)。
反之,当shutdown 192.168.109.245时,163.162.130.23也无法ping通。

请哪位高手指点一下,这种情况应该怎么解决,最好不要用动态路由。
多谢了。

论坛徽章:
5
IT运维版块每日发帖之星
日期:2015-08-06 06:20:00IT运维版块每日发帖之星
日期:2015-08-10 06:20:00IT运维版块每日发帖之星
日期:2015-08-23 06:20:00IT运维版块每日发帖之星
日期:2015-08-24 06:20:00IT运维版块每日发帖之星
日期:2015-11-12 06:20:00
2 [报告]
发表于 2010-12-14 09:47 |只看该作者
solaris加路由的命令MAN 我看下。

论坛徽章:
0
3 [报告]
发表于 2010-12-14 18:06 |只看该作者
Is it OK for you?

System Administration Commands                          route(1M)

NAME
     route - manually manipulate the routing tables

SYNOPSIS
     route [-fnvq] sub-command [ [modifiers] args]

     route [-fnvq] [-p [-R root-dir]] add | delete [modifiers] destination gateway
          [args]

     route [-fnvq] change | get [modifiers] destination
          [gateway [args]]

     route [-fn] monitor [modifiers]

     route [-fnvq] flush [modifiers]

     route -p [-R root-dir] show

DESCRIPTION
     route manually manipulates the network routing tables. These
     tables are normally maintained by the system routing daemon,
     such as in.routed(1M) and in.ripngd(1M).

     route supports a limited number of general  options,  but  a
     rich  command  language.  Users  can  specify  an  arbitrary
     request that can be delivered by means of  the  programmatic
     interface discussed in route(7P).

     route uses a  routing  socket  and  the  new  message  types
     RTM_ADD,  RTM_DELETE,  RTM_GET,  and  RTM_CHANGE. While only
     superusers can modify routing tables, the RTM_GET  operation
     is allowed for non-privileged users.

OPTIONS
     -f             Flush  the  routing  tables  of  all  gateway
                    entries. If you use the -f option in conjunc-
                    tion with  any  of  the  route  sub-commands,
                    route  flushes the gateways before performing
                    the sub-command. Specify the table  to  flush
                    by placing the inet or inet6 modifier immedi-
                    ately after the -f  option.  If  unspecified,
                    flushing IPv4 (inet) routes is the default.

SunOS 5.10           Last change: 3 Feb 2009                    1

System Administration Commands                          route(1M)

     -n             Prevent attempts to print  host  and  network
                    names  symbolically  when  reporting actions.
                    This option is useful when name  servers  are
                    unavailable.

     -p             Make changes to the network route tables per-
                    sistent across system restarts. The operation
                    is applied  to  the  network  routing  tables
                    first  and, if successful, is then applied to
                    the list  of  saved  routes  used  at  system
                    startup.  In determining whether an operation
                    was successful, a failure to add a route that
                    already  exists  or to delete a route that is
                    not in the routing table is ignored. Particu-
                    lar  care  should be taken when using host or
                    network  names  in  persistent   routes,   as
                    network-based  name  resolution  services are
                    not available at the time routes are added at
                    startup.

     -q             Suppress all output.

     -R root-dir    Specify an  alternate  root  directory  where
                    route applies changes. This option is ignored
                    unless  used  in  conjunction  with  the   -p
                    option.  When  -R is specified, route changes
                    are applied only to the list of saved  routes
                    to  be  used  at  startup, not to the network
                    routing tables. In addition, certain  checks,
                    such  as  the existance of network interfaces
                    used with -ifp, are skipped. This can be use-
                    ful  from within JumpStart scripts, where the
                    root directory of the system  being  modified
                    is in a location other than /.

     -v             Print additional details in verbose mode.

  Subcommands
     The following subcommands are supported:

     add        Add a route.

     change     Change aspects of a route (such as its gateway).

SunOS 5.10           Last change: 3 Feb 2009                    2

System Administration Commands                          route(1M)

     delete     Delete a specific route.

     flush      Remove  all  gateway  entries  from  the  routing
                table.

     get        Look up and display the route for a destination.

     monitor    Continuously report any changes  to  the  routing
                information   base,  routing  lookup  misses,  or
                suspected network partitionings.

     show       Display the list of routes to be applied at  sys-
                tem startup. Can be used only in conjunction with
                the -p option.

     The add and delete sub-commands have the following syntax:

       route [ -fnvq ] cmd destination gateway [metric/netmask]

     where cmd is add or delete, destination is  the  destination
     host  or  network,  and gateway is the next-hop intermediary
     through which packets should be routed. Modifiers  described
     in OPERANDS can be placed anywhere on the command line.

     The get and change sub-commands have the following syntax:

       route [ -fnvq ] cmd destination [gateway [metric/netmask]]

     where cmd is get or change, destination is  the  destination
     host  or  network,  and gateway is the next-hop intermediary
     through which packets should be routed. Modifiers  described
     in OPERANDS can be placed anywhere on the command line.

     The monitor sub-command has the following syntax:

       route monitor [ -inet | -inet6 ]

SunOS 5.10           Last change: 3 Feb 2009                    3

System Administration Commands                          route(1M)

OPERANDS
     route executes its sub-commands on routes to destinations by
     way of gateways.

  Destinations and Gateways
     By default, destination and  gateway  addresses  are  inter-
     preted as IPv4 addresses. All symbolic names are tried first
     as a host  name,  using  getipnodebyname(3SOCKET).  If  this
     lookup  fails  in  the  AF_INET  case, getnetbyname(3SOCKET)
     interprets the name as that of a network.

     Including an optional modifier on the  command  line  before
     the address changes how the route sub-command interprets it.

     The following modifiers are supported:

     -inet     Force the address to be  interpreted  as  an  IPv4
               address,  that  is, under the AF_INET address fam-
               ily.

     -inet6    Force the address to be  interpreted  as  an  IPv6
               address,  that is, under the AF_INET6 address fam-
               ily.

     For IPv4 addresses, routes  to  a  particular  host  are  by
     default  distinguished from those to a network by interpret-
     ing the Internet address specified as  the  destination.  If
     the  destination has a local address part (that is, the por-
     tion not covered by the netmask) of 0, or if the destination
     is  resolved  as  the  symbolic  name of a network, then the
     route is assumed to  be  to  a  network;  otherwise,  it  is
     presumed to be a route to a host.

     You can force this selection by using one of  the  following
     modifiers:

     -host    Force the destination to be interpreted as a host.

     -net     Force the destination to be interpreted as  a  net-
              work.

     For example:

SunOS 5.10           Last change: 3 Feb 2009                    4

System Administration Commands                          route(1M)

             Destination              Destination Equivalent
     __________________________________________________________
     128.32                        -host 128.0.0.32
     128.32.130                    -host 128.32.0.130
     -net 128.32                   128.32.0.0
     -net 128.32.130               128.32.130.0

     Two modifiers avoid confusion between addresses and keywords
     (for  example.,  host used as a symbolic host name). You can
     distinguish a destination by  preceding  it  with  the  -dst
     modifier. You can distinguish a gateway address by using the
     -gateway modifier. If the destination is directly  reachable
     by  way  of an interface requiring no intermediary IP router
     to act as a gateway, this can  be  indicated  by  using  the
     -interface or -iface modifier.

     In the following example, the route does  not  refer  to  an
     external   gateway  (router),  but  rather  to  one  of  the
     machine's interfaces. Packets with IP destination  addresses
     matching  the  destination and mask on such a route are sent
     out on the interface identified by the gateway address.  For
     interfaces  using  the  ARP  protocol, this type of route is
     used to specify that all matching destinations are local  to
     the  physical  link.  That is, a host could be configured to
     ARP for all addresses,  without  regard  to  the  configured
     interface netmask, by adding a default route using this com-
     mand. For example:

       example# route add default hostname -interface

     where gateway address hostname is the  name  or  IP  address
     associated  with the network interface over which all match-
     ing packets should be sent. On a host with a single  network
     interface,  hostname  is  usually  the  same as the nodename
     returned by the uname -n command. See uname(1).

     For backward  compatibility  with  older  systems,  directly
     reachable  routes can also be specified by placing a 0 after
     the gateway address:

       example# route add default hostname 0

SunOS 5.10           Last change: 3 Feb 2009                    5

System Administration Commands                          route(1M)

     This value was once a route metric, but this  metric  is  no
     longer used. If the value is specified as 0, then the desti-
     nation  is  directly  reachable  (equivalent  to  specifying
     -interface).  If it is non-zero but cannot be interpreted as
     a subnet mask, then a gateway is used (default).

     With the AF_INET  address  family  or  an  IPv4  address,  a
     separate subnet mask can be specified. This can be specified
     in one of the following ways:

         o    IP address following the gateway address . This  is
              typically  specified in decimal dot notation as for
              inet_addr(3SOCKET) rather than in symbollic form.

         o    IP address following the -netmask qualifier.

         o    Slash character and a decimal  length  appended  to
              the destination address.

     If a subnet mask is not specified, the mask used is the sub-
     net  mask  of  the  output interface selected by the gateway
     address, if the classful network of the destination  is  the
     same  as  the  classful network of the interface. Otherwise,
     the classful network mask for  the  destination  address  is
     used.

     Each of the following examples creates an IPv4 route to  the
     destination   192.0.2.32   subnet  with  a  subnet  mask  of
     255.255.255.224:

       example# route add 192.0.2.32/27 somegateway
       example# route add 192.0.2.32 -netmask 255.255.255.224 somegateway
       example# route add 192.0.2.32 somegateway 255.255.255.224

     For IPv6, only the slash format is accepted.  The  following
     example creates an IPv6 route to the destination 33fe:: with
     a netmask of 16 one-bits followed by 112 zero-bits.

       example# route add -inet6 3ffe::/16 somegateway

     In cases where the gateway does not  uniquely  identify  the
     output  interface (for example, when several interfaces have
     the same address), you can use the -ifp ifname  modifier  to

SunOS 5.10           Last change: 3 Feb 2009                    6

System Administration Commands                          route(1M)

     specify the interface by name. For example, -ifp lo0 associ-
     ates the route with the lo0 interface.

  Routing Flags
     Routes have associated flags that influence operation of the
     protocols  when  sending  to  destinations  matched  by  the
     routes. These flags can be set (and in some  cases  cleared,
     indicated  by ~) by including the following modifiers on the
     command line:

       Modifier          Flag                     Description
     ______________________________________________________________________
     -interface      ~RTF_GATEWAY    Destination is directly reachable
     -iface          ~RTF_GATEWAY    Alias for interface modifier
     -static         RTF_STATIC      Manually added route
     -nostatic       ~RTF_STATIC     Pretend route was added by  kernel  or
                                     routing daemon
     -reject         RTF_REJECT      Emit an ICMP unreachable when matched
     -blackhole      RTF_BLACKHOLE   Silently discard packets duing updates
     -proto1         RTF_PROTO1      Set protocol specific routing flag #1
     -proto2         RTF_PROTO2      Set protocol specific routing flag #2
     -private        RTF_PRIVATE     Do not advertise this route
     -multirt        RTF_MULTIRT     Creates the specified redundant route
     -setsrc         RTF_SETSRC      Assigns the default source address

     The optional modifiers -rtt, -rttvar, -sendpipe,  -recvpipe,
     -mtu,  -hopcount,  -expire,  and  -ssthresh  provide initial
     values to quantities maintained  in  the  routing  entry  by
     transport level protocols, such as TCP. These can be indivi-
     dually locked either by preceding each modifier to be locked
     by  the -lock meta-modifier, or by specifying that all ensu-
     ing metrics can be locked by the -lockrest meta-modifier.

     Some transport layer protocols  can  support  only  some  of
     these  metrics.  The  following  optional modifiers are sup-
     ported:

     -expire      Lifetime for the entry. This optional  modifier
                  is not currently supported.

     -hopcount    Maximum hop count. This  optional  modifier  is
                  not currently supported.

     -mtu         Maximum MTU in bytes.

SunOS 5.10           Last change: 3 Feb 2009                    7

System Administration Commands                          route(1M)

     -recvpipe    Receive pipe size in bytes.

     -rtt         Round trip time in microseconds.

     -rttvar      Round trip time variance in microseconds.

     -sendpipe    Send pipe size in bytes.

     -ssthresh    Send pipe size threshold in bytes.

     -secattr     Security attributes of the route. This modifier
                  is  available  only if the system is configured
                  with the Solaris Trusted Extensions feature.

                  The -secattr modifier has the following format:

                    min_sl=val,max_sl=val,doi=val,cipso

                  or:

                    sl=VAL,doi=VAL,cipso

                  In the first form, above, the  val  for  min_sl
                  and max_sl is a sensitivity label in either hex
                  or string form. The  val  for  doi  is  a  non-
                  negative integer. The route will apply only for
                  packets with the same domain of  interpretation
                  as  defined  by  the  doi  value and within the
                  accreditation range defined by the  min_sl  and
                  max_sl  values.  The  cipso keyword is optional
                  and set by default. Valid  min_sl,  max_sl  and
                  doi  keyword/value  pairs  are  mandatory. Note
                  that if val contains a space, it must  be  pro-
                  tected by double quotes.

                  The second form, above, is equivalent to speci-
                  fying  the  first  form  with  the same VAL for
                  min_sl and max_sl. The second  form  should  be
                  used for the get command, because get uses only
                  a single sensitivity label.

  Compatibility
     The modifiers host and net are taken  to  be  equivalent  to
     -host  and  -net. To specify a symbolic address that matches
     one of these names, use the dst or gateway keyword  to  dis-
     tinguish it. For example: -dst host

SunOS 5.10           Last change: 3 Feb 2009                    8

System Administration Commands                          route(1M)

     The following two flags are also accepted for  compatibility
     with older systems, but have no effect.

               Modifier                        Flag
     __________________________________________________________
     -cloning                       RTF_CLONING
     -xresolve                      RTF_XRESOLVE

     The -ifa hostname modifier is  also  accepted,  but  has  no
     effect.

FILES
     /etc/defaultrouter    List of default routers

     /etc/hosts            List of host names and net addresses

     /etc/networks         List of network names and addresses

ATTRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:

     ____________________________________________________________
    |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
    |_____________________________|_____________________________|
    | Availability                | SUNWcsu                     |
    |_____________________________|_____________________________|

SEE ALSO
     uname(1),   in.ripngd(1M),    in.routed(1M),    netstat(1M),
     routed(1M),        ioctl(2),       getipnodebyname(3SOCKET),
     getnetbyname(3SOCKET), inet_addr(3SOCKET), defaultrouter(4),
     hosts(4),   networks(4),   attributes(5),  ARP(7P),  ip(7P),
     route(7P), routing(7P)

DIAGNOSTICS
     add [ host| network] destination:gateway flags

         The specified route is being added to  the  tables.  The
         values printed are from the routing table entry supplied
         in the ioctl(2) call. If the gateway  address  used  was
         not  the  primary  address of the gateway (the first one

SunOS 5.10           Last change: 3 Feb 2009                    9

System Administration Commands                          route(1M)

         returned  by   getipnodebyname(3SOCKET))   the   gateway
         address is printed numerically as well as symbolically.

     delete [ host| network] destination:gateway flags
     change [ host| network] destination:gateway flags

         As add, but when deleting or changing an entry.

     destination done

         When the -f flag is specified, or the flush  sub-command
         is  used,  each routing table entry deleted is indicated
         with a message of this form.

     Network is unreachable

         An attempt to add a route  failed  because  the  gateway
         listed was not on a directly-connected network. Give the
         next-hop gateway instead.

     not in table

         A delete operation was attempted for an  entry  that  is
         not in the table.

     entry exists

         An add operation was attempted for a route that  already
         exists in the kernel.

     routing table overflow

         An operation was attempted, but the system was unable to
         allocate memory to create the new entry.

     insufficient privileges

         An attempt to add, delete,  change,  or  flush  a  route
         failed   because  the  calling  process  does  not  have
         appropriate privileges.

论坛徽章:
5
IT运维版块每日发帖之星
日期:2015-08-06 06:20:00IT运维版块每日发帖之星
日期:2015-08-10 06:20:00IT运维版块每日发帖之星
日期:2015-08-23 06:20:00IT运维版块每日发帖之星
日期:2015-08-24 06:20:00IT运维版块每日发帖之星
日期:2015-11-12 06:20:00
4 [报告]
发表于 2010-12-15 12:22 |只看该作者
针对一个目的地址设置2条不同下一跳的路由,但是度量值不一样,这样当度量值小的哪一个失效后度量值大的那个就生效了。

思路是这样的但是我没有测试过。用路由器来做就是这个方法了。要不就跑动态路由协议,但是要实现你的分流也有难度。

论坛徽章:
5
IT运维版块每日发帖之星
日期:2015-08-06 06:20:00IT运维版块每日发帖之星
日期:2015-08-10 06:20:00IT运维版块每日发帖之星
日期:2015-08-23 06:20:00IT运维版块每日发帖之星
日期:2015-08-24 06:20:00IT运维版块每日发帖之星
日期:2015-11-12 06:20:00
5 [报告]
发表于 2010-12-15 12:22 |只看该作者
这个在路由器里叫做浮动静态路由或备份路由。

论坛徽章:
5
IT运维版块每日发帖之星
日期:2015-08-06 06:20:00IT运维版块每日发帖之星
日期:2015-08-10 06:20:00IT运维版块每日发帖之星
日期:2015-08-23 06:20:00IT运维版块每日发帖之星
日期:2015-08-24 06:20:00IT运维版块每日发帖之星
日期:2015-11-12 06:20:00
6 [报告]
发表于 2010-12-15 12:31 |只看该作者
route add -net 1.1.0.0/16 gw 9.9.8.1 metric 1 dev eth0

论坛徽章:
0
7 [报告]
发表于 2010-12-17 01:15 |只看该作者
其实浮动静态路由是试过的,但碰到了问题。比如:
163.162.130.0            192.168.109.242      UG     1     3
163.162.130.16          192.168.109.246      UG     1     2
163.162.130.0            192.168.109.246      UG     1     3
163.162.130.16          192.168.109.242      UG     1     2
192.168.109.240        192.168.109.241      U       1     1       nxge2
192.168.109.244        192.168.109.245      U       1     10     e1000g2
当shutdown了192.168.109.241后,路由“192.168.109.240        192.168.109.241      U       1     1       nxge2” 就自动删除了。但是“163.162.130.0            192.168.109.242      UG     1     3 ”和“163.162.130.16          192.168.109.242      UG     1     2”仍然存在,这样要发往163.162.130.23的包仍要试图走192.168.109.242,但其实已经没有到192.168.109.242的路由了,所以那些包都丢了。
不知道这算不算solaris的bug,其他操作系统(如linux)有这种问题吗?
路由器的操作系统应该没有这种问题吧?

论坛徽章:
0
8 [报告]
发表于 2010-12-21 01:51 |只看该作者
自己顶一下,还有没有其他建议啊,目前只能自己写一个脚本监控网口状态。

论坛徽章:
5
IT运维版块每日发帖之星
日期:2015-08-06 06:20:00IT运维版块每日发帖之星
日期:2015-08-10 06:20:00IT运维版块每日发帖之星
日期:2015-08-23 06:20:00IT运维版块每日发帖之星
日期:2015-08-24 06:20:00IT运维版块每日发帖之星
日期:2015-11-12 06:20:00
9 [报告]
发表于 2010-12-22 06:29 |只看该作者
哦。你的意思是说,接口DOWN掉了。从该接口出去的路由不消失是吗?

论坛徽章:
0
10 [报告]
发表于 2010-12-22 13:01 |只看该作者
是的,不知ifp有没有,下午我试一下
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP