CentOS7 network configuration and service management

Source: Internet
Author: User
1. during The VmwareWorkstation10.2 test, some physical machines may fail to recognize the M Nic, the name of the NIC device that can normally identify the Centos7 system of the virtual Nic has changed. For more information, see the name of the network device under CentOS7, there is no need to replace it with a traditional method of identifying names, so you must be brave enough to accept new knowledge ~
1. configure the network
During the Vmware Workstation10.2 test, it was found that some physical machines could not recognize the M Nic properly, but changed to the M Nic to test that the virtual Nic could be recognized normally.
The NIC device name of CentOS 7 has changed. for details, refer to the network device name in CentOS 7. I personally feel that since I have learned a new system, I do not need to change it to a traditional method of identifying the network card, be brave enough to accept new knowledge ~

1. modify the network configuration by editing the file

Vim/etc/sysconfig/network-scripts/ifcfg-eno16777736
HWADDR = 00: 0c: 29: 14: 34: 51
TYPE = Ethernet
BOOTPROTO = static
DEFROUTE = yes
PEERDNS = yes
PEERROUTES = yes
USERCTL = no
NM_CONTROLLED = no
20174_failure_fatal = no
IPV6INIT = yes
IPV6_AUTOCONF = yes
Required 6_defroute = yes
IPV6_PEERDNS = yes
20176_peerroutes = yes
20176_failure_fatal = no
NAME = eno16777736
ONBOOT = yes
IPADDR = 192.168.117.128
NETMASK = 255.255.255.0
GATEWAY = 192.168.117.2
DNS1 = 192.168.117.2

Key configurations:

TYPE = Ethernet
BOOTPROTO = static
NAME = eno16777736
ONBOOT = yes
IPADDR = 192.168.117.128
NETMASK = 255.255.255.0
GATEWAY = 192.168.117.2
DNS1 = 192.168.117.2

Cat/etc/resolv. conf
Nameserver 192.168.117.2

2. use the text tool nmtui to modify the network configuration (RHEL7/CentOS7 is installed by default, and NetworkManager. service must be enabled)

Yum-y install NetworkManager-tui
Nmtui-edit eno16777736 modify Nic configuration
Nmtui-connect eno16777736

Restart the network

Systemctl restart network
Systemctl status network

Modify host name:

Vim/etc/hostname
Centos7.simlinux.com

Log out and log on again to take effect.

II. disable unnecessary services

The minimal installation of Centos7 does not contain commands such as nano, vim, wget, curl, ifconfig, and lsof. install the following command first:

Yum-y install nano vim wget curl net-tools lsof

You can use netstat and lsof to check which services are running in the system and disable unnecessary services.

Systemctl stop postfix
Systemctl stop avahi-daemon
Systemctl disable postfix
Systemctl disable avahi-daemon
Systemctl list-unit-files: view the status report of the running service
Systemctl start httpd. service start service
Systemctl stop httpd. service disable the service
Systemctl restart httpd. service restart service
Systemctl reload httpd. service reload the service
Systemctl disable httpd. service does not start
Systemctl enable httpd. service Boot
Systemctl status httpd. service View service running status
Systemctl show httpd. service displays the attributes of a service or task.
Systemctl list-dependencies httpd. service check service dependency
Systemctl is-enabled httpd. service check whether the service is started and level
Systemctl-H 192.168.117.128 start httpd. service start the httpd service on the machine 192.168.117.128

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.