Saturday, 8 April 2006

IPX and mounting Novell Netware shares on Gentoo

Start by enabling kernel support for IPX networking and NCP filesystem. For 2.6 kernels (it's simmilar on 2.4), you need to enable the following settings:

Networking -->
Networking options -->
<*> The IPX protocol
File systems -->
Network file systems -->
<*> NCP file system support (to mount NetWare volumes)
[*] Clear remove/delete inhibit when needed
[*] Use NFS namespace if available
[*] Use LONG (OS/2) namespace if available

On 2.6 kernels enabling NCP shows quite a long list of options. As I did not understand their meaning ;-) , I settled for defaults, which work just fine. You may want to enable National Language Support. I gave up on this as I was unable to find a working combination of codepage/iocharset for my local Novell server.

So, recompile (make install && make modules modules_install for gentoo-sources) and reboot. Emerge ncpfs (emerge -av ncpfs). I wanted my machine to automount the Netware share on every boot, thus I added an entry to /etc/fstab:

SERVER/user		/mnt/novell	ncpfs		uid=root,gid=disk,owner=root,passwd=pass,mode=660,volume=VOL1	0 0

Obviously, you have to replace SERVER with your local Novell servername, user with your username, VOL1 with the name of volume you wish to mount (or ommit volume=VOL1 at all to mount the entire server) and pass (in passwd=pass) with your guess_what. Of course, /mnt/novell has to exist.

There are a few caveats to keep in mind if you choose this approach. First and foremost, your password is visible to anyone who can read your fstab. This can be avoided by storing it in a config file, readable only to root (see man ncpfs for details). Second, the mount is fully accessible to anyone in the group disk (to allow only root, drop gid=disk from fstab entry).

Next, you'll want to actually connect to IPX network. I assume that it is working on the very same ethernet connection you use as eth0. Execute ipx_configure --auto_interface=on --auto_primary=on and wait a few seconds for it to settle (it backgrounds immediately, but give it some time to actually connect). Then, examine ifconfig output for lines containing IPX. Their number may vary, depending on number of IPX versions enabled on the server. If all went well, you are now able to mount your Novell share with a simple mount /mnt/novell.

Now, the init scripts. To connect to IPX on boot, add this code into /etc/conf.d/net.eth0:

postup() {
# This function could be used, for example, to register with a
# dynamic DNS service. Another possibility would be to
# send/receive mail once the interface is brought up.
result=`ipx_configure --auto_interface=on --auto_primary=on`

while [ $COUNTER -lt 30 -a `ifconfig|grep IPX|wc -l` -lt 2 ]
let COUNTER+=1
sleep 1

if [ $COUNTER -eq 30 ]
return 127
return $result

The '2' in '-lt 2' is the number of lines, containing IPX, present in ifconfig output after the connection has settled. Change it as fit. '30' in '-lt 30' and '-eq 30' is the allowed timeout for connecting, ie. if IPX is not up after 30 seconds script reports failure.

To properly mount your NCP shares (after the network connection is initialized), gentoo has to recognize them as network filesystems. Thus, add NET_FS_LIST="ncpfs" to both /etc/conf.d/localmount and /etc/conf.d/netmount.

No comments:

Post a Comment