⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 0250-0253.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:


<HTML>

<HEAD>

<TITLE>Developer.com - Online Reference Library - 0672311739:RED HAT LINUX 2ND EDITION:TCP/IP Network Management</TITLE>

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!-- ISBN=0672311739 //-->

<!-- TITLE=RED HAT LINUX 2ND EDITION //-->

<!-- AUTHOR=DAVID PITTS ET AL //-->

<!-- PUBLISHER=MACMILLAN //-->

<!-- IMPRINT=SAMS PUBLISHING //-->

<!-- PUBLICATION DATE=1998 //-->

<!-- CHAPTER=13 //-->

<!-- PAGES=0243-0298 //-->

<!-- UNASSIGNED1 //-->

<!-- UNASSIGNED2 //-->









<P><CENTER>

<a href="0247-0249.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0254-0256.html">Next</A>

</CENTER></P>



<A NAME="PAGENUM-250"><P>Page 250</P></A>











<H4><A NAME="ch13_ 10">

Stock Network Configuration

</A></H4>









<P>Red Hat Linux comes with networking enabled. The easiest way to get started with

networking is to configure it as part of your installation. If you are not familiar with the

information requested, you can skip it and reconfigure it later with the

netcfg program.

</P>









<P>Begin by starting up the X Window environment and running

netcfg from an xterm window. The opening window should look something like Figure 13.1.

</P>



<BR>

Figure 13.1.

The Network<BR>

Configurator Names menu.<BR>

<a href="11rhu01.html"><img src="images/tn_11rhu01_jpg.jpg"></a><BR>











<P>If your Hostname: and Domain: entries already have entries in them, don't worry. That

just means you've already set those values during the installation. If not, enter the appropriate

information for your hostname and domain name. If you are unsure of these, contact your

local network administrator to find out.

</P>









<P>The Search for hostnames in additional domains: box should be left blank unless you want

to be able to specify hostnames from multiple domains without having to use their fully

qualified domain names. This is usually a bad idea.

</P>









<P>The Nameservers: box is important. This will tell your network where to resolve

hostnames that are not local to your network. Each line should contain the IP address of every DNS

server you want to query (with a maximum of three). If you do not know this information,

again, contact your network administrator and ask. If you are the network administrator, read

the section on setting up a DNS server, &quot;The Domain Name Service.&quot;

</P>









<P>When you are done entering this information, click the Hosts button at the top of the

window. The window will change to look like Figure 13.2.

</P>



<A NAME="PAGENUM-251"><P>Page 251</P></A>



<BR>

Figure 13.2.<BR>

The Network<BR>

Configurator Hosts menu.<BR>

<a href="11rhu02.html"><img src="images/tn_11rhu02_jpg.jpg"></a><BR>









<P>This is what will become the /etc/hosts file. (See the section &quot;The Domain Name

Service,&quot; later in this chapter, for detailed information.) This file essentially provides a mapping

from hostnames to IP numbers. At the very least, you should provide mappings for any machines

on your network necessary as part of your boot procedure (such as servers). For example, if

you wanted to add an entry for the host vestax whose IP address is

192.168.42.7, you would do the following:

</P>









<OL>

<LI>Click the Add button, which is toward the bottom of the window. This brings up

    the Edit /etc/hosts window; it has three entries.

<LI>In the first box for the IP number, enter

    vestax's IP address.

<LI>In the Name box, enter the name

    vestax.

<LI>If vestax has any aliases, you can enter them in the Nicknames box. If there are

    no aliases, leave that box blank.

<LI>Click Done to finish adding this entry. The Edit

    /etc/hosts window will close and the main window will show your addition in the table.

</OL>









<P>After you have entered all the hosts your system needs to know at boot time, click the

button labeled Interfaces at the top of the window. The window will change to look like Figure 13.3.

</P>









<P>You can configure an Ethernet device from this window. To configure your Ethernet card,

do the following:

</P>









<OL>

<LI>Click the Add button at the bottom of the screen to bring up the Choose

    Interface window.

<LI>In the Choose Interface window, click the button to select Ethernet and then

    click OK. The Choose Interface window will disappear and a new window titled

    Edit Ethernet/Bus Interface will appear.

</OL>







<A NAME="PAGENUM-252"><P>Page 252</P></A>









<BR>

Figure 13.3.<BR>

The Network Configurator<BR>

Interfaces menu.<BR>

<a href="11rhu03.html"><img src="images/tn_11rhu03_jpg.jpg"></a><BR>









<OL START=3>

<LI>In the Edit Ethernet/Bus Interface window, click the IP box and enter the IP

    address of your machine. The Netmask: box will automatically fill in, based on the

    address you provide in the IP box. If this is not correct, click the Netmask: box and make

    the necessary corrections.



<LI>If you want this interface to automatically start at boot time, click the

    Activate interface at boot time button. Leave the Allow any user to (de)activate interface

    box unselected. It is a very bad practice to allow nonroot users to configure

    network settings.



<LI>The Interface Configuration Protocol enables you to select alternative

    methods (BOOTP or DHCP) to configure your network interface. Unless you have

    been instructed by a network manager to use these protocols, leave this box blank.

    Click Done to bring up a new window asking whether you want to save the current

    configuration. Click Save to keep your addition. Both windows will close, leaving you

    back with the original Network Configurator window, this time showing your new

    network interface.

</OL>









<P>With your interface defined, you can now set routes and gateways for your machine. Click

the button labeled Routing at the top of the window. This will change the Network

Configurator window to look like Figure 13.4.

</P>









<P>To set up your routing information, follow these steps:

</P>









<OL>

<LI>Click in the Gateway box and enter the IP address of your gateway to rest of

    the network. If you do not have a gateway machine (for example, you're configuring

    a local area network without an Internet connection), you can leave this blank.



<LI>If you do have a gateway, enter the device name from which the gateway will

    be accessed. Most likely, this will be the device name that was configured in the

    Interfaces part of the Network Configurator window. If you are using a Ethernet card,

    this will most likely be eth0.

</OL>



<A NAME="PAGENUM-253"><P>Page 253</P></A>







<BR>

Figure 13.4.<BR>

The Network Configurator<BR>

Routing menu.<BR>

<a href="11rhu04.html"><img src="images/tn_11rhu04_jpg.jpg"></a><BR>









<OL START=3>

<LI>Click Save at the bottom of the window and then click Quit, which is also at

    the bottom. This will exit the netcfg program.

</OL>









<P>Your system now has the necessary scripts configured to establish your network

connection. Before you can claim victory, you need to test the connection. Enter the following

command to start the network connection:

</P>





<!-- CODE SNIP //-->

<PRE>

/etc/rc.d/init.d/network stop;/etc/rc.d/init.d/network start

</PRE>

<!-- END CODE SNIP //-->











<P>This will restart your network connection. Try pinging a machine in your immediate

network using the ping command, like this:

</P>





<!-- CODE SNIP //-->

<PRE>

ping IP_Address

</PRE>

<!-- END CODE SNIP //-->











<P>where IP_Address is the IP address of the machine you are trying to ping. If you placed the

IP address to hostname mapping in the Hosts section in

netcfg, then you can use the hostname instead. This should return output similar to this:

</P>





<!-- CODE //-->

<PRE>

PING 192.168.42.1 (192.168.42.1): 56 data bytes

64 bytes from 192.168.42.1: icmp_seq=0 ttl=255 time=1.0 ms

64 bytes from 192.168.42.1: icmp_seq=1 ttl=255 time=3.5 ms

-- 192.168.42.1 ping statistics --

2 packets transmitted, 2 packets received, 0% packet loss

round-trip min/avg/max = 1.0/24.4/47.8 ms

</PRE>

<!-- END CODE //-->











<P>Note that in order to get ping to stop, you need to press Ctrl+C.

</P>









<P>If you have an Internet connection, try pinging a machine outside of your network. This

should result in output similar to the preceding, with the notable exception that the time

measurements will be longer. If the ping fails at this point, try another host; it could be the other

machine that has failed and not yours.

</P>









<P>If the pings fail, restart netcfg and verify the information you

provided it.

</P>



<P><CENTER>

<a href="0247-0249.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0254-0256.html">Next</A>

</CENTER></P>









</td>
</tr>
</table>

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -