Setting up NetBSD

Network setup

dynamically

hostname SHORT
ifconfig xennet0 inet x.x.x.x/xx up
route add default x.x.x.x

at boot time

echo SHORT > /etc/myname
echo inet x.x.x.x/xx up > /etc/ifconfig.xennet0
echo x.x.x.x > /etc/mygate
#service network restart

static name resolution

vi /etc/hosts

127.0.0.1 localhost
x.x.x.x   SHORT.example.local SHORT
x.x.x.x   gw

DNS

cat > /etc/resolv.conf <<EOF
#search example.local
nameserver 208.67.222.222
nameserver 208.67.220.220
EOF

SSHD

See SSHD.

Scripted post-installation

This is all provided by those scripts

mkdir -p ~/bin/
cd ~/bin/
ftp -a http://pub.nethence.com/bin/netbsdconf.ksh.txt
ftp -a http://pub.nethence.com/bin/netbsdconfpkg.ksh.txt
cp -i netbsdconf.ksh.txt netbsdconf.ksh
cp -i netbsdconfpkg.ksh.txt netbsdconfpkg.ksh
chmod +x netbsdconf.ksh netbsdconfpkg.ksh
./netbsdconf.ksh > netbsdconf.log
./netbsdconfpkg.ksh > netbsdconfpkg.log

ll /etc/openssl/certs/
mozilla-rootcerts install

Finish-up manually

define a password for root just in case you need a least amount of physical security (by that I mean console login) and avoid getting a warning about it every day

passwd

tune the daily report

tail -100 /etc/daily
cp -pi /etc/daily /etc/daily.dist
cat >> /etc/daily <<-EOF

echo    
echo    
echo w
w 
echo

echo top -b 10
top -b 10
echo

echo ps auxww \| sort
ps auxww | sort
echo

echo netstat -a -f inet,inet6
netstat -a -f inet,inet6
echo

echo netstat -rn -f inet,inet6
netstat -rn -f inet,inet6
echo

echo arp -a
arp -a
echo
EOF

cron jobs fixup

crontab -e

#*/10   *       *       *       *       /usr/libexec/atrun
0       3       *       *       *       /usr/bin/newsyslog
30      5       1       *       *       /bin/sh /etc/monthly 2>&1 | tee /var/log/monthly.out | sendmail -t

Operations

make sure you are clean

ps auxww
netstat -an -f inet,inet6
cat /etc/resolv.conf

vi ~/log

tail -F /var/log/messages

chmod +x log

Optional

Syslogd tuning

for easy troubleshooting

cp -pi /etc/syslog.conf /etc/syslog.conf.dist                     
vi /etc/syslog.conf

.err;kern.*;auth.notice;authpriv.none;mail.crit         /dev/console
*.emerg                                                 *
*.info                                                  /var/log/messages

or if this is an mail exchanger, maybe

*.err;kern.*;auth.notice;authpriv.none;mail.crit        /dev/console
*.emerg                                                 *
mail.info                                               /var/log/maillog
*.info;mail.none                                        /var/log/messages

fix the permissions and apply

-rw-------   1 root    wheel    105K May  3 15:15 /var/log/messages

service syslogd restart

NTP

eventually setup ntp – not sure this is needed for xen guests

mv -i /etc/ntp.conf /etc/ntp.conf.dist
sed '/^$/d;/^#/d;' /etc/ntp.conf.dist > /etc/ntp.conf
vi /etc/ntp.conf

#server          ntp.obspm.fr
#server          ntp1.online.net
#server          ntp2.online.net

server 0.ru.pool.ntp.org
server 1.ru.pool.ntp.org
server 2.ru.pool.ntp.org
server 3.ru.pool.ntp.org

vi /etc/rc.conf

ntpdate=yes ntpdate_flags="-u -b -s"
ntpd=yes    ntpd_flags=""

grep ^server /etc/ntp.conf
ntpdate -u ...
service ntpd start
ntpq -p

the ntpdate service looks at ^server into /etc/ntp.conf at boot time.

Outgoing messages

eventually define a smarthost and fix your origin so the bounces are also sent to your MX (assuming you have setup an FQDN in /etc/myname, otherwise fix with myhostname = or mydomain =),

cd /etc/postfix/
mv -i main.cf main.cf.dist
sed '/^[[:space:]]*#/d; /^[[:space:]]*$/d' main.cf.dist > main.cf
vi main.cf

relayhost = SMARTHOST
myhostname = lala.example.net
myorigin = lala.example.net
mydomain = example.net

service postfix restart

and setup an email alias for root,

mv -i /etc/mail/aliases /etc/mail/aliases.dist
sed '/^[[:space:]]*#/d; /^[[:space:]]*$/d' /etc/mail/aliases.dist > /etc/mail/aliases
vi /etc/mail/aliases

root:       REAL_EMAIL

newaliases
tail -F /var/log/maillog &
date | mailx -s `hostname` root
mailq

Resources

Setting up NetBSD https://users.ics.aalto.fi/kaip/netbsd.html


Nethence | Pub | Lab | Pbraun | SNE Russia | xhtml