2008年8月19日星期二

OpenBSD NFS


Skeletor configuration


NFS configuration file is /etc/exports. There are many options that you can use in your /etc/exports file, and it is best that you read the exports(5) man page. Assuming the network is 10.0.0.0, we have an /etc/exports that looks like this:


CODE

# NFS exports Database

# See exports(5) for more information.  Be very careful, misconfiguration

# of this file can result in your filesystems being readable by the world.

/mda -alldirs -ro -network=10.0.0 -mask=255.255.255.0



This means that the local filesystem /mda will be made available via NFS. -alldirs specifies that clients will be able to mount at any point under the /mda mount point. -ro specifies that it will only be allowed to be mounted read-only. The last two arguments specify that only clients within the 10.0.0.0 network using a netmask of 255.255.255.0 will be authorized to mount this filesystem. This is important for some servers that are accessible by different networks.


portmap(8) must be running for NFS to operate. Portmap is off by default on OpenBSD 3.2 and later, so you must add the line

CODE

portmap=YES

to rc.conf.local(8) and reboot.


Next, you should add the line

CODE

nfs_server=YES

to /etc/rc.conf.local. This will bring up both nfsd(8) and mountd(8) when you reboot.


Beastman configuration


You should add this code to your /etc/fstab


CODE

10.0.0.1:/mda /mnt nfs ro 0 0



or, if dns or /etc/hosts are configured properly,


CODE

skeletor:/mda /mnt nfs ro 0 0



I hope, you as an experienced user, know what to do with it? Such things as mounting it all without reboot should be common to you - just start the server manually with

CODE

/sbin/nfsd -tun 4

echo -n >/var/db/mountdtab

/sbin/mountd



And mount with

CODE

mount -o ro -t nfs skeletor:/mda /mnt



To restart the server, run

CODE

kill -HUP `cat /var/run/mountd.pid`



Run this to see stats

CODE

rpcinfo -p 10.0.0.1


OpenBSD DHCP 多 vlan 配置

4DLINK 530 ,1个连接Internet,3个内网


    -------------------------------

                             

vr0 连接Internet    vr1 内网交换机1    vr2 内网交换机2    vr3 内网交换机3

59.108.38.*        192.168.1.0/24    192.168.2.0/24    172.16.71.0/24


采用OpenBSD 4.3自带的DHCP


1. /etc/dhcpd.conf

# cat /etc/dhcpd.conf

default-lease-time 36000;

max-lease-time 72000;


option domain-name-servers 59.108.38.195;


#ddns-update-style ad-hoc;

#log-facility local7;



# for admin vr1

shared-network Admin-NET {

    option  domain-name "atyu30.com";

subnet 192.168.1.0 netmask 255.255.255.0 {

        option broadcast-address 192.168.1.255;

        option routers 192.168.1.1;

        range 192.168.1.10 192.168.1.200;

    }

}

# for office vr2

shared-network Office-NET {

subnet 192.168.2.0 netmask 255.255.255.0 {

        option broadcast-address 192.168.2.255;

        option routers 192.168.2.1;

        range 192.168.2.50 192.168.2.150;

    }

}


# for Server vr3

shared-network Server-NET {

subnet 172.16.71.0 netmask 255.255.255.0 {

        option broadcast-address 172.16.71.255;

        option routers 172.16.71.1;

        range 172.16.71.50 172.16.71.150;

    }

}


host Gate-OpenBSD {

next-server 192.168.1.100;

hardware ethernet 00:0E:7B:37:96:6C;

fixed-address 192.168.1.120;

}

}


2.启动

# touch /var/db/dhcpd.leases

# dhcpd vr1 vr2 vr3


3./etc/rc.conf.local


dhcpd_flags="" # for normal use: ""



4./etc/dhcpd.interfaces


#dhcpd的监听端口:


# cat /etc/dhcpd.interfaces

# $OpenBSD: dhcpd.interfaces,v 1.1 1998/08/19 04:25:45 form Exp $

#

# List of network interfaces served by dhcpd(8).

#

# ep0

# ed0 le0

# de1

vr1

vr2

vr3