Reference Manual

Main Alt


setgs - interact with the Gateway Selection mechanism [Examples]
setgs  [ifn [algorithm]]
setgs  [ifn.gwn]
setgss [ifn [gwn speed]]




When invoked with no arguments, setgs prints details of the gateway selection algorithm used on each Internet interface.

Argument algorithm can be one of the following names:

    metric   Use the gateway with the best (lowest) metric
    main     Use the main gateway only
    alt         Use the alternate gateway only
    usage    Use the gateway with the best (lowest) usage
    speed    Use the fastest gateway

When invoked with no arguments, setgss prints details of the gateway speed for each Internet interface. A speed value for each gateway number gwn (1 or 2) for interface ifn can be set. If the same speed is set for each gateway, then the speed algorithm selects gateways at random.

The settings are not recorded in any configuration file or in the Windows Registry. To make the settings permanent, the needed command should be placed in file user.txt.


A second gateway can be added to an interface configuration by populating the Gateway 2 field of the interface configuration file (ifnx.ini). The alternate gateway address must be valid on the network of the interface. The needed routing table entry is added automatically.

When 2 gateways are available, and the algorithm usage or speed is selected, the chosen gateway is recorded in the port mapping entry of the outgoing TCP connection. This ensures that all packets for the same connection will be routed via the same interface and gateway. However, multiple TCP connections may well be routed via different gateways, allowing load-balancing to take place.

When the alternate gateway on an interface is in use, DNS requests are forwarded to the second name server of that interface. This value is usually obtained from the Windows TCP/IP interface configuration. Alternatively, the following command can be issued to force DNS requests to be sent to the alternate gateway:

setnss ifn alt

Commands setgw1 and setgw2 can be used to switch gateways and name servers on a specified interface. It is a conglomerate of the commands:

setgs  ifn alt | main
setnsx ifn alt | main
setnss ifn alt | main

NAT32 also supports routing of Internet traffic from a specific host via a specific gateway on a specific interface. Please see route and setsr for details. A web interface to these features is available in Default and cPanel.

A Windows Applet to control gateway selection is also available. The applet allows a gateway to be selected for all machines either automatically or manually.

cPanel, Default, netcfg, route, sethtx, setis, setns, setrr, setsr