Network addresses

To run your own server, you must know what are its IP, public, local, and its gateway (router).


Public or local/private address

First, understand your server is probably behind a router given by your ISP. The router received a public IP. People "on the internet" can reach this IP.

The router allocate private addresses to devices connected in your local network. Each device has its own private IP : one for your phone, another for a printer, a computer, a console... They all share one public address.

Private addresses can be in three ranges :

Your private or local IP is the one your computer use, the one it knows. As example, on a computer using Linux:

[toto@jabberwocky src]$ ip add show dev eno1
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group de
fault qlen 1000
    inet brd scope global dynamic eno1
       valid_lft 28073sec preferred_lft 28073sec

In this example, is the private address.

Your public address is the one "used" when you browse the web. Wabsites you're used to read see this IP. If you don't know it, you can check one of these links (amongst many others):



The router is the box your ISP gave you. We also call it a gateway because on a side it is the "public" network, on the other your "private network". The router deals with redirections : if someone wants to reach your website, the router will lead him to your server's private address.

To find your gateway IP, use "route" command:

# route -n show
Routing tables

Destination        Gateway            Flags   Refs      Use   Mtu  Prio Iface
default        UGS       35     4827     -     8 re0
224/4              URS        0       13 32768     8 lo0
127/8              UGRS       0        0 32768     8 lo0          UHhl       9      969 32768     1 lo0

The first line is what you're looking for : in this example.


Every device in your network has a name to identify it. It is the hostname.

On a computer, you can change this name. To do so on OpenBSD, edit the /etc/myname file and write the complete hostname:



To configure a network interface, you can use DHCP to autmatically get a local address. Be careful though, the "D" means "Dynamic", so this addres might change in the future depending on your router.

To do so, edit /etc/hostname.if file, and replace ".if" by the name of your inteface (run "ifconfig" to find it) and just write "dhcp" inside.


Static configuration

A bit more complicated, static configuration gives you more control.

In /etc/hostname.if (replace "if" with your interface name) :

inet   alias
## and as many as you want
# inet 	(alias) local_ip       network_mask      broadcast_add

If you're not sure, at first configure using dhcp and look at the output of "ifconfig".

You must add to /etc/mygate file your gateway. Below, as example, there are ipv4 and ipv6 of the gateway :

See also :

man hostname.if


IPv6 is the new protocol to use facing the lack of ipv4 available. The main advantage is that you don't need a router doing NAT : your machine is directly reachable.

To configure your interface, magic happens in /etc/hostname.if with the "inet6" lines:


inet6   2001:db8:1:1::2    64 # adresse
inet6   autoconf              # SLAAC, if you want