OpenBSD basic

  • ip forwarding is off by default, enable it by putting the following into /etc/rc.local
sysctl net.inet.ip.forward=1
note: see

or put into /etc/sysctl.conf

  • set up ip alias
put into /etc/hostname.fxp0 or other file /etc/hostname.bge0

# cat /etc/hostname.fxp0
inet alias

manually add:
ifconfig fxp0 inet alias netmask

ifconfig fxp0 inet -alias netmask

to view these aliases: use 'ipconfig -A'

  • pf disable and enable
pfctl -e (enable)
pfctl -d (disable)

use pfctl -e to confirm it's running

  • pf show rules up
pfctl -s rules
pfctl -s nat
pfctl -s all

  • static routing , put it into /etc/rc.local
/sbin/route add -net
/sbin/route delete -net

put gateway ip address into /etc/mygate:
  • to mount USB under openbsd
mkdir /mnt/usb
mount -t msdos /dev/sd0i /mnt/usb

  • mount hard disk under openbsd
in case you mess up, you can boot from openbsd cdrom, then 'boot -s' to single user mode, then choose 'shell', then mount hard disk:
cd /mnt
mkdir hd
mount /dev/wd0a hd

  • how to use serial port as bootup and login terminal
note: basically, you just put 'set tty com0' in /etc/boot.conf(create it), then edit the line that reads:
     tty00   "/usr/libexec/getty std.9600"   unknown off
to read something like:
     tty00   "/usr/libexec/getty std.9600"   vt220   on secure

note: for using baud 115200, change like this:
put additional line in /etc/boot.conf: stty com0 115200
change /etc/ttys -> tty00 line ,change std.9600 to std.115200