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 http://www.openbsd.org/faq/pf.nat.html

or put into /etc/sysctl.conf
net.inet.ip.forwarding=1

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

# cat /etc/hostname.fxp0
inet 192.168.0.2 255.255.255.0
inet alias 192.168.0.3 255.255.255.0

manually add:
ifconfig fxp0 inet alias 192.168.0.3 netmask 255.255.255.0

delete:
ifconfig fxp0 inet -alias 192.168.0.3 netmask 255.255.255.0

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 192.168.0.0/16 192.168.4.251
/sbin/route delete -net 192.168.0.0/16

put gateway ip address into /etc/mygate:

10.0.0.1
  • to mount USB under openbsd
dmesg
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
  1. http://www.openbsd.org/faq/faq7.html
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
then
change /etc/ttys -> tty00 line ,change std.9600 to std.115200