Linux Centos 7 Network configuration

Source: Internet
Author: User

System version

[Email protected]/]# cat/proc/version
Linux version 3.10.0-514.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5- (GCC) ) #1 SMP Tue Nov 16:42:41 UTC 2016
[Email protected]/]#

  

The newly installed CentOS system, which does not have an IP address by default, needs to be configured with an IP address to provide external access, as shown in

There is no valid connection IP at this time, you need to manually configure the network of the system;

CD to/etc/sysconfig/network-scripts directory configuration network card, from can see, the main network card is ens33; that is, you need to configure the name of the ENS33, where you can search for keyword lookup

[[email protected] network-scripts]# ls *ens33-l
-rw-r--r--. 1 root root 248 March 19:10 ifcfg-ens33

[Email protected] network-scripts]# VI IFCFG-ENS33

Type=ethernet

Bootproto=dhcp

Defroute=yes

Peerdns=yes

Peerroutes=yes

Ipv4_failure_fatal=no

Ipv6init=yes

Ipv6_autoconf=yes

Ipv6_defroute=yes

Ipv6_peerdns=yes

Ipv6_peerroutes=yes

Ipv6_failure_fatal=yes

Ipv6_addr_gen_mode=stable-privacy

Name=ens33

Uuid=a9673c54-e4be-4910-9c97-1eb850426bab

Device=ens33

Onboot=no

If you need to configure an IP address, the following parameter items are required, if not added

IPAddr

IP Address

Bootproto

Network mode, DHCP refers to dynamic acquisition, if the need to configure static IP needs to be set to none

PREFIX

Mask

GATEWAY

Gateway Address

DNS1

DNS Address

NAME

Nic Name

DEVICE

NIC driver name, which is the name displayed by the ifconfig command

Find the IP address of the local machine, configure the same network segment as the local machine, which is configured as

ipaddr=192.168.61.132

IP address is legal

Prefix=16

Mask

gateway=255.255.255.0

Gateway

dns1=8.8.8.8

DNS is consistent with local

Onboot=yes

Sets whether the current network card is activated when the system starts network and only the active NIC can connect

Ipv6init=no

Turn off IPV6 configuration initialization, and the rest of the IPv6 settings can be removed

Other configuration items remain unchanged

Save the configuration to exit and restart the network service:

[Email protected] network-scripts]# service network restart
Restarting network (via SYSTEMCTL): [OK]

[Email protected] network-scripts]# ifconfig

ens33: flags=4163<up,broadcast,running,multicast> MTU 1500

inet 192.168.61.132 netmask 255.255.0.0 broadcast 192.168.255.255

Ether 00:0c:29:fc:ff:20 Txqueuelen (Ethernet)

RX packets 2036 Bytes 234772 (229.2 KiB)

RX errors 0 dropped 0 overruns 0 frame 0

TX Packets 1461 Bytes 298360 (291.3 KiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<up,loopback,running> MTU 65536

inet 127.0.0.1 netmask 255.0.0.0

Inet6:: 1 prefixlen ScopeID 0x10

Loop Txqueuelen 1 (Local Loopback)

RX Packets 892 bytes 80168 (78.2 KiB)

RX errors 0 dropped 0 overruns 0 frame 0

TX Packets 892 bytes 80168 (78.2 KiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

[Email protected] network-scripts]#

You can see the result of the Ifconfig command has changed, at this time use SECUCRT connection this address, Ok, can connect normally

Connection Successful! Description The network for the virtual machine CENTOS7 system has been configured successfully

Linux Centos 7 Network 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.