• Aucun résultat trouvé

Network Configuration

Part II: Basic Setup

Chapter 5: Network Configuration

Overview

This chapter discusses the network configuration tools available for easily configuring

network connections on Red Hat Linux. Network configuration differs depending on whether you are connected to a local area network (LAN) with an Ethernet card or you use a dial-up ISP connection. You had the opportunity to enter your LAN network settings during the installation process. For a dial-up ISP using a modem, you will have to configure your network connection using a PPP configuration utility such as the Red Hat PPP Dialer or KDE's Kppp. Table 5-1 lists the different Red Hat network configuration tools.

On Red Hat Linux, you can configure both LAN and PPP connections using the Red Hat Network Configuration tool (redhat=config=network). As an alternative to Network

Configuration, you can use Webmin. For PPP connections, you can use RP3, the Red Hat PPP Dialer, as well as Kppp Network Configuration. The Red Hat PPP Dialer utility provides an easy-to-use interface with panels for login information, modem configuration, and dial-up connections. For DSL and ISDN, you can use asdl-config and isdn-config, accessible from the Internet on the System menu.

Table 5-1: Network Configuration Utilities Network Configuration Utility Description

redhat=config=network Red Hat Network Configuration, access on System menu

RP3 Red Hat PPP Dialer, access on Internet menu

Webmin Webmin network configuration, access with browser on localhost:10000

isdn-config ISDN configuration, access on System menu with internet-config

adsl-config DSL configuration, access on System menu with internet-config

adsl-setup DSL configuration (command line interface), part of the rp-pppoe package (Roaring Penguin Point to Point Protocol on Ethernet)

Kppp K Desktop PPP configuration and connection, access

through internet-config on System menu

pppd Point to Point Protocol daemon, enter on a command

line

wvdial PPP connection, enter on a command line and use connection script

LAN

If you are on a network, you can obtain most of your network information from your network administrator or from your ISP (Internet service provider). You will need the following information. See Chapter 2 about detailed descriptions for the information you will need for your LAN configuration.

The device name for your network interface connection card (NIC) This is usually an Ethernet card and has the name eth0 or eth1.

Hostname Your computer will be identified by this name on the Internet. Do not use

"localhost"; that name is reserved for special use by your system. The hostname should be a simple alphabetic word, which can include numbers but not punctuation such as periods and backslashes. The hostname includes the name of the host and its domain. For example, a hostname for a machine could be "turtle," whose domain is mytrek.com, giving it a hostname of turtle.mytrek.com.

Domain name This is the name of your network.

The Internet Protocol (IP) address assigned to your machine Every host on the Internet is assigned an IP address. This address is a set of four numbers, separated by periods, which uniquely identifies a single location on the Internet, allowing

information from other locations to reach that computer.

Your network IP address This address is usually similar to the IP address, but with one or more zeros at the end.

The netmask This is usually 255.255.255.0 for most networks. If, however, you are part of a large network, check with your network administrator or ISP.

The broadcast address for your network, if available (optional) Usually, your broadcast address is the same as your IP address with the number 255 added at the end.

The IP address of your network's gateway computer This is the computer that connects your local network to a larger one like the Internet.

Nameservers The IP address of the name servers your network uses. These enable the use of URLs.

NIS domain and IP address for an NIS server Necessary if your network uses an NIS server (optional).

Red Hat Network Configuration

Red Hat provides an easy-to-use network configuration tool called redhat-config-network. On the Start Here System-settings window, its icon is labeled Network Configuration, and is referred here as such in this section. The Network Configuration window consists of four tabbed panels: Hardware, Devices, Hosts, and DNS (see Figure 5-1). Clicking a tab displays its panel. Basic configuration of your network requires you to specify the hostname and IP address of your own system, the IP addresses of your network's name servers and gateway, the network netmask, and your network devices. Using the Network Configuration tool, you can easily enter all this information. The DNS panel is where you enter your own system's hostname and your network's name server addresses. The Hosts panel lists host IP addresses and their domain names, including those for your own system. On the Devices panel, you add and configure your network interfaces, such as an Ethernet or PPP interface. The Hardware panel is where you list your network hardware devices. If you already configured your network during installation, your entries are already in these panels.

Figure 5-1: Network Configuration Names panel

The Hardware panel list your system's network cards, such as Ethernet network interface cards (NIC), or any modems you have installed.

The DNS panel has two boxes at the top, labeled Hostname and Domain (see Figure 5-2).

Here, you enter your system's fully qualified domain name and your network's domain name.

For example, turtle.mytrek.com is the fully qualified domain name and mytrek.com is the domain name. There are boxes for entering the IP addresses for your system's primary, secondary, and tertiary DNS servers. You can then list search domains, with buttons for editing, deleting, or changing the priority of a domain to search. Both the search domain and the name server addresses are saved in the /etc/resolv.conf file. The hostname is saved to your /etc/HOSTNAME file.

Figure 5-2: Network Configuration DNS panel

The Hosts panel has a single pane with Add, Edit, and Delete buttons (see Figure 5-3). This panel lists entries that associate hostnames with IP addresses. You can also add aliases (nicknames). The Hosts panel actually displays the contents of the /etc/hosts file and saves any entries you make to that file. To add an entry, click the Add button. A window opens with boxes for the hostname, IP address, and nicknames. When you click OK, the entry is added to the Hosts list. To edit an entry, click the Edit button and a similar window opens, enabling you to change any of the fields. To delete an entry, select it and click the Remove button.

Figure 5-3: Network Configuration Hosts panel

Note If you are having trouble connecting with an Ethernet device, make sure the Hosts panel lists your hostname and IP address, not just localhost. If your hostname is not there, add it.

The Devices panel lists configured network devices on your system (see Figure 5-4). Making entries here performs the same function as ifconfig. An entry shows the device name and its type. Use the Add, Edit, Copy, and Delete buttons to manage the device entries. When you add or edit a device, you open a tabbed panel for configuring it, enabling you to specify its IP address, host name, gateway, and the hardware device it uses. For example, when you

installed Red Hat, any Ethernet network devices you had installed would be listed here.

Editing the device opens a configuration window with three tabbed panels: General,

Protocols, and Hardware Device. The Hardware panel selects a hardware device to use from a list of installed devices. In the General panel, you can set features such as activation at boot time or edit the nick name. The Protocols panel will list the protocols used on this device, usually TCP/IP. Editing the protocol will open a TCP/IP Settings window with tabbed panels for TCP/IP, Hostname, and Routing. Here you can enter the IP address assigned to the device, along with its netmask and network gateway (see Figure 5-4). In the Hostname panel, you can enter the devices hostname. Should you add a new network device, you will need to use the Device panel and its Protocol and TCP/IP settings windows to assign the device an IP address, hostname, netmask, and gateway, among other features.

Figure 5-4: Network Configuration Devices

When you finish and are ready to save your configuration, click the Apply button to have your changes take effect. If you want to abandon the changes you made, you can close without saving. You can run Network Configuration at any time to make changes in your network configuration.

You can also use Network Configuration to configure a PPP device for a modem. When you click Add and select modem as the interface, a Modem Dialup Configuration window opens with several panels including Provider, Options, and Protocol. Select the Provider panel to display entries for your ISP's dial-up phone number as well as your login name and password.

On the Options panel, you can set PPP options (see Chapter 36). In the Protocol's TCP/IP

entry, you can elect to have your DNS information, such as your hostname and name servers, obtained automatically from the provider.

Network Configuration with Linuxconf and Webmin

To configure a LAN connection in Linuxconf, start netconf from a terminal window. This displays a window with buttons for various network configuration options. Click the Basic Host Information button to display the host configuration window. In the first Adapter panel, you can enter the IP address, network device (usually eth0), and the kernel module to use (the drivers for your Ethernet card) along with other data like the hostname and netmask. Then, in the Network Configurator window, click the Name Server Specification button to display the Resolver Configuration window, where you can enter the IP addresses for the domain name servers on your network (see Figure 5-3). Click the Routers and Gateway button to enter the IP address for the gateway computer.

To use netconf to configure PPP connections, click the PPP/SLIP/PLIP button on the Network Configurator window. A window then opens that asks you to choose the type of interface you want. Select PPP. Then a small window opens displaying a ppp0 entry. Double-click it to display the PPP interface window with panels for setting your modem connections, the phone number to dial, and the Expect and Send entries for your login name and password. To activate a connection, click Connect. You can also use dial-up managers like Kppp and gnomeppp to set up and manage your PPP connections.

With Webmin, select the Network Configuration page on the Hardware page. From the Network Configuration page, select the Network Interfaces page to configure your Ethernet device, entering information like the IP address, the netmask, and the device name (see Figure 5-4). On the Routing and Gateways page, you enter the IP address of your network's gateway, and on the DNS page you enter your name server addresses. On the Host Address page, you enter the hostname and IP address for your system along with any others you want.

DSL and ISDN

To connect using DSL you use adsl-config, and for ISDN connections you use isdn-config.

Both can be accessed through internet-config on the System menu. This will open a dialog box where you can select A-DSL/T-DSL, ISDN, or modem connections. The modem connection starts up Kppp, which is described in Chapter 36. You can also start them independently by entering their command in a terminal window.

adsl-config will display a dialog labeled Red Hat Internet Configuration. There will be entries for entering your login name, password, and the Ethernet interface your DSL modem is attached to (see Figure 5-5). You will also need to enter the IP addresses for the DNS servers provided by your ISP. You can also elect to have the connection automatically made up when your system starts up.

Figure 5-5: adsl-config, configuring DSL connections

adsl-config makes use of the pppoe utility to make your DSL connections. pppoe enables the use of dynamic IP addresses with an ISP over a DSL connection. Red Hat Linux uses the Roaring Penguin package of pppoe commands (rp-pppoe). As an alternative to adsl-config, you can use the adsl-setup command to configure your DSL connection. adsl has a command line interface and can be run at any shell prompt. As with adsl-config, you are prompted to enter your user name, password, Ethernet card, and domain name server addresses. You can also specify basic firewall security levels. You can then establish your DSL connection with the adsl-start command, and disconnect with the adsl-stop command.

isdn-config will display a dialog labeled Red Hat ISDN config and showing four panes

labeled Dial, Provider, Hardware, and About (see Figure 5-6). On the Dial pane you can make a connection to a selected ISP. On the Provider pane you enter information about your ISP.

You use the Hardware pane to configure your ISDN modem.

Figure 5-6: isdn-config, configuring ISDN connections

The Red Hat PPP Dialer

If you have a dial-up connection to an Internet service provider (ISP), you need to configure a PPP interface. Almost all ISPs currently use PPP connections. You can easily set up a PPP connection using the Red Hat PPP Dialer (rp3). Select its entry in the Internet submenu on the Gnome desktop. If you do not have any Internet connections set up already, the Add New Internet Connection dialog box starts up (to add a new connection, you can click the New button on the Red Hat Dialup Configuration Tool window, opened from its entry on the Gnome Internet menu). If you have not yet configured your modem, the dialer automatically attempts to detect your modem and to provide information, such as the speed and serial device it uses. You see a screen displaying this information, along with the sound level, which you can adjust (see Figure 5-7).

Figure 5-7: Red Hat PPP Dialer modem configuration

Next, you are asked to enter the name you want to use to identify this connection on your system, the account name (see Figure 5-8). You also enter the phone number used to dial your ISP.

Figure 5-8: Red Hat PPP Dialer name and phone number

You then enter the user name for your ISP account, along with its password (see Figure 5-9).

Figure 5-9: Red Hat PPP Dialer user name and password

When you finish, the final screen appears listing the account name, user name, and phone number, as shown in Figure 5-10.

Figure 5-10: Red Hat PPP Dialer final setup screen

Each time you want to connect, select the Red Hat PPP Dialer entry from the Gnome Internet menu. This displays a Choose window listing all your network connections, including any you created with the Red Hat PPP Dialer (see Figure 5-11). Double-click the account name you set up for your PPP connection. In Figure 5-11, the account name used for the PPP connection is myisp, which also shows an Ethernet connection (eth0) and the localhost connection.

Figure 5-11: Red Hat PPP Dialer

You are then prompted as to whether you want to start up the connection. Click the Yes button. A window appears that monitors the connection, showing a graph indicating the current activity on it (See Figure 5-12). You can minimize the monitor, docking it to the Gnome panel. Right-clicking the Monitor icon displays a menu with entries for starting, stopping, and configuring the connections, along with the connection properties. The

Properties dialog box enables you to set such features as calculating the time and the cost of a connected session. The monitor is actually part of the Red Hat Network Monitor tool. You can select this tool independently on the Gnome Internet menu and display monitors for all your network connections.

Figure 5-12: Red Hat Network Monitor tool

You can also place the network monitor for your PPP connection on the Gnome panel. Here it is displayed in a smaller size as a Gnome applet. To start your PPP connection, you only need to double-click the PPP network monitor. Right-clicking the monitor image displays a menu with options for starting and configuring your connection. To add a monitor to the Gnome panel, use the Panel menu on the Gnome Main menu. In the Panel menu, select Add Applet, and then the Network submenu, and, from there, select the RH PPP Dialer entry. This displays a list of all the network connections on your system. Select the one you want placed on the panel. The monitor bears the name you have to the PPP connection. In Figure 5-13, the PPP network monitor has the name myisp. You can place any of your network monitors on the Gnome panel. Figure 5-13 shows a monitor for both the Ethernet and PPP connections.

Figure 5-13: Red Hat network monitors on the panel

To change your setting or to add a new connection, use the Red Hat PPP Dialer Configuration tool. On the Gnome Internet menu, select the Dialup Configuration Tool entry to start up the Configuration tool. It then displays a window with two tabbed panels: one listing your accounts and the other for your modem configuration. Buttons on the right side of the Accounts panel enable you to add new connections or to edit current ones (see Figure 5-14).

Figure 5-14: Red Hat PPP Dialer Configuration tool

The Edit button opens a window with panels for modifying connection and modem

information (see Figure 5-15). On the Account Info panel, you can change your login name (user name), password, and phone number for your ISP. On the Advanced panel, you can enter information such as the IP address of your ISP's domain name servers.

Figure 5-15: Editing a PPP connection

The Red Hat PPP Dialer uses the wvdial utility to perform the connection operations. You can find the configuration information for your connections in the /etc/wvdial.conf file. You can, if you choose, edit this file directly to configure your PPP connections.

Command Line PPP Access: wvdial

If, for some reason, you have been unable to set up your X Window System, you may have to set up such a network connection from the command line interface instead of a desktop. The following discussion shows how to make such a connection using wvdial. wvdial is the standard dialer used on Red Hat systems.

For a dial-up PPP connection you can use the wvdial dialer, the same dialer used for the Red Hat PPP Dialer. wvdial is an intelligent dialer, which not only dials up an ISP service but also performs login operations, supplying your user name and password. wvdial first loads its configuration from the /etc/wvdial.conf file. In here, you can place modem and account information, including modem speed and serial device, as well as ISP phone number, user name, and password. The wvdial.conf file is organized into sections, beginning with a section

For a dial-up PPP connection you can use the wvdial dialer, the same dialer used for the Red Hat PPP Dialer. wvdial is an intelligent dialer, which not only dials up an ISP service but also performs login operations, supplying your user name and password. wvdial first loads its configuration from the /etc/wvdial.conf file. In here, you can place modem and account information, including modem speed and serial device, as well as ISP phone number, user name, and password. The wvdial.conf file is organized into sections, beginning with a section