Archive

Archive for December, 2008

Configuring Your SoundBlaster in FreeBSD

December 25th, 2008

Warning: file_get_contents(http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=1TJ8QTQ6ZFCVAJ3X1T02&AssociateTag=ii0c3-20&Operation=ItemSearch&SearchIndex=Books&ResponseGroup=Small,Images&Keywords=bsd) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /home/manusia2/public_html/wp-content/plugins/amazonfeed/php/amazonfeed.class.php on line 271

Sound card configuration under FreeBSD is not the most intuitive or well documented procedure. Here’s some info to help you along, and examples from my own, working kernel. I’ve used the SoundBlaster AWE 32 and AWE 64 cards successfully.

This document will give you simple instructions for the traditional FreeBSD sound driver configuration. If you want to configure your sound card using Luigi’s new PnP code, check out Luigi’s Sound Drivers Also check out the file /usr/src/sys/i386/isa/sound/sound.doc for more information.

Brief description of IRQ/DRQ settings:

In the following examples, note how the IRQ is set, and how the DRQ is used to encode the DMA channel. This is crucial! Also note that cards such as some Gravis UltraSound (GUS) cards use a 2nd DMA channel. This must be specified in the flags!

SoundBlaster typical setup with one DMA channel:

# Sound blaster with IRQ 5 and DMA channel 1:
device sb0 at isa? port 0x220 irq 5 drq 1 vector sbintr

The case is much the same for this example GUS card:

# GUS using IRQ 12 and only one DMA channel (1):
device gus0 at isa? port 0x220 irq 12 drq 1 vector gusintr

Finally, an example GUS with two DMA channels. Note that the second DMA channel is configured in the ‘flags’:

# GUS using IRQ 12 and two DMA channels, 1 and 3:
device gus0 at isa? port 0x220 irq 12 drq 1 flags 0x3 vector gusintr

1. Check the LINT file.

LINT is your ally. It contains examples for most types of hardware. My examples will use SoundBlaster specific configs. If you have a different type of Sound Card, or if your card does not work after using my examples, read the LINT file for hints with your card. To get to the Sound Driver part of the LINT file, do this:

a. cd /usr/src/sys/i386/conf/

If you do not have this directory, then you do not have your kernel sources. Back up a page and check for CVSUP information.

b. Read the file LINT, searching for the line:

# Audio drivers: `snd’, `sb’, `pas’, `gus’, `pca’

This is the first line of the Audio Drivers section.

2. Edit your kernel config file and add these options:

# Controls all sound devices
# snd: Voxware sound support code
controller      snd0
# sb: SoundBlaster PCM - SoundBlaster, SB Pro, SB16, ProAudioSpectrum
device sb0      at isa? port 0x220 irq 5 drq 1 vector sbintr
# sbxvi: SoundBlaster 16
device sbxvi0   at isa? drq 5 conflicts
# sbmidi: SoundBlaster 16 MIDI interface
device sbmidi0  at isa? port 0x330
# opl: Yamaha OPL-2 and OPL-3 FM - SB, SB Pro, SB 16, ProAudioSpectrum
device opl0     at isa? port 0x388

Note that if you are using a GUS card, you will have to experiment. Find the gus0 entries in LINT and use them. First you will need to determine whether your GUS card has 1 or 2 DMA channels. Use the ‘device gus0′ line in place of the ‘device sb0′ line. Remove the SoundBlaster options which you won’t need.

3. Create the snd0 device.

# cd /dev
# ./MAKEDEV snd0

4. Remake your kernel and Reboot.

When you are done with this, you will need to remake your kernel, install the new kernel and reboot your system.

5. Test your /dev/audio.

Grab this ftp://flag.blackened.net/pub/incoming/sounds/sorrydave.au

Try to play it through /dev/audio:

# cat ./sorrydave.au > /dev/audio

Did you hear anything? Were your speakers on? Were your Port and IRQ/DRQ settings correct? These things may need to be tweaked for your particular settings.

Tags: bsd, freebsd, ftp, General

Related posts

General , ,

Dynamic PPP with IJPPP Under FreeBSD

December 25th, 2008

Step by step instructions for setting up dynamic PPP under FreeBSD the quick and ugly way.

Note, if you’re setting up PPP in the 4.0 FreeBSD tree, check my brand new PPP in 4.x Configuration page.

1. cd /etc/ppp

2. cp ppp.linkup.sample ppp.linkup

3. Edit ppp.linkup.

Here is what my ppp.linkup file contains:

aol:
# delete ALL
# add 0 0 HISADDR

These are commented out because I handle this stuff in ppp.conf (see steps 6-7). Note that ‘aol:’ must correspond to your ISP entry in ppp.conf.

4. cp ppp.conf.sample ppp.conf

5. cp ppp.secret.sample ppp.secret

6. Modify ppp.secret

If you don’t have a ppp.secret file, anyone can telnet into port 3000 and play around with your connection and/or your system. This file allows you to set up entries for username/password/ip+netmask which control access.

At the very minimum you need to have this file without editing it so that password control is used for anyone trying to gain access.

The standard ppp.secret file has default usernames, passwords and ip/netmasks. You’ll need to change these:

oscar           OurSecretKey    	192.244.184.34/24
BigBird         X4dWg9327       	192.244.184.33/32
tama            localPasswdForControl

7. Make sure your entry for default: is correct:

Here is mine:

default:
 set device /dev/cuaa1
 set speed 115200
 disable lqr
 deny lqr
 disable pred1
 deny pred1
 set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \"\" ATE1Q0 OK-AT-OK \\dATDT\\T TIMEOUT 40 CONNECT"

8. Add an entry for your ISP to the end of /etc/ppp/ppp.conf

Use this entry with modifications for your particular ISP:

aol:
 set device /dev/cuaa1
 set phone YOUR_ISP_PHONE_NUMBER_GOES_HERE
 set login "TIMEOUT 5 login:-\\r-login: YOUR_LOGIN_NAME word: YOUR_PASSWORD"
 set timeout 0
 set ifaddr 0 140.145.1.1/0 255.255.255.0
 set openmode active
 delete ALL
 add 0 0 HISADDR

Note that I use /dev/cuaa1, or com2 for my modem.

Replace the name of the ISP (aol) with your ISP name, then change the entry for 140.145.1.1 to the IP of your ISP’s gateway.

9. Modify /etc/rc.local file.

Add this to the end of your /etc/rc.local file:

ppp -auto aol

Note that unless you reboot, you will need to execute this command before your auto PPP will work.

10. Starting PPP.

The easy way - try pinging a host. If your auto is working, it will dial and log you in.

The hard way - From /etc/ppp type:

# ppp aol
User Process PPP. Written by Tosiharu OHNO.
Using Interface: tun0
Interactive Mode
ppp ON spam>

Note that “spam” is my hostname.

11. Dialing your ISP.

Enter “term” and you will get a mini-terminal. dial your ISP using:

atdt123-4567

Or whatever your ISP phone number is. PPP should connect and give you packet mode after a few seconds. If not, type ~p to force packet mode. Once connected, switch to a different virtual terminal with Alt-Fx and ping or telnet to test PPP. The command ‘ifconfig -a’ will show your network and ip info.

Tags: bsd, freebsd, General, password, telnet

Related posts

General , , ,

Adding Virtual Consoles under FreeBSD

December 25th, 2008

First of all, if you aren’t smart enough to do this by reading the FreeBSD FAQ Entry written for this procedure, you are probably in trouble. Yet, this document will remain true to the spirit of this page, providing you step-by-step examples for neanderthals.

1. Determine how many virtual consoles you want to use.

By default, FreeBSD has 4 defined, three of which are “on”. These are accessed by hitting ALT-Fx where x is the number of the virtual console. So, the default setup allows you to switch between ALT-F1, ALT-F2 and ALT-F3. If you are using X, it will default to ALT-F4, or ttyv3.

This document will assume that you want to enable all the F-keys up to F12. If you want fewer virtual consoles, don’t add as many ttyvx entries.

2. Edit the file /etc/ttys.

You will see some default entries for your tty entries. An unmodified /etc/ttys file generally has this info at or near the top:

ttyv0   "/usr/libexec/getty Pc"         cons25  on  secure
# Virtual terminals
ttyv1   "/usr/libexec/getty Pc"         cons25  on secure
ttyv2   "/usr/libexec/getty Pc"         cons25  on secure
ttyv3   "/usr/libexec/getty Pc"         cons25  off secure

3. Add lines for your new virtual terminals:

ttyv0   "/usr/libexec/getty Pc"         cons25  on  secure
# Virtual terminals
ttyv1   "/usr/libexec/getty Pc"         cons25  on secure
ttyv2   "/usr/libexec/getty Pc"         cons25  on secure
ttyv3   "/usr/libexec/getty Pc"         cons25  on secure
ttyv4   "/usr/libexec/getty Pc"         cons25  on secure
ttyv5   "/usr/libexec/getty Pc"         cons25  on secure
ttyv6   "/usr/libexec/getty Pc"         cons25  on secure
ttyv7   "/usr/libexec/getty Pc"         cons25  on secure
ttyv8   "/usr/libexec/getty Pc"         cons25  on secure
ttyv9   "/usr/libexec/getty Pc"         cons25  on secure
ttyva   "/usr/libexec/getty Pc"         cons25  on secure
ttyvb   "/usr/libexec/getty Pc"         cons25  off secure

This is pretty straightforward. If you can’t comprehend what I just did, use your cut and paste features. When you are done editing /etc/ttys, save it.

4. Create some extra vty devices.

We have to create more devices for our new virtual consoles. As root, do this:

# cd /dev
# ./MAKEDEV vty12

5. Restart init on-the-fly.

Init is process #1. As root do this:

# kill -1 1

6. Test your work.

Hit ALT-F5. If you get a virtual console prompt, try ALT-F12.

NOTE: If you are in X, use CONTROL-ALT-F5 and CONTROL-ALT-F12.

You should get a beep and nothing else on F12. Test the rest of your virtual consoles. If you have failed to get it working, you better double-check The FreeBSD FAQ Entry because “it works on my machine.”

Tags: bsd, freebsd, General

Related posts

General ,

TCP Wrappers (TCPD) Under FreeBSD

December 25th, 2008

Simple setup instructions for TCP Wrappers for FreeBSD.

1. Add the TCP Wrappers port from /usr/ports/security/tcp_wrappers, or add it as a package from /stand/sysinstall.

2. Set up banners.

Banners contain the message displayed, if any, when tcpd is called for a particular service. Create the banners directory if necessary, and create the banner files as shown below.

% cd /usr/local/etc/banners
% ls
fingerd ftpd    telnetd
% cat fingerd
This finger request has been logged.
%

Set up your banners appropriately. If you don’t want a banner message, you can simply omit the corresponding file.

3. Edit /usr/local/etc/hosts.allow for your specific needs. Here is an example hosts.allow file:

ALL: .umn.edu: spawn (echo "Access from %h using %d." | sendmail root): DENY
telnetd: ALL : banners /usr/local/etc/banners/
fingerd: ALL : banners /usr/local/etc/banners/
ftpd: ALL : banners /usr/local/etc/banners/

This setup will deny any connections from any host *.umn.edu, it will allow and log telnet, finger and ftp connections, and it will deny all other services called by inetd.conf. For more information type: man 5 hosts_access.

Note that I use hosts.deny for my daemon/banner entries, and I reserve my hosts.allow file, which is checked by TCPD before hosts.deny, for any specifically denied hosts. By doing this, you can have additional security programs drop newly denied host entries into hosts.allow. It seems backward to have hosts.allow deny connections while host.deny allows connections, but it works well. For more info, use:

man 5 hosts_access

4. Edit your /etc/syslog.conf file so tcpd can log properly.

Here are the first few lines of a typical distribution /etc/syslog.conf:

# more /etc/syslog.conf
*.err;kern.debug;auth.notice;mail.crit          /dev/console
*.notice;kern.debug;lpr.info;mail.crit;news.err /var/log/messages
mail.info                                       /var/log/maillog

Here are the first few lines of my edited /etc/syslog.conf:

# more /etc/syslog.conf
*.err;kern.debug;auth.notice;mail.crit          /dev/console
*.notice;kern.debug;lpr.info;mail.crit;news.err;auth.info /var/log/messages
mail.info                                       /var/log/maillog

Notice the only change is the added line for auth.info logging to /var/log/messages.

5. Edit /etc/inetd.conf to point your services to tcpd.

Here is an example with the distribution lines commented out and the modified tcpd lines inserted.

#ftp    stream  tcp     nowait  root    /usr/libexec/ftpd       ftpd -l -a
ftp     stream  tcp     nowait  root    /usr/local/libexec/tcpd       ftpd -l -a
#telnet stream  tcp     nowait  root    /usr/libexec/telnetd    telnetd
telnet  stream  tcp     nowait  root    /usr/local/libexec/tcpd       telnetd
#finger stream  tcp     nowait  nobody  /usr/libexec/fingerd    fingerd -s
finger  stream  tcp     nowait  nobody  /usr/local/libexec/tcpd       fingerd -s

Make the appropriate changes. Be sure to verify that your tcpd is actually in /usr/libexec, as some versions put it into /usr/local/libexec.

Consider disabling rsh, rlogin and so on. Use _only_ those services which you absolutely need.

6. Restart your syslogd and inetd daemons with a kill -1.

There. tcpd is running and you didnt have to learn a thing. Congratulations.

Tags: bsd, freebsd, ftp, General, inetd, sendmail, telnet

Related posts

General , , , , ,

Website

December 25th, 2008

The web has become a part of everyone’s daily life. You can buy all kinds of products online, manage your banking account and view all kinds of entertainment and news sites. What makes the web work is web servers on network operation systems such as FreeBSD, NetBSD and OpenBSD.

One of the most popular and widespread web servers is Apache. This highly stable and extensible piece of software is freely available for download and boasts many powerful features. It comes in a very useful default form, but if you need more features, you can select from several additional modules which you can use to extend the feature set of apache.

Once you have your own web server running, you may want to see how much traffic you are getting. A quick stats builder which creates several useful graphs is Webalizer. This program is very easy to configure can be run quickly in case you have several sites to process. It may not offer all the features you would find with WebTrends, but you will find it has a nice blend of features which make it a great solution.

Related Links:


Tags: Apache, bsd, freebsd, General, netbsd, openbsd, pop, software, ssl

Related posts

General , , , , , , ,