Linux Learning CentOS 7----Network adapter configuration

Source: Internet
Author: User

Body

Linux system version: Centos 6.5

Linux system version: Centos 7

Earlier, we used the remote tool SECURECRT, with the "ifconfig eth0 + specific IP Address" command to the Linux with an IP address (refer to my blog: Remote login management tool for the use of SECURECRT), but this configuration problem is:

    • 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, theIP address, subnet mask, gateway, and DNS are integral. Today, how to really give CentOS a IP, and set up successfully, by using the SECURECRT software, the same LAN on another Win7 system computer can also remotely access the Linux on this computer. There are many methods, and in the following two methods, I use the bridge mode in the virtual machine. If you install a dual system, the configuration method is the same. Given that there is a small difference between CentOS 6.5 and CentOS 7, here are a few words.

One, Centos 6.5 (server version) of the network card configuration:

"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 

The modification information is as follows:

E=eth0//Nic NameHwaddr=00:0C:29:5C:94:74//Physical AddressType=ethernetuuid=36c43db3-95a9-427c-af8f-Ba130189de85onboot=yes//Change onboot= "No" to onboot= "yes"Nm_controlled=yesbootproto=noneipaddr= 192.168.1.98 // Modify IP address netmask=255.255.// Modify the subnet mask gateway =192.168. 1.1 // Modify Gateway dns1=8.8. 8.8 // Modify DNS server 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:

Note: This configuration is permanently in effect.

"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:

, 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:

Specifically how to use the SSH service, please refer to my other blog: Remote login management tool SECURECRT use

Second, Centos 7 (server version) of the network card configuration:

CentOS 7 has a lot less in the NIC configuration file, so it is still necessary to mention the following separately, but it is the same as the CentOS 6.5 configuration method.

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

vim/etc/sysconfig/network-scripts/ifcfg-eno16777736 

The default configuration information is as follows:

Type=ethernetbootproto=Dhcpdefroute=yesipv4_failure_fatal=noipv6init=yesipv6_autoconf=yesipv6_defroute=yesipv6_failure _fatal=noname=eth0uuid=2e09b0f4-ec1a-44b0-8066-7da7ce04ff02onboot=nohwaddr=00:0c:29:46:8C: C0peerdns=yespeerroutes=yesipv6_peerdns=yesipv6_peerroutes=yes                 

Modify the content Bootproto, and add content ipaddr, NETMASK, GATEWAY, DNS, the final effect is as follows:

Type=Ethernetbootproto=static//Change "DHCP" to "static"Defroute=Yesipv4_failure_fatal=noipv6init=yesipv6_autoconf=Yesipv6_defroute=Yesipv6_failure_fatal=Noname=eth0uuid=2e09b0f4-ec1a-44b0-8066-7da7ce04ff02onboot=yes//Change "no" to "yes"Hwaddr=00:0C:29:46: 8c:c0peerdns=yespeerroutes=yesipv6_peerdns=yesipv6_peerroutes=yesipaddr=192.168. 1.99 //netmask= 255.255.255.0 // add subnet mask gateway=192.168.//dns1=8.8. 8.8 // increase DNS   

(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:

So, it's done.

Linux Learning CentOS 7----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.