RHEL7.0 Series-Set IP address, gateway, and DNS

Source: Internet
Author: User
Tags get ip

1.1. Set the IP address, gateway, and DNS

RHEL7 inside the network card naming method from the eth0,1,2 way into the enoxxxxx format. En stands for enthernet (Ethernet), O stands for onboard (built-in), and that number is automatically generated by an index number of the motherboard to ensure its uniqueness. Compared with the original naming method, this new way is longer, difficult to remember, but the advantage is that the number is unique, when the system migration is not prone to error.

Description: RHEL 7.0 is installed by default and does not automatically open the network connection!

Method 1 , enter the network provisioning file directory and modify the NIC configuration file as shown in:

Type= "ethernet| Bridge "Network Interface type

Bootproto= "Static|none" #启用静态IP地址 (bootproto=dhcp enable dynamic get IP)

Defroute= "Yes"

Ipv4_failure_fatal= "No"

ipv6init= "Yes|no" Support IPV6

Userctl= "Yes|no" allows ordinary users to control this interface

Peerdns= "Yes|no" is not an accepted DNS server address assigned by the DHCP server

ipv6_autoconf= "Yes"

Ipv6_defroute= "Yes"

Ipv6_failure_fatal= "No"

Name= "eno16777736"

Uuid= "8071CC7B-D407-4DEA-A41E-16F7D2E75EE9" Device identification number

onboot= "yes" #开启自动启用网络连接 (default value is NO)

ipaddr0= "192.168.21.128" #设置IP地址 only valid in Bootproto={none|static} settings

Prefix0= "" #设置子网掩码 This setting is also available Prefix=n (n is the number of masked bits)

gateway0= "192.168.21.2" #设置网关 to belong to the same network segment as the IP address

dns1= "8.8.8.8" #设置主DNS

Dns2= "8.8.4.4" #设置备DNS

Hwaddr= "00:0c:29:eb:f2:b3"

Ipv6_peerdns= "Yes"

Ipv6_peerroutes= "Yes"

Service Network Restart #重启网络

To view IP information:

ifconfig command or IP addr Show or IP addr show Dev network device name or IP addr View all NIC information.

#ip Addr Show Dev eno16777736

650) this.width=650; "Style=" border-bottom:0px; border-left:0px; border-top:0px; border-right:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6E/5D/wKiom1V6O8mRdR_ Kaaeuhruqtom667.jpg "" Height= "/>"

1. Interface status

2. Hardware

3.ipv4 Address and Subnet

4. Broadcast address, range, device name

5.ipv6 Information

The IP command is realistic about network performance statistics, receive (RX) send (TX) packets.

650) this.width=650; "Style=" border-bottom:0px; border-left:0px; border-top:0px; border-right:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6E/59/ Wkiol1v6pxgjo2-uaaegal8zqg8295.jpg "" "height=" 159 "/>

Using NMCLI connection show NIC Information

650) this.width=650; "Style=" border-bottom:0px; border-left:0px; border-top:0px; border-right:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6E/59/ Wkiol1v6pxhs4t7kaadsfh_es6c561.jpg "" Height= "/>"

Test the network for normal:

Ping www.baidu.com #测试网络是否正常

Traceroute and MTR show the routing information we get to a network

Yum-y Install Traceroute

Yum-y Install MTR

Traceroute www.baidu.com

The MTR is Red Hat's own tool, combining "traceroute" and "ping" in a diagnostic tool

650) this.width=650; "Style=" border-bottom:0px; border-left:0px; border-top:0px; border-right:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6E/5D/ Wkiom1v6o8qqyua2aac-haoiqhm197.jpg "" Height= "/>"

first column : The IP address and the native domain name are displayed, which is like tracert

second column : is the packet loss rate for each corresponding IP displayed
column Three : SNT sets the number of packets sent per second, the default value is 10 you can specify by using the parameter-C

Fourth Column : The most recent return delay shown
Fifth Column : Is the average this should be the mean time delay for sending ping packets
The Sixth column : is the best or the shortest delay
The Seventh column : The worst or the most frequent delay
Eighth Column : is the standard deviation

Ethtool: View the properties of the network interface device itself

Ethtool NIC Interface Name

Method 2 : Executive Nmtui Command

Using the Nmtui command will bring up a tool interface

650) this.width=650; "Style=" border-bottom:0px; border-left:0px; border-top:0px; border-right:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6E/5D/ Wkiom1v6o8rihod2aah2g4sqebc378.jpg "" 640 "height=" 433 "/>

Restart the Network service.

Method 3 : through Nm-connection-editor to configure the connection (note: Must be run under the graphical interface)

650) this.width=650; "Style=" border-bottom:0px; border-left:0px; border-top:0px; border-right:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6E/5D/ Wkiom1v6o8qxktbyaadlvejixno865.jpg "" 640 "height=" 348 "/>

Configured, restart the network service, perform ifconfig or IP addr Discovery has acquired a new address.

Once the connection is successful, a configuration file with the same name will be created automatically under/etc/sysconfig/networks-scripts

Method 4 : nmcli Command

NMCLI is a powerful command, and a lot of options and objects can be configured later. Look at the Help document, the object can be comprehensive information, network, signal and connection. Here we are mainly learning to connect the configuration using

650) this.width=650; "Style=" border-bottom:0px; border-left:0px; border-top:0px; border-right:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6E/59/ Wkiol1v6pxkz9824aai32frbqp0636.jpg "" "height=" 464 "/>

How to configure the connection, or first look at the help, he can be followed with show,up, down, add, modify, edit, delete, reload,

650) this.width=650; "Style=" border-bottom:0px; border-left:0px; border-top:0px; border-right:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6E/5D/ Wkiom1v6o8vaqey6aaigb9dqrv8093.jpg "" "height=" 547 "/>

See what the device parameters are.

650) this.width=650; "Style=" border-bottom:0px; border-left:0px; border-top:0px; border-right:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6E/5D/ Wkiom1v6o8vdwpddaafxj_r6miw874.jpg "" "height=" 414 "/>

650) this.width=650; "Style=" border-bottom:0px; border-left:0px; border-top:0px; border-right:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6E/59/ Wkiol1v6pxobz5iuaagy4uhug2s447.jpg "" "height=" 261 "/>

View specific device information can be viewed by NMCLI connection Show device name

650) this.width=650; "Style=" border-bottom:0px; border-left:0px; border-top:0px; border-right:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6E/59/ Wkiol1v6pxpiibv-aafbosibwye017.jpg "" "height=" 255 "/>

Add a new connection, first look at the Help

650) this.width=650; "Style=" border-bottom:0px; border-left:0px; border-top:0px; border-right:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6E/5D/ Wkiom1v6o8uxjt9waablgqmo22o448.jpg "" 640 "height="/>

To modify an existing connection, you can first look at the Help

NMCLI Connection Modify–help

650) this.width=650; "Style=" border-bottom:0px; border-left:0px; border-top:0px; border-right:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6E/5D/ Wkiom1v6o8vy-3ivaajetntgfnk183.jpg "" "height=" 311 "/>

Attached: Modify the RHEL7 nic name

After the RHEL7 installation is complete, the default NIC name is eno16777736

Enter the following command to enter the corresponding directory and edit the file:

Vim/etc/sysconfig/grub

Then, adding "net.ifnames=0 biosdevname=0" content to this file, the effect is to disable the predictable naming convention, as shown in:

650) this.width=650; "Style=" border-bottom:0px; border-left:0px; border-top:0px; border-right:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6E/59/ Wkiol1v6pxsiwwxbaad4gtwxckw632.jpg "" "height=" 165 "/>

Then execute the following command, with the following effect:

650) this.width=650; "Style=" border-bottom:0px; border-left:0px; border-top:0px; border-right:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6E/59/ Wkiol1v6pxsr-wguaagjaqh-sye718.jpg "" "height=" 198 "/>

Then, after rebooting the system, check the NIC name

650) this.width=650; "Style=" border-bottom:0px; border-left:0px; border-top:0px; border-right:0px "title=" image "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6E/59/ Wkiol1v6pxshyn1xaaghn-c_dwg582.jpg "" Height= "/>"

RHEL7.0 Series-Set IP address, gateway, and DNS

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.