CentOS work Content (iii) configure network IP address

Source: Internet
Author: User

CentOS work Content (iii) configure network IP address

Shortcut keys to use

tab Auto-completion (do you have any idea)

Ctrl + a moves to the beginning of the current line (a ahead)

ctrl+u Delete (cut) here to start all content

Vim

In the last row mode

: Ser nu and enter line number directly

In edit mode

Where i is the character after which the output is inserted before the current cursor position. The command I inserts the following character into the beginning of the line where the current cursor is located

Where command A is inserted after the character entered after the current cursor position, and command a is appended with the character entered next to the line at the end of the current cursor

Command mode

U Undo Last Action

GG cursor quickly back to the bottom of the file

o start at the beginning of the next line of the cursor and enter edit mode

The configuration file name of the first NIC is called Ifcfg-eth0

The configuration file name of the first NIC is called Ifcfg-eth1

// Nic Directory address cd/etc/sysconfig/network-scripts/

Edit the first NIC configuration file

centos6.x Network card configuration file onboot parameter default is no, you must modify it to Yes, otherwise you can not take effect after configuring the IP address through the command

Vim Ifcfg-eth0

DHCP mode

First step: In the last row mode

: Ser nu

Step Two: Re-enter the last line mode

Enter line number 5

Step three: Enter command A For additional text, move to end of line

Fourth Step: Enter Yes

Fifth step: Save in the last row mode

Shift key +ZZ or x key

Static IP mode

DHCP mode

First step: In the last row mode

: Ser nu

Step two: Press ESC to enter command mode, GG cursor quickly go back to the bottom of the file, o the line at the beginning of the next row of the cursor and enter the editing mode

Step three: Enter the content below

Ipaddr=192.168. 1.117  // Network IP   Bootproto=static   //None for static IPnetmask=255.255.  255.0  // subnet mask gateway=192.168.  1.254   // Gateway dns1=114.114.  114.114  //DNS server address can be edited in resolv.conf ipv6init=no    // do not use IPV6 

Fourth step: Save in the last row mode

Shift key +ZZ or x key

Modifying the resolv.conf file will have DNS configuration information

vi /etc/resolv.conf  // Edit the DNS configuration file

Enter inside the resolv.conf file

144.114. 114.114

If the resolv.conf file has nothing, specify the DNS address in the NIC configuration file

Restart the network service for configuration to take effect

Servic Network Restart

ifconfig  // Check IP address

Setting the bridging mode in the virtual machine

Under Windows, you can ping the

Can be on Baidu

Tips

You can turn off the firewall first.

Iptables-f

The difference between disabling the NIC service and Ifup and Ifdown

After you disable the network card or need IFUP to enable the network card

Note: Ubuntu network card directory address is not the same

Centos

// Nic Directory address cd/etc/sysconfig/network-scripts/

Ubuntu

VI  /etc/network/interfaces

In the interfaces file a network card to add a section, multiple network cards to add multiple sections

Auto Eth0iface eth0 inet static address192.168.100.35netmask255.255.255.0Network192.168.100.0Broadcast192.168.100.255Gateway192.168.100.254# DNS-* options is implemented by the RESOLVCONF package,ifinstalled DNS-nameservers202.102.224.68

F

CentOS work Content (iii) configure network IP address

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.