Monthly Columns
 

ASCII and Ye Shall Receive

Copyright © 1999 Todd Whitesel

Welcome to the September issue!

This month we've got one nitpicker, a few responses to the old mailbag items, a question about setting up NetBSD 1.4.1 to do large text screens on VGA, and some new mailbag questions.

List of Topics






Q: Hey, don't curly braces really mean that sh should execute the enclosed stuff in the same shell, not subshell?

A:

Um yeah, my thinko. Curly braces in the shell ensure that all enclosed top-level commands will execute in the same shell as each other. Depending on the shell implementation, this might end up in a subshell anyway. Reportedly, with the original korn shell, it did.



Q: How do I set up a machine with two ethernet cards as a router? (Answer #1)

A:

Run natd (Network Address Translation Daemon) on the machine with two ethernet cards. Set one ethernet card to have your externally visible internet address, and the other to an address in the 10.x.x.x or 192.168.x.x subnets, the network numbers reserved for internal LAN use. All of your internal machines should be on the same LAN subnet as the second ethernet card; connect them up using coax or twisted pair hubs or whatever. These machines should use the IP address of that second ethernet card as their default gateway.

Setting up natd does require that you run a firewall which diverts all traffic through natd. (This will probably include a kernel recompile.) Refer to the natd man page which is excellent and should tell you everything you need to know.



Q: How do I set up a machine with two ethernet cards as a router? (Answer #2)

A:

Check out the following article from the FreeBSD Diary.



Q: How do I set up a machine with one ethernet card and a serial modem to act as a PPP gateway? (Answer #1)

A:

First, for all the hosts on your LAN, assign addresses from one of the subnets that are reserved for local use (10.x.x.x or 192.168.x.x). Second, make an /etc/ppp/ppp.conf that has the following, modified to your needs accordingly:

------------BEGIN /etc/ppp/ppp.conf -------------

default:
 set log Phase Chat LCP IPCP CCP tun command
 set device /dev/cuaa1
 set speed 115200
 set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \"\" AT \
           OK-AT-OK ATE1Q0 OK \\dATDT\\T TIMEOUT 40 CONNECT"

#
# phone is phone number
# replace uname with your ppp usernmae
# replace pass with your password
#


myisp:
 set phone 7187300
 set login "ABORT NO\\sCARRIER TIMEOUT 5 ogin:--ogin: uname word: pass"
 set timeout 600
 add default HISADDR

--------------END /etc/ppp/ppp.conf --------------------

Then, edit /etc/resolv.conf if you haven't already (remember to use your own domain name and nameserver addresses here!):

domain		me.com
nameserver	10.1.1.1
nameserver	123.1.1.1

Finally, run ppp -alias myisp to dial up. If you want it to run in the background, use ppp -auto -alias myisp. That way, it will dial only when there is outgoing traffic, and disconnect after your connection has been idle for the number of seconds that you set as the timeout. When you use -auto, it is often good to lower the timeout value in /etc/ppp/ppp.conf.

If you just want to be connected all the time, use -ddial instead of -auto and it will dial (or redial) immediately, so that it stays connected.



Q: How do I set up a machine with one ethernet card and a serial modem to act as a PPP gateway? (Answer #2)

A:

Use the ijppp package for FreeBSD:

Enable the tun driver in your kernel, and set up your ethernet and ppp interfaces using whatever methods you like. To enable routing, add a section to /etc/ppp/ppp.linkup:

MYADDR:
 delete ALL
 add 0 0 HISADDR

Then start ppp with the -alias option (and -auto if you want dial-on-demand).

On the other machines, set the default gateway to this machine. If necessary, set the DNS servers on the other machines as well.

More detailed information can be found in the FreeBSD tutorials.



Q: How do I configure my machine to use a proxy server?

A:

Adapt the the transparent proxying methods given in the Squid FAQ, specifically this entry.



Q: I installed FreeBSD from an MS-DOS partition but forgot to install the man pages, and now I can't get /stand/sysinstall to find the MS-DOS partition so I can't install my man pages! Now what do I do?

A:

Put your machine on a network with a friend's FreeBSD box that can mount the installation media, and finish your installation by fetching things from the network connection.



Q: I just installed NetBSD 1.4.1, and I want 50 line text screens again.

A:

First, edit /etc/rc.conf and change the line that says wscons=NO to wscons=YES.

Second, edit /etc/wscons.conf and uncomment this line:

font	ibm	-	8	ibm	/usr/share/pcvt/fonts/vt220l.808

Also, change the bottom of the file to look like this:

#screen	0	80x50	vt100
screen	1	80x50	vt100
screen	2	80x50	vt100
screen	3	80x50	vt100
screen	4	80x50	vt100
screen	5	80x50	vt100
screen	6	80x50	vt100
screen	7	80x50	vt100

This will give you a total of eight screens, accessible by Ctrl-Alt-Fn where n is 1 through 8 for screens 0 through 7 and devices ttyE0 through ttyE7. If you want login prompts on all of these screens, you will need to enable them in /etc/ttys with lines like these:

ttyE0	"/usr/libexec/getty Pc"		vt220	on secure
ttyE1	"/usr/libexec/getty Pc"		vt220	on secure
ttyE2	"/usr/libexec/getty Pc"		vt220	on secure
ttyE3	"/usr/libexec/getty Pc"		vt220	on secure
ttyE4	"/usr/libexec/getty Pc"		vt220	on secure
ttyE5	"/usr/libexec/getty Pc"		vt220	on secure
ttyE6	"/usr/libexec/getty Pc"		vt220	on secure
ttyE7	"/usr/libexec/getty Pc"		vt220	on secure

It does not appear to be possible to override the 80x25 setting on screen 0 (ttyE0). This is most likely a feature limitation in the newer driver, intended to help prevent people from losing their only working console screen.

If you will be running xdm, put this in /etc/wscons.conf:

screen	4	-	-

and this in /etc/ttys:

ttyE4	"/usr/libexec/getty Pc"		vt220	off secure

This will ensure that your X server can find a free terminal so it will know when to switch back into graphics mode. If you want this to be a screen other than 4, then fix things so your X server is given an argument of the form vtn where n is the same as the function key number of the screen that you want to reserve for graphics.



Q: How's that Sparc laptop doing?

A:

Fine, it's sitting on the TV table out by my couch and I use it to read email while I eat breakfast in front of the TV. As of the first week of August, basic X11 support was available in NetBSD-current and a snapshot was made available on August 11th. Support for the power management, internal modem, and PCMCIA slots is still in progress.



Q: What's in this month's mailbag?

A:

  1. Is FreeBSD going to add support for Logical Volumes? When?
  2. Is there a BSD equivalent for the Linux uptime daemon?
  3. How do I set up my wheel mouse so that it controls the scroll bars like it does when I'm running windows?
  4. Why do all the *BSD distributions use Groff rather than ditroff or the original CAT5 troff? I don't seem to be able to find the troff/ditroff sources anywhere, weren't they produced under the BSD copyright/license?
  5. I want to use CVSup to update my /usr/src from, say, FreeBSD 3.1-RELEASE to 3.2-RELEASE. I tried following Greg Lehey's examples in his excellent "The Complete FreeBSD" (as well as several variations), but all I could get it to do was make a bunch of tempfiles with listings of files to be deleted/added/changed.
  6. Why do ifconfig aliases on FreeBSD require that their netmask be set to 255.255.255.255? My SCO OpenServer and UnixWare machines don't need a special netmask.
  7. I've set up a FreeBSD machine with 2 3c905 Boomerang NICs and got them to both come up fine using /stand/sysinstall, but no routing is taking place yet. Why aren't packets automatically being forwarded between the two interfaces?





Do you have questions for the BSD Answer Man? Send them to bsd-answerman@toddpw.org.
Any email sent to this address is assumed intended for publication and will become the property of Dæmonnews.

That's all for this month, folks. Until next time, remember: there's no shame in asking RTFM questions any more, because these days, there is just too much FM to R.

Todd P. Whitesel, toddpw@toddpw.org