From 4493a029c948f4f2b45d6799aae4cb298883f0d3 Mon Sep 17 00:00:00 2001
From: Dante Catalfamo
Date: Mon, 13 Jul 2020 23:42:00 -0400
Subject: gateway: Add static IP section

---
 content/posts/openbsd-vpn-gateway/index.org | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

(limited to 'content')

diff --git a/content/posts/openbsd-vpn-gateway/index.org b/content/posts/openbsd-vpn-gateway/index.org
index c96839a..4d363b1 100644
--- a/content/posts/openbsd-vpn-gateway/index.org
+++ b/content/posts/openbsd-vpn-gateway/index.org
@@ -55,7 +55,7 @@ I won't be covering installing OpenBSD here, although it's extremely
 simple and straight forward. You can pick up the disk =.iso= image or
 USB =.fs= image from the [[https://www.openbsd.org/faq/faq4.html#Download][download]] page on OpenBSD website. If this is
 your first time installing OpenBSD, you should check out the
-[[https://www.openbsd.org/faq/faq4.html#Download][installation guide]], which goes over the process in greater detail.
+[[https://www.openbsd.org/faq/faq4.html#Download][installation guide]], which goes over the process in detail.
 
 In this post the machine will have a single network interface called
 =vio0= with a desired static IP of =192.168.0.11=, although the
@@ -63,3 +63,26 @@ interface and IP in your case will be different.
 
 The most important thing is to set a static IP, so it can be set as
 the gateway for client machines. We'll set this first.
+
+Setting a static IP in OpenBSD couldn't be simpler. For each interface
+on the machine, you can create a file with the name
+=/etc/hostname.<if>=, where =<if>= is the name of the interface. Since
+we want to set a configure the interface =vio0=, the file we want is
+=/etc/hostname.vio0=. If your box was configured with DHCP, the file
+might contain =dhcp=. We want to give the interface the static IP
+=192.168.0.11=, so we open the file and replace its contents with the
+following.
+
+#+BEGIN_SRC
+inet 192.168.0.11/24
+#+END_SRC
+
+Now we run [[https://man.openbsd.org/man8/netstart.8][=netstart(8)=]] to reconfigure the interface according to the
+file we've just edited.
+
+#+BEGIN_SRC shell
+dosa sh /etc/netstat vio0
+#+END_SRC
+
+Now if you check =ifconfig=, you should see the interface has the
+correct IP.
-- 
cgit v1.2.3