Four methods of setting basic network parameters in Linux operating system

Source: Internet
Author: User
Tags config manual domain name server nameserver

First, the introduction

In the Red Hat Linux 6.0 system, when you have a Netscape browser that lets Linux access the Internet via an Ethernet card, you must configure the Linux system appropriately, such as hosts, domain names, gateways, routers, and so on. In the actual configuration, you can use four methods:

Firstly, based on the control Panel method;

Secondly, the Linuxconf method based on X;

Third, the Linuxconf method based on web browser;

Four, use the command method by hand.

Second, based on the control Panel method

The network configuration in the Linux Control Panel provides an easy to master integrated configuration environment. First check to see if the control Panel is installed when Red Hat Linux is installed.

# Rpm–ga grep Control

If Control Panel is installed, the screen appears: Contrl–panel-3.7-7

If this 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 to appear in the Network Configurator window (shown in Figure 1).

1) Names label

The label provides four aspects of information:

(1) Hostname (host name)

Include the machine name and the full domain name of the machine. The format is: localhost.local domain, for example, Lgx.linux.net, where LGX is the local machine main name, linux.net is the domain name of this machine.

(2) Domain (field name)

The full domain name of the machine, that is, "in the host name." "Back section. Here input: linux.net

(3) Search for hostnames in additional domains (find host name in other domain name)

This item is not filled in.

(4) nameservers (name server)

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

2) Hosts label

The label provides the host table for the computer, and the host table is placed in the/etc/host file. Click the Hosts tab and click the "Add" button to eject the dialog box (Figure 2).

The host table file contains the machine name, the IP address, and the computer replacement name. If there is no domain name server in a small network, the host table should contain the names of all machines on the network and their respective IP addresses. There are at least IP and name two items on a network-connected machine. Actions on this table include adding (add), Editing (edit), deleting (remove), and so on.

First edit the Local machine project, enter the 163.1.5.125,name column in the IP bar, enter Lgx.linux.net, and in the nickname column, you can < Enter the replacement name of the computer, such as lgx0, and separate the alternate names with a space. >

3) Interfaces label

This is a configuration label for a network interface. By default, the table provides an LO project (a local loopback device) that is not deleted and is a required project for Linux network work, with a corresponding IP address of 127.0.0.1.

If the user is trying to access the Internet via an Ethernet card, select the Eth0 item in the table (note: The first NIC device is named Eth0, the second is eth1, and so on). Click the Remove button, remove it, and then click the Add button to eject the Interface Type dialog box (Figure 3).

Select the Ethernet option and click the OK button to appear in the Edit Ethernet/bus interface dialog box. The dialog box contains the following contents:

(1) IP segment Input network card physical address, that is, the local IP address. such as 163.1.5.125.

(2) netmask field input subnet mask, such as 255.255.0.0.

(3) The network field automatically gives 163.1.5.0.

(4) The Broadcast field is automatically given

(5) Activate interface at the boot time option activates the interface at each startup to use the network, and it is recommended that the item be selected.

(6) The Allow any user to (DE) Activate interface option allows any person to activate or turn off the network interface. For dial-up interfaces such as PPP, a network connection is established for each user, so you can select the item. For users with an Ethernet connection, you do not have to select the item.

(7) Interface Configuration Protocol option Interface Configuration Protocol. Specifies the information the server needs to provide network operations to the workstation. Enables the local computer to obtain configuration from the server each time the interface is activated. It has none,boot and DHCP three options. General selection "None".

4) Routing Label

This label is used to configure routing. Tells the computer how to upload some data to the target host on the network. If the network uses a default gateway, it simply indicates the default gateway IP address and the native Nic Etho.

When you are done with the four tabs above, click the Save button in the Network Configurator window to log out.

Three, linuxconf method based on X

First log on to the Linux system by the root user, in the GNOME environment, click the Footprint button, point to "system", select "Control-panel" to start Control Panel, and then click the System Configuration icon. Or click the Footprint button, point to the "System" option, select the Linuxconf option), and linuxconf the working interface in xterm (see Figure 4).

⑴ Open the "Networking/client tasks/basic host Information" branch, select the host name tag, enter the hostname, select the Adaptor 1 tab, and select the "Enable" option to indicate the ability to use the first NIC; Select the configuration mode to manual, and then fill in: Primary name + domain (host name) respectively. Domain names, such as: Lgx.linux.net, IP address (host IP addresses, 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 a ne2000 network card, you should enter NE), I/O port (I/O ports address, such as 0x300), irq> (interrupt number, such as 3) options.

⑵ opens the Networking/client tasks/name Server Specification (DNS) branch, pops up the Resolve Configuration dialog box, and selects the DNS is required for normal Operation "; then fill in: Default domain (default) 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 Options

⑶ opens the "Config/networking/routing and gateways" option, pops up the Defaults dialog box, fills in the default gateway IP value, such as: 163.1.1.254, and selects the " Enable Routing "option.

⑷ accepts the above write value, activates and exits.

Note: Under the prompt "#", the configuration method is similar to the Xterm terminal if the linuxconf is executed.

Four, web-based linuxconf method

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

⑴ in the gnome-linuxconf dialog box, open the CONFIG/NETWORKING/MISC/LINUXCONF Network Access branch.

⑵ in the dialog box, enter any host name for the computer that is allowed to use linuxconf, including the user host name.

⑶ Select the "Accept" button and press the SPACEBAR to click the "Quit" button.

⑷ start Netscape Browser, type in the URL bar: http://:98/where the required option hostname should be replaced with the host name 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, if the password is correct,

Enter the LINUXCONF working environment as shown in Figure 5.

⑹ Click on the "Networking" option under the Config box, pop-up Network Configurator page, in which the Client tasks box, click "Basic host Information", "Name server Specification (DNS) "," Routing and Gateways ", enter information such as host information, name server, and Routing and gateway, respectively.

After the ⑺ operation is complete, save the disk and exit.

V. Manual use of the command method

The manual use of the command method is based on the Ethernet card is mounted in the case of editing the configuration file to configure the network method. The specific steps are as follows:

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

Include the following lines in the file:

#配置第一个以太网卡eth0的IP地址, subnet mask, up activate

/sbin/ifconfig,etho 163.1.5.125 netmask 255.255.0.0 up

#配置并激活回环设备lo

/sbin/ifconfig Lo 127.0.0.1 up

/sbin/route add–host 127.0.0.1 Lo

#让Linux将本地网的信息发送到eth0接口

/sbin/route add–net 163.1.5.125 netmask 255.255.0.0 eth0

#指定访问远程网络的缺省网关, assume that the IP address of the default gateway is 163.1.1.254

/sbin/route default GW 163.1.1.254 eth0

⑵ Edit/etc/resdv.conf File

The file role is to set the name server. You can add the following content.

#指定本机域名为linux. Net.

Domain linux.net

#域名称服务器 (DNS), either a local or remote network. Look in the order of nameserver. If not found, Linux gives up looking.

Nameserver 163.1.1.4

Nameserver 10.55.0.33

⑶ Edit/etc/hosts.conf File

Sets the host file table. You can add the following lines:

Order Hosts,bind

Multi on

163.1.5.125 lgx.linux.net LGX

The first line indicates that when you look up a name, you first check the local host file (hosts) and then follow the nameservers order specified by/etc/resolv.conf.

Third, the host IP address, host name and alias.

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

V. Concluding remarks

To sum up, as long as the use of any one of the methods, the definition of host name, host table, network interface equipment and routing parameters, configure a good Linux Ethernet, you can access the Internet, enjoy the services provided by the Internet.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.