window 路由

To use the route command,

Syntax:

# route add [net|host] <Addr> netmask <Mask> [GatewayAddr|-interface ] <metric>

Example:

Add a network

# route add net 10.10.10.0 netmask 255.255.255.0 192.168.1.1 1

same as

# route add 10.10.10.0/24 192.168.1.1 1

Add a host

# route add host 1.1.1.1 netmask 255.255.255.0 192.168.1.1 1

same as

# route add 1.1.1.1/24 192.168.1.1 1

To route the traffic through an interface instead of an IP Gateway

# route add 1.1.1.1/24 -interface hme0

To check that the roots are added to Kernel IP Routing table,

# netstat -rn

Routing Table: IPv4
Destination           Gateway           Flags  Ref   Use   Interface
——————– ——————– —– —– —— ———
192.168.1.0          192.168.1.1        U         1    273  hme0
224.0.0.0            192.168.1.1         U         1      0   hme0
default              192.168.1.1          UG        1    196
相關文章
相關標籤/搜索