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.

Del.icio.us! | Digg Me! | Reddit!

Related stories


RSS Feed RSS feed logo
About


3com
3ware
alsa
alsactl
alsamixer
amd
android
apache
areca
arm
ati
auditd
awk
badblocks
bind
bios
bonnie
cable
carp
cat5
cdrom
centos
chart
cifs
cisco
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
dns
dos
dovecot
dsniff
dvdauthor
e-mail
echo
editor
emerald
ethernet
ext3
fat32
fedora
fetchmail
fiber
filesystems
firefox
firewall
flexlm
floppy
flowtools
fonts
format
ftp
gdm
gnome
greasemonkey
greylisting
growisofs
grub
hacking
harddrive
hba
hex
hfsc
html
http
idl
ie
intel
ios
ipmi
iptables
irix
javascript
kde
kernel
kmail
kprinter
krecord
kubuntu
ldap
linux
logfile
maradns
matlab
memory
mencoder
mhdd
mkinitrd
mkisofs
moinmoin
motherboard
mouse
movemail
mplayer
multitail
mutt
myodbc
mysql
mythtv
nagios
nameserver
netflow
nic
ntfs
ntp
nvidia
odbc
openbsd
openntpd
openoffice
openssh
openssl
opteron
parted
partimage
patch
perl
pf
pfflowd
pfsync
photorec
php
pop3
pop3s
ports
postfix
power
procmail
proftpd
proxy
putty
pxe
python
qemu
r-studio
raid
recovery
router
rpc
rsync
samba
schedule
scsi
seagate
seatools
sed
sendmail
sgi
shell
siw
smtp
snort
solaris
soundcard
spam
spamd
sql
sqlite
squid
ssh
ssh.com
ssl
su
subnet
subversion
sudo
sun
supermicro
switches
symbols
syslinux
systemrescuecd
t1
tcpip
tcpwrappers
telnet
terminal
testdisk
tftp
thttpd
thunderbird
timezone
tools
tr
trac
tuning
tunnel
vi
wget
wiki
windows
windowsxp
wireless
wpa_supplicant
x
xauth
xfree86
xfs
xinearama
xmms
zdump
zic
zlib