【route】管理本地路由信息

#route  直接使用可以查看本地路由表
route add -net|-host DEST gw NEXTHOP  //添加指定路由
route add default NEXTHOP //添加默认路由

参数:
【add】添加
-host:主机路由(到某个主机)
-net:网络路由(到某个网络)
例如:
route add -net 10.0.0.0/8 gw 192.168.0.118
路由一个网络10.0.0.0子掩码为8位,通过192.168.0.118到达,其中gw表示网关是谁

【del】删除
-host:
-net:
例如:
route del -net 10.0.0.0/8 删除指定路由
route del -net 0.0.0.0 删除默认路由
或者 route del default 也可以删除默认路由
route add default gw 192.168.0.118 添加默认路由
(所做出的改动重启网络或主机后就失效)

查看:
route -n :以数字方式显示各主机端口等相关信息

路由:
/etc/sysconfig/network-scripts/route-ethX
添加格式一:
DEST  via  NEXTHOP
格式二:
ADDRESS0=目标地址
NETMASK0=子网掩码
GATEWAY0=网关
(第二总格式可以添加多种)

DNS服务器指定方法只有一种:编辑/etc/resolv.conf 
nameserver DNS_IP_1
nameserver DNS_IP_2

指定本地解析:
/etc/hosts

DNS-->/ets/hosts---->DNS

===================附加===================4
[root@gdy ftpftp]# route 
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
link-local      *               255.255.0.0     U     1002   0        0 eth0
10.0.0.0        192.168.0.118   255.0.0.0       UG    0      0        0 eth0
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth0
[root@gdy ftpftp]# 
其中:
【Destination】到达目标
【Gateway】通过的目标
【Genmask】路由器的网络掩码
【Flags】启用状态
U:本地网络
G:表示网络路由