Cover V09, I05
Article

may2000.tar


Questions and Answers

Jim McKinstry

 Q How do I determine the configured maximum number of inodes for HP-UX 10.20?

 A The easiest way to check how many inodes are configured is to look at the ninode kernel parameter. You can check the current value in SAM.

 Q I have a plain text file that I need to print. When I use lp to send it to a network printer, I get just one line. How do I fix this?

 A The network printer is expecting a DOS-formatted file. Try:

ux2dos FILENAME | lp -d NETWORK_PRINTER_NAME
ux2dos converts a UNIX file to a DOS file. The output is then redirected to lp and printed to the network printer. If you want to see what ux2dos does, try:

ux2dos FILENAME > /tmp/FILENAME.out
When you vi /tmp/FILENAME.out, you'll see what ux2dos did.

 Q What is packet filtering? What are the most important fields of IP and TCP that are used in packet filtering?

 A Packet filtering controls access to a network by analyzing the incoming and outgoing packets and letting them pass or halting them based on the following:

  • Source IP address of the packet
  • Destination IP address
  • Source port number
  • Destination port number
  • Packet type (UDP, TCP, etc.).

 Q I am using HP9000 K-series system. Can somebody tell me what a SUPERBLOCK is?

 A A superblock contains the information on the boundaries of the partition (cylinder groups) and information about where the inode table is and where datablocks start. If the superblock is lost or damaged, the whole filesystem would be unreadable. When a file system is created, superblock backups are made at regular intervals throughout a partition. If one block is corrupted, another can be used to repair the damage. The fsck command is used to repair damaged superblocks.

 Q When my server restarts after a reboot or shutdown, my users complain that the system response is very slow. As time passes, the response improves. It takes almost 4 to 5 hours to become normal. What could be the problem?

System: HP9000 K-series HP-UX 10.01

Database: Progress 7.3c

Application: MFG/PRO 7.4 (ERP)

 A It sounds as if your database caches a LOT of information. Is the system connected to a RAID device with a lot of cache? Does your database have a large cache configured? When the RAID or database cache is cleared during a reboot, it can sometimes take a long time to fill up again and allow the system to run efficiently.

 Q What's the best way to determine whether to install more CPUs or faster CPUs on a CPU-bound Web server? We have a Web site with three servers, identical except that two have 166 MHZ CPUs and one has 333 MHZ CPUs. Traffic is presumably load balanced with Local Director, and perfmeter tells us that the machines with the slower CPUs get pegged during times of heavy Web traffic. To address the problem, we could put more CPUs in the machines, or we could replace the slower CPUs with faster ones. What's the best way to make that call?

 A In general, I like to have more CPUs to process the requests. However, if you are running 166 MHZ CPUs then it sounds like you need an upgrade anyway. I'd look at upgrading the 166 MHZ systems to at least match the 333 MHZ system. Since it's almost impossible to get something as slow as a 333 MHZ system these days, you'll probably end up with at least a 450 MHZ system. If you anticipate more load in the near future, then upgrade to dual processors on all of your systems.

 Q The OS was upgraded, and we lost the ability to use rsh when logging into the computer. The error is “-rsh : Unknown host”. The /etc/shells, /etc/hosts, /.rhosts files all look okay. A file was overlaid during the upgrade. Which one?

 A It sounds like the system was using DNS or NIS for name resolution. Make sure that the hostname is being resolved correctly on both the client and server. Use nslookup <ip address> to see how the systems are being resolved, then add the appropriate name in the .rhosts file. You were probably resolving the hostname from the /etc/hosts file first and are now resolving in DNS (or NIS) first (or vice versa). The file that was overlaid was probably /etc/nsswitch.conf or /etc/resolv.conf.

 Q Is there a way to compare two date variables in a UNIX script (preferably the Korn shell)? I would like to execute two scripts and record the total amount of wall time they took to execute.

 A I usually do something like the following.

Add these lines to the top of your script:

START_HOUR=`date +\%H` # Save the hour when the script started START_MIN=`date +\%M` # Save the minute when the script started # Convert the hours to minutes and add the minutes. START_TIME=`expr $START_HOUR \* 60 + $START_MIN` Add these lines to the end of the script:

END_HOUR=`date +\%H` # Save the hour that the script stopped
END_MIN=`date +\%M`  # Save the minutes that the script stopped

# Convert the hours to minutes and add the minutes
END_TIME=`expr $END_HOUR \* 60 + $END_MIN`

if [ $END_TIME -lt $START_TIME ] # If end time is less than 
                                 # start time
then                             # then we are in a new day
END_TIME=`expr $END_TIME + 1440` # Add 24 hours to end time
fi
ELAPSED_TIME=`expr $END_TIME - $START_TIME`
 Q How do I change the IP address range in a SCO UNIX 4.2 server? It has class “c” IP address, and we would like to change to class “B” address.

 A Look in /etc/tcp for a line like:

ifconfig -p net0 10.2.2.2  netmask 255.255.255.0 \
  broadcast 10.2.2.255 ...
You will need to change the “10.2.2.2”, “255.255.255.0”, and the “10.2.2.255” values.

 Q How do I configure my ftp(wu-ftp) to accept user logins on an x86 Linux 2.0.30 (Slackware) system? I can only do anonymous logins at present.

 A You will need to customize the /etc/ftpaccess file. The wu-ftp access management uses the originator's IP address to determine access. Here's an example of /etc/ftpaccess that allows people from 10.10.10.* to log in as normal users as well as anonymous. All other connections are limited to anonymous logins. Here's what the file would look like:

[Stuff deleted.]
#######################################
# Example entries
#######################################
class trusted_users real,anonymous 10.10.10.* 
class anyone_else anonymous *
[Stuff deleted...]
There are three user types:

Anonymous -- Anyone can log in, but they have limited access to the system.

Real -- Anyone with a valid login id can login. They have the same access permissions as if they telneted in.

Guest -- Basically, same as a “real” user, only they are limited to their home directory.

When a connection request is received, wu-ftp checks /etc/ftpaccess to assign the connection a “class” based on the IP address of the originator.

Example: 194.20.32.1 tries to connect to your server. wu-ftp checks /etc/ftpacces something like this:

1. Is 194.20.32.1 part of the 10.10.10.* network? NO.

2. Is 194.20.32.1 part of the * network. YES (“*” is all networks). Therefore, 194.20.32.1 is allowed to connect as someone in the “anyone_else” class and is limited to the ID of “anonymous”.

Example: 10.10.10.34 tries to connect to your serve. wu-ftp checks /etc/ftpacces something like this:

1. Is 10.10.10.34 part of the 10.10.10.* network? YES. Therefore, 10.10.10.34 is allowed to connect as someone in the “real” or “anonymous” class. They may login as “anonymous” or any valid login id on the system.

If an IP address is not matched in any class defined in /etc/ftpaccess, access from that IP is denied.

Your /etc/ftpaccess probably looks something like this:

[Stuff]
class   all   anonymous  *
[Stuff]
It means that all computers are allowed to connect. All connections are associated to the class “all”, and only anonymous logins will be allowed. You can change it to read:

class   all   real,anonymous  *
This will allow anyone to log-in as anonymous, and all users with valid login ids on the system to login as themselves.

Check out man ftpaccess for more information on this topic.

About the Author

Jim is a Technical Analyst specializing in UNIX. He has worked for IBM, Rite Aid, EDS, and is currently working for Sprint Paranet. He can be reached at: jrmckins@yahoo.com.