route命令使用

来源:互联网 发布:sort数组排序 编辑:程序博客网 时间:2024/06/01 07:57

route命令可以用来管理Linux内核的路由表。

主要的两个修改操作是add和del,如果没有,则是查看路由表。

下面的命令没有任何参数,仅查看本地路由表:

dean@dean-ubuntu:~$ routeKernel IP routing tableDestination     Gateway         Genmask         Flags Metric Ref    Use Ifacedefault         bogon           0.0.0.0         UG    0      0        0 wlan0192.168.1.0     *               255.255.255.0   U     9      0        0 wlan0

default是之没有找到明确的Destination的时候使用的规则。

Genmask指的是Destination的netmask. 

netmask的用处参考文章:http://linux.vbird.org/problem/linux/problem_2.php

Flags的含义:

       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)


route add 指定的是去往目的地的网络包经过什么转发,dev选项用于指定网卡设备。


0 0
原创粉丝点击