Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set basic network parameters in Linux

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, the editor will bring you about how to set basic network parameters in Linux. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.

I. introduction

In the Red Hat Linux 6.0system, with its own Netscape browser, when Linux accesses the Internet through the Ethernet card, the Linux system must be configured accordingly, such as host, domain name, gateway, router and so on. In the actual configuration, you can use four methods:

First, based on the control panel method

Second, the linuxconf method based on X

Third, linuxconf method based on Web browser

Fourth, use the command method manually.

Second, based on control panel method

Network Configuration in Linux's control panel provides an integrated configuration environment that is easy to master. First check if the control panel is installed when you install Red Hat Linux.

# rpm-ga grep control

If the control panel is installed, the screen displays: contrl-panel-3.7-7

If the package is not installed, type the following command:

# rpm-I / mnt/cdrom/Red Hat / rpms / usercfg-3.5-6.i386.rpm

Click the Network Configuration button in the control panel window, and the Network Configurator window appears (figure 1).

1) Names tag

The tag provides four aspects of information:

(1) Hostname (hostname)

Including the machine name and the full domain name where the machine is located. The format is: localhost.local domain, for example, lgx.linux.net, where lgx is the host name of the local machine and linux.net is the domain name where the machine is located.

2) Domain (domain name)

The complete domain name where the machine is located, that is, the "in the host name." The back part. Enter: linux.net here

(3) Search for hostnames in additional domains (look for host names in other domain names)

This item can be left unfilled.

(4) Nameservers (name server)

DNS, which lists a list of computers that provide domain name services to the network, one per line. To provide a list of name servers, give the IP address of the domain name server provided by the ISP service provider. For example: 163.1.1.4, 10.55.0.33.

2) Hosts tag

This tag provides the computer's host table, which is placed in the / etc/host file. Click the Hosts tab and click the "Add" button to bring up the dialog box (figure 2).

The host table file contains the machine name, IP address and computer replacement name. If there is no domain name server in a small network, the host table should contain the names and IP addresses of all machines in the network. There are at least two items, IP and name, on networked machines. Operations on the table include add (Add), edit (edit), delete (remove) and so on.

First, edit the local machine project. Enter 163.1.5.125 lgx.linux.net in the IP column. In the nickname column, you can

3) Interfaces tag

This is a configuration label for a network interface. By default, the table provides a lo project (local loopback device), which is not deleted, it is a necessary project for Linux network work, and the corresponding IP address is 127.0.0.1.

If the user wants to access Internet through the Ethernet card, please select the eth0 item in the table (Note: the first network card device is named eth0, the second device is eth2, and so on). Click the "Remove" button, delete it, and then click the "Add" button to bring up the interface type dialog (figure 3).

Please select the "Ethernet" single option, click the "OK" button, and the edit Ethernet/Bus interface dialog box appears. The dialog box contains the following:

(1) enter the physical address of the network card in the IP segment, that is, the native IP address. Such as 163.1.5.125.

(2) enter the subnet mask in the Netmask field, such as 255.255.0.0.

(3) the Network field is automatically given to 163.1.5.0.

(4) the Broadcast field is given automatically

(5) the Activate interface at boot time single option activates the interface in order to use the network each time it is started. It is recommended to select this option.

(6) the Allow any user to (de) activate interface option allows any user to activate or disable the network interface. For dial-up interfaces such as PPP, each user has to establish a network connection, so you can select this option. For users connected to Ethernet, you do not have to select this item.

(7) Interface configuration protocol option interface configuration protocol. Specifies that the server provides the workstation with the information needed for network operation. Allows the native machine to obtain the configuration from the server each time the interface is activated. It has three options: none,BOOT and DHCP. Generally choose "none".

4) Routing tag

This label is used to configure routing. Tell the computer how to send some data to the target host on the network. If the network uses the default gateway, simply indicate the default gateway IP address and the native network card etho.

After completing the above four tabs, click the "save" button in the Network Configurator window and save the disk to exit.

3. Linuxconf method based on X

First log in to the Linux system by the root user, in the Gnome environment, click the footprint button, point to "system", select the "control-panel" subkey to launch the control panel, and then click the System Configuration icon. Or click the footprint button, point to the "system" option, select the linuxconf option), and the working interface of linuxconf in xterm appears (see figure 4).

⑴ open the "Networking / Client tasks / Basic host Information" branch, select the Host name tag and enter the host name; select the Adaptor 1 tag and select the "enable" option to indicate that the first network card can be used; select Manual; and fill in: Primary name + domain (hostname). Domain names, such as: lgx.linux.net), IP address (IP address of the host, such as 163.1.5.125), Net mask (subnet mask, such as 255.255.0.0), Net device (network device name eth0), Kernel module (kernel module, if it is the network card of ne2000, you should enter ne), port (0x300), Irq > (interrupt number, such as 3) and other options.

⑵ opens the "Networking / Client tasks / Name Server Specification (DNS)" branch, pops up the Resolve configuration dialog box, and selects "DNS is required for normal operation"; then fill in: Default domain (the default domain name) and Nameserver1 (the IP address of the first DNS server, such as 163.1.1.4; on the next line, you can also fill in the IP address of the second DNS server, such as 10.55.0.33).

⑶ opens the "Config / Networking / Routing and gateways" option, and a pop-up Defaults dialog box, fill in the default gateway IP value in the Default gateway field, such as 163.1.1.254, and select the "enable routing" option.

⑷ accepts the above written values, activates and exits.

Note: if you execute linuxconf at the prompt "#", the configuration method under the xterm terminal is similar.

4. Linuxconf method based on Web

In Red Hat Linux 6.0, linuxconf can also work in a Web browser environment by:

⑴ opens the "Config / Networking / Misc / Linuxconf network access" branch in the gnome-linuxconf dialog box.

⑵ enters the hostname of any computer that is allowed to use Linuxconf in the dialog box, including the user hostname.

⑶ select the "Accept" button, press the spacebar, and click the "Quit" button.

⑷ launches the Netscape browser and type: http://:98/ in the URL bar, where the required option hostname should be changed to the hostname of the user's computer.

⑸ select the "Start" button at the bottom of the browser page, and in the pop-up password verification box, enter root and the corresponding password, respectively, if the password is correct

Enter the Linuxconf work environment shown in figure 5.

⑹ clicks the "Networking" option under the config box and pops up the Network Configurator page. In the Client tasks box, click "Basic host information", "Name server specification (DNS)" and "Routing and gateways" to enter host information, name server and routing and gateway information, respectively.

After the ⑺ operation is completed, the save disk exits.

5. Manual use of command method

The manual use of the command method is based on editing the configuration file to configure the network when the Ethernet card has been loaded. The specific steps are as follows:

⑴ Editing / etc/rc.d/rc.local File

Add lines similar to the following in the file:

# configure the IP address, subnet mask and UP of the first Ethernet card eth0 to activate

/ sbin/ifconfig,etho 163.1.5.125 netmask 255.255.0.0 UP

# configure and activate the loopback device lo

/ sbin/ifconfig lo 127.0.0.1 UP

/ sbin/route add-host 127.0.0.1 lo

# ask Linux to send local network information to eth0 interface

/ sbin/route add-net 163.1.5.125 netmask 255.255.0.0 eth0

# specify the default gateway to access the remote network, assuming that the IP address of the default gateway is 163.1.1.254

/ sbin/route default gw 163.1.1.254 eth0

⑵ Editing / etc/resdv.conf File

The purpose of this file is to set the name server. The following can be added.

# specify the native domain name as linux.net.

Domain linux.net

# Domain name is called server (DNS), which can be local network or remote network. Search one by one in the order of # in nameserver. If it is not found, Linux abandons the search.

Nameserver 163.1.1.4

Nameserver 10.55.0.33

⑶ Editing / etc/hosts.conf File

Set up the host file table. You can add the following line:

Order hosts,bind

Multi on

163.1.5.125 lgx.linux.net lgx

The first line says: when looking for a name, first check the local host file (hosts), and then look for it in the Nameservers order specified by / etc/resolv.conf.

The third line lists the host IP address, hostname, and alias.

After editing the / etc/rc.d/rc.local,/etc/hosts.conf,/etc/resolv.conf three files, you must restart the machine.

This is how to set the basic network parameters in the Linux shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report