Topic Search

Google
 

Wednesday, August 20, 2008

10 quick tips to make Linux networking easier


  • Author: Jack Wallen

Linux makes networking simple and secure — if you know a few tricks. Jack Wallen shares some pointers to help admins knock out various Linux networking tasks with a minimum of effort.


Networking is a must-have on all levels of computing. Be it home or corporate, networking is the one aspect of computing that is, without a shadow of a doubt, a deal breaker. And with some help, the Linux operating system can be the king of networking, in both ease of use and security. But that doesn’t mean the average (and sometimes even the above-average) user can’t use some help. These tips should help make Linux networking go a little more smoothly.

#1: Make use of your /etc/hosts file

The hosts file is used for static host names and offers a quick way to create networking shortcuts. One of the first things I do on a Linux machine is add various machines to the /etc/hosts file. This saves me from having to type a lot of IP addresses. The format of an address for this file is:

IP_ADDRESS NICKNAME

For example, if I use one machine for a backup location at IP address 192.168.1.101, I could enter:

192.168.1.101 backups

Now if I have to connect to that machine, say with secure shell, I can just type ssh -v -l username backups to make the connection.

#2: Keep out unwanted users with /etc/hosts.deny

Yet another helpful “hosts” file is the hosts.deny file. This file allows you to create access control based on client or server names. This is helpful in many ways. You can block blacklist domains from gaining access to your network or you can block certain users from gaining access to certain machines. But no matter how you use it, the format is the same.

Let’s say you want to block the domain bad.domain.name from gaining access to a machine. To do this, open up the /etc/hosts.deny file (you will need either root or sudo privileges) and add this to the bottom of the file:

ALL: bad.domain.name

Save it and you’re good to go.

#3: Let WICD handle your wireless woes

I can’t tell you how many times I have found myself banging my head against a server rack. For the longest time Linux and wireless networking were simply not good bedfellows. But that is quickly becoming a thing of the past. With modern distributions, wireless card detection has become a no-brainer. The issue now is encryption.

Many of the Linux wireless tools have trouble when any encryption is involved. But the WICD tool takes care of this. Now, connecting to WPA or WPA2 encrypted wireless networks is simple. Add to that the amazingly easy GUI employed by WICD and you can check one nasty headache off your list.

#4: Download and install a front end for iptables

You can’t assume that just because you are using Linux, you are secure. You still need some security. And the best security you can have with Linux is iptables. The only problem with iptables is that it can be challenging (especially for the new user). Fortunately, there are outstanding graphical front ends for iptables. One of the best is Firestarter. This front end makes employing iptables a simple process, so you won’t keep bypassing security out of fear of the learning curve.

#5: Get to know the command-line tools

Let’s face it: If you’re running Linux, there might be an instance where you will need to restart your network and you won’t have access to the GUI. In this particular case, knowing that /etc/rc.d/network restart will do the trick will solve your problem. Of course, that’s not the only networking command-line tool. You’ll also want to know tools like dhclient, traceroute, samba, ping, and netstat.

#6: Hard-code your DNS server addresses

I don’t know how many times I have had networking problems that pointed directly at missing DNS server addresses. To this end, I have made it habit to hard-code my DNS servers into the /etc/resolv.conf file. The format of the entries is:

nameserver IP_ADDRESS

where IP_ADDRESS is the actual address of your name server. You can have as many name servers listed as you need.

#7: Install ClamAV

If you run a mail server, an antivirus is essential. Even though you are running Linux and you know your mail server is immune to 99.9999999% of the viruses in the wild, that doesn’t mean all those clients that download mail from your server are immune. With this in mind, you will make your administrating life far easier if you install an antivirus like ClamAV onto your Linux mail server. It will give you peace of mind and enough security to ensure that your users most likely won’t come knocking at your office door demanding retribution.

#8: Know how to configure an IP address manually

Yes, there are GUI tools for this. And yes, they all work very well. But as you will eventually find if you administer any operating system long enough, it’s never bad to have backup tools to help you do your job. And one of the best backup tools for Linux networking is the ifconfig command. Not only will this command return to you (with no arguments) your network card information, it will also allow you to configure your network card manually. This is done like so:

/sbin/ifconfig eth0 192.168.1.10 netmask 255.255.255.0 broadcast 192.168.1.255

Of course, you will want to plug in your particular information as it applies to the above.

#9: Get to know your /etc/interfaces (Ubuntu) or /etc/sysconfig/network-scripts (Red Hat/Fedora) file(s)

This file (or files) is where the information for each network interface is stored. The format for this file is:

auto lo

iface lo inet loopback
auto eth0

iface eth0 inet dhcp
auto eth1

iface eth1 inet dhcp
auto eth2

iface eth2 inet dhcp
auto ath0

iface ath0 inet dhcp
auto wlan0

iface wlan0 inet dhcp

As you can see above, all of my interfaces are set up for dhcp. This is my laptop, which goes with me everywhere, so dhcp is a necessity. But what if I use the wired interface in only one location? For that, I can hard-code the information here under the eth0 interface like so (for Ubuntu):

iface eth0 inet static

address 192.168.1.10

netmask 255.255.255.0

broadcast 192.168.1.255

network 192.168.1.104

gateway 192.168.1.1

Or like so (For Red Hat/Fedora):

DEVICE=eth0

BOOTPROTO=static

BROADCAST=192.168.1.255

IPADDR=192.168.1.10

NETMASK=255.255.255.0

NETWORK=192.168.1.104.0

ONBOOT=yes

Again, you would plug in all the information suited to your network and your device.

#10: Don’t forget smbpasswd when setting up Samba

Nearly every time clients come to me with Samba issues, the problem is that they haven’t added the user and a password with smbpasswd. Without doing this, the user will not be able to authenticate to the Samba server. And when using smbpasswd to add a new user, you have to add the “-a” switch like so:

smbpasswd -a USERNAME

After you hit Enter, you will be asked for the users’ password (twice). NOTE: You must have root access (or sudo) to pull this off.

These 10 quick tips should help make various aspects of Linux networking easier. You never know when you’ll wind up having to rely on the command line or you’ll need to enlist the help of a graphical front end for iptables. Now, if you do, you should be good to go.



By:

Amresh Anjan

Create a title style in Word to save time and mouse clicks

  • Author: Mary Ann Richardson

It’s easy to define a custom style for your document titles — and it will greatly simplify the task of formatting title text. Mary Ann Richardson explains how to do it.


Are you finding that after you type and format a title or heading and press Enter, you need to manually change the paragraph text back to the Normal style? You can save a lot of time by creating a custom heading or title style that does all the work for you. Follow these steps to create a custom Title style:

  1. Open a blank document and type Title.
  2. Select Title and click the Bold and Center buttons on the Formatting toolbar or Home tab.
  3. Change the font to 22 points.
  4. Click anywhere in your title text.
  5. Go to View | Task Pane, click the arrow in the New Document box, and select Styles And Formatting. In Word 2007, click the Styles dialog launcher in the Styles group of the Home tab.
  6. Click the New Style button in the Task Pane. Figure A shows the New Styles button in Word.)

Figure A

styles

  1. Click in the Name box and enter My Title.
  2. Select Normal from the Style For Following Paragraph drop-down list.
  3. If you want this style available to all documents you work with, select the Add To Template check box. In Word 2007, click the New Documents Based On This Template button (Figure B).

Figure B

MyTitle style

  1. Click OK.

The My Title style should appear in your Task Pane. Now when you type your title text, click My Title in the Styles Task pane. Word automatically formats the title text for you. When you press Enter to begin typing the next paragraph, Word will automatically switch back to the Normal style. You can use the same procedure for creating custom headings that save keystrokes.

By:

Amresh Anjan

Import and convert Web text to columns in an Excel worksheet

  • Author: Mary Ann Richardson

options, you can bring Web table data into a worksheet in a format you can use. This example walks through the process.


Excel makes it easy to extract table data from a Web page — but to be of use in a worksheet, you will need to convert the text tables into columns. For example, say you need to chart U.S. GDP data from 2002 through 2006. First, you would use a Web query to import the data from the Web. Then, you’d extract the data into two separate columns. Follow these steps:

  1. Open a blank worksheet.
  2. Go to Data | Import External Data and then click New Web Query. In Excel 2007, click the Data tab, click Get External Data, and then click From Web.
  3. Enter the Web page URL http://forecasts.org/data/index.htm (Figure A).

Figure A

gdp

  1. Scroll to Gross Domestic Product.
  2. Click the arrow next to the Gross National Product Table. (If there are no arrows next to tables on the page, click Show Icons twice at the top of the dialog box to display them.)
  3. Click the Import button (Figure B).

Figure B

import

  1. Click Existing Worksheet, if necessary.
  2. Click the cell on the worksheet where you want the upper-left corner of the Web data to appear and click OK.
  3. Select the data cells containing the text you want to convert.
  4. Go to Data | Text To Columns. (In Excel 2007, click Text To Column in the Data Tools Group on the Data tab.)
  5. Select Delimited (Figure C).

Figure C

delimited

  1. Click Next.
  2. Click to select the Space check box under Delimiters (Figure D).

Figure D

finish conversion

  1. Click Next.
  2. Click Finish.

The data from the Web is now ready to chart (Figure E).

Figure E

chartable data


By:

Amre Anjan