Linux Learning CentOS (iii): NIC configuration

Source: Internet
Author: User

Linux system version: Centos 6.5

In the Linux learning CentOS (ii): Virtual network Three ways of connection and SECURECRT use, using Remote Tools SECURECRT, through the "ifconfig eth0 + specific IP Address" command to Linux with IP address, However, this configuration has the following problems:

    • Can only take effect temporarily, once reboot, need reconfiguration;
    • Only the IP address and subnet mask can be configured to connect to the intranet, it is not possible to connect the external network.

If you want to connect to an extranet, the IP address, subnet mask, gateway, and DNS are integral.

How to truly assign an IP to the CentOS, and after successful setup, by using SECURECRT software, another Win7 system computer in the same LAN can access Linux on this computer remotely. There are many methods, and in the following two methods, I use the bridge mode in the virtual machine. If a dual system is installed, the configuration method is the same.

"Method One" directly modifies the NIC configuration file:

(1) Enter the following command to modify the network card configuration file:

Vi/etc/sysconfig/network-scripts/ifcfg-eth0

Type I into edit mode, then use: Wq Save (! Force

Note: To be modified in root,-----E212: Cannot open and write to the file.

The modified information is as follows:

E=eth0//NIC name hwaddr=00:0c:29:5c:94:74//Physical Address type=ethernetuuid=fc008d0e-3f41-4d8d-8862-8b1659f8e93bonboot=yes// Change onboot= "No" to onboot= "yes" nm_controlled=yesbootproto=noneipaddr=192.168.1.20//Modify IP address netmask=255.255.255.0// Modify Subnet mask gateway=192.168.1.1//Modify Gateway dns1=8.8.8.8//Modify DNS server Ipv6init=nouserctl=no

(2) Restart the Network service:

To take effect, you must restart Linux or restart the network service, we restart the network service, execute the following command:

Service Network restart

If the display works as follows, the configuration is successful and the Internet access is available:

"Method Two" is one of the simplest: using the Redhat Series's own tool Setup command

Note: If the Linux distribution is not a Redhat series, it can only be modified by the configuration file (that is, method one above).

(1) Modify IP:

Enter the following command:

Setup

The following window pops up:

, select the third item: Network configuration. The following screen appears:

( Note: As I have configured here, the following steps and just reference )

, the first one is with IP, the second is with DNS. We select the first one, which pops up the following interface:

To eth0 this NIC configuration IP, pop up the following interface:

, the "*" number represents the automatic acquisition of IP, if you want to automatically obtain, the LAN must have automatic allocation of IP servers exist (that is, the DHCP server), in the current environment, can only be manually configured, we modify the parameters as follows:

, press the SPACEBAR to remove the "*", and then we can switch by tabbing and then set the individual fields. This is the time to configure.

(2) Turn on the network card service:

The CentOS default network card is not started, we execute the following command, modify the NIC configuration file:

Vi/etc/sysconfig/network-scripts/ifcfg-eth0

Then, change onboot= "No" to onboot= "yes", the effect is as follows:

This time, the configuration is complete, you can access the Internet. And the same LAN in another Win7 system computer can also remotely access the Linux on this computer, if the Linux system already has the SSH service, we now install the Linux version, will be installed SSH, the default is OpenSSH

You can view the installed SSH version information by using the following command:

Ssh-v

The SSH version information I installed for CentOS 6.5 is as follows:

Linux Learning CentOS (iii): Network adapter configuration

Related Article

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.