HP-UX 中的静态路由

HP-UX 中的静态路由

我需要在 HP-UX 中设置静态路由。我编辑了 /etc/rc.config.d/netconf 文件并为我的路线添加了新条目:

ROUTE_DESTINATION[1]="10.105.2.0"
ROUTE_MASK[1]="255.255.255.0"
ROUTE_GATEWAY[1]="192.1.1.219"
ROUTE_COUNT[1]="1"
ROUTE_ARGS[1]=""

但重新启动 HP-UX 后,路由表中没有此路由(使用 netstat -rn 检查)。我究竟做错了什么?

答案1

从记录中/etc/rc.config.d/netconf

# ROUTE_DESTINATION:  Destination host or network IP address in decimal-dot
#                     notation, or hostname (in /etc/hosts) or network name
#                     (in /etc/networks), preceded by the word "host" or "net";
#                     or simply the word "default".
#
# ROUTE_MASK:         Subnetwork mask in decimal-dot notation, or C language
#                     hexadecimal notation.  This is an optional field.
#                     An IP address/subnet mask pair uniquely identifies
#                     a subnet to be reached. If a subnet mask is not given,
#                     then the system will assign the longest subnet mask
#                     of the configured network interfaces to this route.
#                     If there is no matching subnet mask, then the system
#                     will assign the default network mask as the route's
#                     subnet mask.

我现在没有可以使用的 HPUX,但根据此文档,您可以尝试:

ROUTE_DESTINATION[1]="net 10.105.2.0"
ROUTE_MASK[1]=""
ROUTE_GATEWAY[1]="192.1.1.219"
ROUTE_COUNT[1]="1"
ROUTE_ARGS[1]=""

或者

ROUTE_DESTINATION[1]="net 10.105.2.0"
ROUTE_MASK[1]="255.255.255.0"
ROUTE_GATEWAY[1]="192.1.1.219"
ROUTE_COUNT[1]="1"
ROUTE_ARGS[1]=""

或者

ROUTE_DESTINATION[1]="10.105.2.0/24"
ROUTE_MASK[1]=""
ROUTE_GATEWAY[1]="192.1.1.219"
ROUTE_COUNT[1]="1"
ROUTE_ARGS[1]=""

相关内容