---
name: "mygate"
section: "5"
platform: "openbsd"
package: "man"
version: "8.0-current-20261101"
release: "OpenBSD 8.0-current (2026-11-01)"
platforms: ["openbsd"]
url: "https://new.carta.tech/mygate"
---

# mygate(5)

default gateway

## NAME

**mygate** – default gateway

## DESCRIPTION

The **mygate** file is read by [netstart(8)](/netstart/8.md) at system startup time.

*/etc/mygate*, if it exists, contains the address of the gateway host. The gateway is added to the routing tables by the [route(8)](/route/8.md) utility. If */etc/mygate* does not exist, no default gateway is added to the routing tables. The file may contain gateway addresses for both IPv4 and IPv6 networks in dotted quad notation for v4 (e.g. 192.0.2.1) or in colon notation for v6 (e.g. 2001:db8::1). Each address must be specified on a separate line. If more than one address of a specific family is found, only the first is used - all other addresses of that family are ignored.

*/etc/mygate* is processed after all interfaces have been configured. If any [hostname.if(5)](/hostname.if/5.md) files contain “inet autoconf” directives, IPv4 entries in */etc/mygate* will be ignored. If they contain “inet6 autoconf” directives, IPv6 entries will be ignored.

Additionally, arbitrary shell commands can be executed during processing of this file, using *!**command* directives similar to [hostname.if(5)](/hostname.if/5.md). This is useful for doing additional configuration after all interfaces are configured by [netstart(8)](/netstart/8.md).

Empty lines and lines beginning with ‘#’ are ignored.

## FILES

- */etc/mygate*

  Default gateway address(es).

## SEE ALSO

[hostname.if(5)](/hostname.if/5.md), [netstart(8)](/netstart/8.md), [route(8)](/route/8.md)

## HISTORY

Support for the file */etc/mygate* first appeared in NetBSD 0.8.
