pantz.org banner
Configuring an OpenBSD gateway/firewall
Posted on 11-03-2005 02:13:00 UTC | Updated on 11-03-2005 02:13:00 UTC
Section: /software/openbsd/ | Permanent Link

OpenBSD acts as a gateway for my Internet connection at home. The interface fxp0 is the external interface to the world. fxp1 is my internal interface to my local lan. Your interface names for your network cards could be different. Look at the startup screen (command: dmesg) to find out what your network card interface names are. The fxp0 inteface is hooked to my cable modem. fxp0 makes a dhcp request (command: dhclient fxp0) and recieves a lease (ip and other info) from my cable provider.

The interfaces need to be setup in a file in the /etc directory. The first part of the file is just called "hostname". The extention of the file is your interface name. For example I said my external interface was called fxp0 so my file in /etc/ for my interface would be called hostname.fxp0. Since this interface is connected to my isp I need to make a dhcp request to get an ip. The file /etc/hostname.fxp0 will be configured to do this with just one line which will be "dhcp NONE NONE NONE". The internal interface has a static ip so it's configured differently. The name of the this file is hostname.fxp1 and it also goes in the /etc/ directory. The line in this file looks like this "inet 192.168.0.1 255.255.255.0 192.168.0.255". When you reboot both interfaces will configure themselves with these settings.

The interface fxp1 as I said above is the internal interface to my local lan. It has a static private IP (192.168.0.1) The dhcpd server is bound to it and it gives leases to my internal workstations. Bind DNS is running a caching dns server on this interface. The caching DNS server will do DNS lookups for all of the workstations on the local lan. The dns server is set to the internal interface and the primary route is set to the same internal interface.

I also disable all services except PF, Quotas, DHCPD (internal interface) and SSH in /etc/rc.conf. Also, set forwarding to 1 (net.inet.ip.forwarding=1) in /etc/sysctl.conf because the box will acting as a router using NAT. NAT, queuing, and redirect rules are loaded from the pf.conf file.

To see configuration files for dhcp, pf, dns, and dhclient I mentioned above see the specific sections on pantz.org that refer to each. Each section has a post on how to setup each of them. Or use the pantz.org search box to find them. I won't link to them as the site structure may change in the future.

Reddit!

Related stories


RSS Feed RSS feed logo

About


3com

3ware

alsa

alsactl

alsamixer

amd

android

apache

areca

arm

ati

auditd

awk

badblocks

bash

bind

bios

bonnie

cable

carp

cat5

cdrom

cellphone

centos

chart

chrome

chromebook

cifs

cisco

cloudera

comcast

commands

comodo

compiz-fusion

corsair

cpufreq

cpufrequtils

cpuspeed

cron

crontab

crossover

cu

cups

cvs

database

dbus

dd

dd_rescue

ddclient

debian

decimal

dhclient

dhcp

diagnostic

diskexplorer

disks

dkim

dns

dos

dovecot

drac

dsniff

dvdauthor

e-mail

echo

editor

emerald

encryption

ethernet

expect

ext3

ext4

fat32

fedora

fetchmail

fiber

filesystems

firefox

firewall

flac

flexlm

floppy

flowtools

fonts

format

freebsd

ftp

gdm

gmail

gnome

google

gpg

greasemonkey

greylisting

growisofs

grub

hacking

hadoop

harddrive

hba

hex

hfsc

html

html5

http

https

hulu

idl

ie

ilo

intel

ios

iperf

ipmi

iptables

ipv6

irix

javascript

kde

kernel

kickstart

kmail

kprinter

krecord

kubuntu

kvm

lame

ldap

linux

logfile

lp

lpq

lpr

maradns

matlab

memory

mencoder

mhdd

mkinitrd

mkisofs

moinmoin

motherboard

mouse

movemail

mplayer

multitail

mutt

myodbc

mysql

mythtv

nagios

nameserver

netflix

netflow

nginx

nic

ntfs

ntp

nvidia

odbc

openbsd

openntpd

openoffice

openssh

openssl

openvpn

opteron

parted

partimage

patch

perl

pf

pfflowd

pfsync

photorec

php

pop3

pop3s

ports

postfix

power

procmail

proftpd

proxy

pulseaudio

putty

pxe

python

qemu

r-studio

raid

recovery

redhat

router

rpc

rsync

ruby

saltstack

samba

schedule

screen

scsi

seagate

seatools

sed

sendmail

sgi

shell

siw

smtp

snort

solaris

soundcard

sox

spam

spamd

spf

spotify

sql

sqlite

squid

srs

ssh

ssh.com

ssl

su

subnet

subversion

sudo

sun

supermicro

switches

symbols

syslinux

syslog

systemd

systemrescuecd

t1

tcpip

tcpwrappers

telnet

terminal

testdisk

tftp

thttpd

thunderbird

timezone

ting

tls

tools

tr

trac

tuning

tunnel

ubuntu

unbound

vi

vpn

wget

wiki

windows

windowsxp

wireless

wpa_supplicant

x

xauth

xfree86

xfs

xinearama

xmms

youtube

zdump

zeromq

zic

zlib