免费注册 查看新帖 |

Chinaunix

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

[网络管理] ip route ? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-06-11 13:27 |只看该作者 |倒序浏览
谁有关于 ip route 和 route 两个命令 的资料或者能讲讲也行.

论坛徽章:
0
2 [报告]
发表于 2007-06-11 13:36 |只看该作者
肯定有人说 man ip , 我先抢沙发了

论坛徽章:
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
3 [报告]
发表于 2007-06-11 17:06 |只看该作者
既然有人说man ip 肯定也有人说man route
只不过是两种不同的途径。感觉用ip route设置更具体一些,更能更多一些。
譬如用ip route list能够看到多出口。而用route看不到。

论坛徽章:
0
4 [报告]
发表于 2007-06-11 19:55 |只看该作者
关于 route 命令,man 或者 info 都很容易找到
至于 ip 命令,man 和 info 都没有什么可帮助的(至少我用的 CentOS-3.8-server 是这样)
不过你可以通过 google 找到很全面的 iproute 的文档资料
keyword: IP命令手册

论坛徽章:
0
5 [报告]
发表于 2007-06-11 21:53 |只看该作者
不会吧
我man ip 的话,基本上还是能够获取很多有用的信息的

我的是debian(testing)

另外一个可能就是你都已经了解的man上说的那些

[ 本帖最后由 springwind426 于 2007-6-11 21:55 编辑 ]

论坛徽章:
0
6 [报告]
发表于 2007-06-11 21:56 |只看该作者
可能发行版不同,man 的信息也不同吧?这是我的……

  1. ip(8)                               iproute                              ip(8)

  2. NAME
  3.        ip - TCP/IP interface configuration and routing utility

  4. SYNTAX
  5.        ip

  6. DESCRIPTION
  7.        This utility allows you to configure your network interfaces in various
  8.        ways.

  9. OPTIONS
  10.        For the complete command reference please look at the  following  docu-
  11.        ment:
  12.        /usr/share/doc/iproute-2.4.7/ip-cref.ps

  13. SEE ALSO
  14.        ifconfig(8), route(8), netstat(8), arp(8), rarp(8), ipchains(8)

  15. AUTHORS
  16.        Alexey Kuznetsov <[email]kuznet@ms2.inr.ac.ru[/email]>

  17. Alexey Kuznetsov                     2.4.7                               ip(8)
  18. (END)
复制代码

论坛徽章:
0
7 [报告]
发表于 2007-06-11 22:04 |只看该作者
另外问个比较弱的问题,linux 下怎么看 ps 文件

http://linux.chinaunix.net/bbs/viewthread.php?tid=326032
这里说用 gs 看,我的系统没有,你们又是怎么看的呢?

论坛徽章:
0
8 [报告]
发表于 2007-06-12 11:02 |只看该作者
man ip 是会有很详细的说明

执行 ip -V 查看版本   
ip utility, iproute2-ss040831

感觉用ip 查看路由 比用 route 查看更直观些 ,而且以前也有说 iproute2  是 route 的下一代产品

论坛徽章:
0
9 [报告]
发表于 2007-06-12 11:18 |只看该作者
原帖由 5iwww 于 2007-6-12 11:02 发表于 8楼  
man ip 是会有很详细的说明

未必,你看我前面贴的信息了吗?

论坛徽章:
0
10 [报告]
发表于 2007-06-12 11:40 |只看该作者
ip route - routing table management
       Manipulate route entries in the kernel routing tables keep information about paths to other networked nodes.

       Route types:

               unicast - the route entry describes real paths to the destinations covered by the route prefix.

               unreachable  - these destinations are unreachable.  Packets are discarded and the ICMP message host unreachable is
               generated.  The local senders get an EHOSTUNREACH error.

               blackhole - these destinations are unreachable.  Packets are discarded silently.  The local senders get an  EINVAL
               error.

               prohibit  - these destinations are unreachable.  Packets are discarded and the ICMP message communication adminis-
               tratively prohibited is generated.  The local senders get an EACCES error.

               local - the destinations are assigned to this host.  The packets are looped back and delivered locally.

               broadcast - the destinations are broadcast addresses.  The packets are sent as link broadcasts.

               throw - a special control route used together with policy rules. If such a route is selected, lookup in this table
               is  terminated  pretending that no route was found.  Without policy routing it is equivalent to the absence of the
               route in the routing table.  The packets are dropped and the ICMP message net unreachable is generated.  The local
               senders get an ENETUNREACH error.

               nat  - a special NAT route.  Destinations covered by the prefix are considered to be dummy (or external) addresses
               which require translation to real (or internal) ones  before  forwarding.   The  addresses  to  translate  to  are
               selected with the attribute via.

               anycast  -  not implemented the destinations are anycast addresses assigned to this host.  They are mainly equiva-
               lent to local with one difference: such addresses are invalid when used as the source address of any packet.

               multicast - a special type used for multicast routing.  It is not present in normal routing tables.

       Route tables: Linux-2.x can pack routes into several routing tables identified by a number in the range from 1 to  255  or
       by  name  from  the  file /etc/iproute2/rt_tables main table (ID 254) and the kernel only uses this table when calculating
       routes.

       Actually, one other table always exists, which is invisible but even more important.  It is  the  local  table  (ID  255).
       This  table  consists  of routes for local and broadcast addresses.  The kernel maintains this table automatically and the
       administrator usually need not modify it or even look at it.

       The multiple routing tables enter the game when policy routing is used.

   ip route add - add new route
   ip route change - change route
   ip route replace - change or add new one
       to TYPE PREFIX (default)
              the destination prefix of the route.  If TYPE is omitted, ip assumes type unicast.  Other values of TYPE are listed
              above.  PREFIX is an IP or IPv6 address optionally followed by a slash and the prefix length.  If the length of the
              prefix is missing, ip assumes a full-length host route.  There is also a special PREFIX default - which is  equiva-
              lent to IP 0/0 or to IPv6 ::/0.

       tos TOS

       dsfield TOS
              the Type Of Service (TOS) key.  This key has no associated mask and the longest match is understood as: First, com-
              pare the TOS of the route and of the packet.  If they are not equal, then the packet may still match a route with a
              zero TOS.  TOS is either an 8 bit hexadecimal number or an identifier from /etc/iproute2/rt_dsfield.

       metric NUMBER

       preference NUMBER
              the preference value of the route.  NUMBER is an arbitrary 32bit number.

       table TABLEID
              the  table  to  add  this route to.  TABLEID may be a number or a string from the file /etc/iproute2/rt_tables.  If
              this parameter is omitted, ip assumes the main table, with the exception of local , broadcast and nat routes, which
              are put into the local table by default.

       dev NAME
              the output device name.

       via ADDRESS
              the  address  of the nexthop router.  Actually, the sense of this field depends on the route type.  For normal uni-
              cast routes it is either the true next hop router or, if it is a direct route installed in BSD compatibility  mode,
              it  can  be a local address of the interface.  For NAT routes it is the first address of the block of translated IP
              destinations.

       src ADDRESS
              the source address to prefer when sending to the destinations covered by the route prefix.

       realm REALMID
              the  realm  to  which  this  route  is  assigned.   REALMID  may  be  a  number  or  a   string   from   the   file
              /etc/iproute2/rt_realms.

       mtu MTU

       mtu lock MTU
              the  MTU along the path to the destination.  If the modifier lock is not used, the MTU may be updated by the kernel
              due to Path MTU Discovery.  If the modifier lock is used, no path MTU discovery will be tried, all packets will  be
              sent without the DF bit in IPv4 case or fragmented to MTU for IPv6.

       window NUMBER
              the  maximal  window  for TCP to advertise to these destinations, measured in bytes.  It limits maximal data bursts
              that our TCP peers are allowed to send to us.

       rtt NUMBER
              the initial RTT ('Round Trip Time') estimate.

       rttvar NUMBER (2.3.15+ only)
              the initial RTT variance estimate.

       ssthresh NUMBER (2.3.15+ only)
              an estimate for the initial slow start threshold.

       cwnd NUMBER (2.3.15+ only)
              the clamp for congestion window.  It is ignored if the lock flag is not used.

       advmss NUMBER (2.3.15+ only)
              the MSS ('Maximal Segment Size') to advertise to these destinations when establishing TCP connections.   If  it  is
              not  given, Linux uses a default value calculated from the first hop device MTU.  (If the path to these destination
              is asymmetric, this guess may be wrong.)

       reordering NUMBER (2.3.15+ only)
              Maximal reordering on the path to this destination.  If it is not given, Linux uses the value selected with  sysctl
              variable net/ipv4/tcp_reordering.

       nexthop NEXTHOP
              the nexthop of a multipath route.  NEXTHOP is a complex value with its own syntax similar to the top level argument
              lists:

                      via ADDRESS - is the nexthop router.

                      dev NAME - is the output device.

                      weight NUMBER - is a weight for this element of a multipath route  reflecting  its  relative  bandwidth  or
                      quality.

       scope SCOPE_VAL
              the  scope  of  the  destinations covered by the route prefix.  SCOPE_VAL may be a number or a string from the file
              /etc/iproute2/rt_scopes.  If this parameter is omitted, ip assumes scope global for all gatewayed  unicast  routes,
              scope link for direct unicast and broadcast routes and scope host for local routes.

       protocol RTPROTO
              the   routing  protocol  identifier  of  this  route.   RTPROTO  may  be  a  number  or  a  string  from  the  file
              /etc/iproute2/rt_protos.  If the routing protocol ID is not given, ip assumes protocol boot (i.e.  it  assumes  the
              route  was  added  by  someone  who  doesn't understand what they are doing).  Several protocol values have a fixed
              interpretation.  Namely:

                      redirect - the route was installed due to an ICMP redirect.

                      kernel - the route was installed by the kernel during autoconfiguration.

                      boot - the route was installed during the bootup sequence.  If a routing daemon starts, it will  purge  all
                      of them.

                      static  -  the  route  was  installed by the administrator to override dynamic routing. Routing daemon will
                      respect them and, probably, even advertise them to its peers.

                      ra - the route was installed by Router Discovery protocol.

              The rest of the values are not reserved and the administrator is free to assign (or not to assign) protocol tags.

       onlink pretend that the nexthop is directly attached to this link, even if it does not match any interface prefix.

       equalize
              allow packet by packet randomization on multipath routes.  Without this modifier, the route will be frozen  to  one
              selected  nexthop,  so  that load splitting will only occur on per-flow base.  equalize only works if the kernel is
              patched.

   ip route delete - delete route
       ip route del has the same arguments as ip route add, but their semantics are a bit different.

       Key values (to, tos, preference and table) select the route to delete.  If optional attributes are  present,  ip  verifies
       that  they  coincide with the attributes of the route to delete.  If no route with the given key and attributes was found,
       ip route del fails.

   ip route show - list routes
       the command displays the contents of the routing tables or the route(s) selected by some criteria.

       to SELECTOR (default)
              only select routes from the given range of destinations.  SELECTOR consists of an optional modifier (root, match or
              exact) and a prefix.  root PREFIX selects routes with prefixes not shorter than PREFIX.  F.e.  root 0/0 selects the
              entire routing table.  match PREFIX selects routes with prefixes not  longer  than  PREFIX.   F.e.   match  10.0/16
              selects  10.0/16,  10/8  and  0/0, but it does not select 10.1/16 and 10.0.0/24.  And exact PREFIX (or just PREFIX)
              selects routes with this exact prefix. If neither of these options are present, ip assumes root 0/0 i.e.  it  lists
              the entire table.

       tos TOS
              dsfield TOS only select routes with the given TOS.

       table TABLEID
              show  the  routes from this table(s).  The default setting is to show tablemain.  TABLEID may either be the ID of a
              real table or one of the special values:

                      all - list all of the tables.

                      cache - dump the routing cache.

       cloned

       cached list cloned routes i.e. routes which were dynamically forked from other routes because some route  attribute  (f.e.
              MTU) was updated.  Actually, it is equivalent to table cache.

       from SELECTOR
              the  same  syntax  as  for  to, but it binds the source address range rather than destinations.  Note that the from
              option only works with cloned routes.

       protocol RTPROTO
              only list routes of this protocol.

       scope SCOPE_VAL
              only list routes with this scope.

       type TYPE
              only list routes of this type.

       dev NAME
              only list routes going via this device.

       via PREFIX
              only list routes going via the nexthop routers selected by PREFIX.

       src PREFIX
              only list routes with preferred source addresses selected by PREFIX.

       realm REALMID

       realms FROMREALM/TOREALM
              only list routes with these realms.

   ip route flush - flush routing tables
       this command flushes routes selected by some criteria.

       The arguments have the same syntax and semantics as the arguments of ip route show, but routing tables are not listed  but
       purged.   The  only difference is the default action: show dumps all the IP main routing table but flush prints the helper
       page.

       With the -statistics option, the command becomes verbose. It prints out the number of deleted routes  and  the  number  of
       rounds  made to flush the routing table. If the option is given twice, ip route flush also dumps all the deleted routes in
       the format described in the previous subsection.

   ip route get - get a single route
       this command gets a single route to a destination and prints its contents exactly as the kernel sees it.

       to ADDRESS (default)
              the destination address.

       from ADDRESS
              the source address.

       tos TOS

       dsfield TOS
              the Type Of Service.

       iif NAME
              the device from which this packet is expected to arrive.

       oif NAME
              force the output device on which this packet will be routed.

       connected
              if no source address (option from) was given, relookup the route with the  source  set  to  the  preferred  address
              received from the first lookup.  If policy routing is used, it may be a different route.

       Note  that  this operation is not equivalent to ip route show.  show shows existing routes.  get resolves them and creates
       new clones if necessary.  Essentially, get is equivalent to sending a packet along this path.  If the iif argument is  not
       given,  the kernel creates a route to output packets towards the requested destination.  This is equivalent to pinging the
       destination with a subsequent ip route ls cache, however, no packets are actually sent.  With the iif argument, the kernel
       pretends that a packet arrived from this interface and searches for a path to forward the packet.


我觉得够详细的了  或者版主 你用 man 8 ip 看看
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP