ÅÄÖ all over

I have never really got ÅÄÖ to work properly on my system before. I got it working in samba but when doing ls at a tcsh prompt the files were full of questionsmarks. So started to search and read what to do. First I found that one could in newer versions of samba set different character codings for dos and unix. But still in my shell things looked weird. After a bit of more searches I found that there is a .login_conf to set these things. So by setting the charset to iso-8859-1 it all worked.

.login_conf

me:
        :charset=iso-8859-1:
        :lang=sv_SE.ISO8859-1:

smb.conf
# Charset settings
display charset = iso-8859-1
unix charset = iso-8859-1
dos charset = utf-8

Using fstab to automatically mount samba drives

It is possible to specify mount_smbfs-mounts in /etc/fstab. For instance it can be used to automatically mount Samba drives automatically at boot up. When I configured this I ran into a number of small problems. To not be needed to enter a password each time one can use /etc/nsmb.conf. Though I could not really get it to work, every time I got queried about the password even if I had given it in nsmb.conf. I tried both with unencrypted and crypted password. Nothing worked. By coincidense I tired to change the user name to only capital letters, and that solved it!

So in you nsmb.conf it should look like this:
[YELLOWORB:JOHN]
password=$$342342425435453

PS. Still have the noauto option and a mount script eventhough I have read it should work without noauto, though I had problems with it before and also it makes your system very dependent on the other machine with the samba drives. If that is not up and running if when you FreeBSD machine boots, the mounting will fail and the boot process will halt and your system will not go up.

Update 2007-05-24:
Yesterday I discovered after a reboot that my shares from a Windows machine wasnt mounted any more. I tried to use mount_smbfs manually but failed. It reported:
mount_smbfs: can't get server address: syserr = Permission denied

I spent quite some time searching for a solution and finally after posting on a mailinglist I figured it out. I’t nothing to do wiht permissions, Samba cannot locate the server, thats the problem! So if you specify its real address and not only WINS name it works:
mount_smbfs -I 192.168.0.2 //joe@FILESERVER/share /mnt

But how to solve it for fstab?
Again comes nsmb.conf into play. Under the each server section in nsmb.conf one parameter you can give is the address to the machine. Either the ip number or its realy networkname works, e.g. fileserver.mynetwork.com.

Mounting a shared windows drive

I’m about to setup a photoblog for a friend and since he currently got his machine/server standing here I thought it could be convinient if I could have his webfiles on that machine and somehow mount that into my FreeBSD machine. So sstarted to search for mounting samba and stumbled upon this article:
FreeBSD and Samba: Automounting

But I could not make it work, first I had Samba 2 so upgraded to 3, but still no progress. Got wierd errors when doing mount_smbfs. The first I got was: “mount_smbfs: vfsload(smbfs): File exists” which didnt make much sense. I tried a lot of things, nothing helped. Finally I rebooted and now I got “mount_smbfs: vfsload(smbfs): Exec format error” which was not much more informative…
Though I found some information about that one needed to have NETSMB option set when compiling the kernel so checked my Kernel config file. Had that already and also the other pre-requisits… Though after a while I realized that I was missing the SMBFS option! So recompiling the kernel with all of these options solved it:

options NETSMB
options NETSMBCRYPTO
options SMBFS
options LIBMCHAIN
options LIBICONV

Changing IP

So once more I changed ISP. Each time I do that the server gets really slow to ssh into, have not figured out yet why. But to speed up things a bit I’ll write down here which files I need to change.

First /etc/rc.conf which sets the IP
/etc/namedb/named.conf for the DNS
/etc/namedb/yelloworb.com
/etc/namedb/yelloworb.com.rev
/etc/ipfw.conf for the firewall
/etc/hosts

/usr/local/etc/dhcpd.conf
/usr/local/etc/proftpd.conf

Traffic Shaping

According to this article it is a good idea to shape the traffic if one has a asymmetric line. As I have a ADSL line 8 Mbit down and 1 Mbit up I thought it would be good to give it a try. I already have IPFW running so all I had to do was to add the traffic shaping configuration into the firewall configuration. I had to recompile the kernel also to include DummyNet but that was quickly done as I have done it before.

Now it is just to wait and see if I notice any difference.

IPFW

So I have not been able to connect with VPN to SICS from home lately so I tried to fix that now.

Have not been able to figure out what was wrong really but I noticed by cealring the logs in the firewall with:

ipfw resetlog

that it denied IP protocol 47(GRE) which was really strange since there is a rule to let that in and out.

${fwcmd} add pass gre from any to ${vpn} via ${oif}<br>${fwcmd} add pass gre from ${vpn} to any via ${oif}

Though I took time to add some other new rules for mainly stopping my log to flood wiht useless information, added deny to port 135, 137, 139 and 445 all related to SMB according to Kurt Seifried’s ports list.

So I reloaded all the rules into the IPFW with:

sh /etc/ipfw.conf > /tmp/ipfw.txt &

and all seems to work now.

NATd: Making DC++ work again

Since I installed the firewall in the server I have not tried to use DC++ but today I thought I would give it a try. Though I realized I couldnt search for anything and people couldn’t download files. After a short chat with Fredrik I realized why. I didn’t forward any ports from my public ip to the PC on the local net. So just to configure NATd to do that.

Fredrik had a natd.conf which I didn’t but it turned out it was not so hard to fix. Add or change the following lines in rc.conf:

  natd_enable="YES"
  natd_flags="-config /etc/natd.conf" 
  natd_interface="vr0"

The last line should be you public interface, the one connected to Internet.
Then create a natd.conf-file with entries that are the arguments you would give natd:

  interface vr0                               
  # Direct Connect redirect                
  redirect_port tcp 192.168.0.5:412 412 
  redirect_port udp 192.168.0.5:412 412

Now you have to start natd with the new config. If you have natd already running kill it first. Give teh following command to start natd:

  natd -a nn.nn.nn.nn -config /etc/natd.conf

where nn.nn.nn.nn is your external ip.