route命令:路由查看及管理

路由条目类型:

主机路由:目标地址为单个IP;

网络路由:目标地址为IP网络;

默认路由:目标为任意网络,0.0.0.0/0.0.0.0

查看:

# route  -n

添加:

route  add  [-net|-host]  target  [netmask  Nm]  [gw GW]  [[dev] If]

     示例:route add -net  10.0.0.0/8  gw  192.168.10.1  dev  eth1

           route add  -net  0.0.0.0/0.0.0.0  gw 192.168.10.1  

           route add  default  gw 192.168.10.1  

           

删除:

route  del  [-net|-host] target  [gw Gw]  [netmask Nm]  [[dev] If]

    示例: route  del  -net  10.0.0.0/8  gw 192.168.10.1

           route  del  default


config命令:

ifconfig命令:接口及地址查看和管理

ifconfig  [INTERFACE]

    # ifconfig -a:显示所有接口,包括inactive状态的接口;

    # ifconfig  IFACE  IP/MASK  [up|down]

                网卡    ip/掩码    up/down

    # ifconfig  IFACE  IP  netmask  NETMASK