Networking

HP-UX 中的靜態路由

  • August 17, 2011

我需要在 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 檢查)。我究竟做錯了什麼?

從記錄/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]=""

引用自:https://unix.stackexchange.com/questions/18905