Centos 7.2 Configure network card remote connection

Source: Internet
Author: User
Tags yum repolist

Recently, start using the CentOS 7.2 system and share my basic NIC operation here. After the installation of the system, the system is simple configuration, connection Xshell, easy to use. Here are my steps to do this:


1. The network settings for the virtual machine are connected to the IP of the VMNET8 local VMNET8 network card 172.18.19.1

2. Configure the NIC file

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

ipaddr0=172.18.19.213

Prefix0=24

gateway0=172.18.19.1

dns1=172.8.1.1

Onboot=yes


3. Restart the Network Service (option two)

#servier Network Restart

#systemctl Restart Network.service


4. View network card information (select one)

#ifconfig

#ip Addr


5. Configure the firewall to turn on 80 ports, 3306 ports

CentOS 7.0 defaults to using firewall as the firewall, where the iptables firewall is changed.

1. Close firewall:

#systemctl Stop Firewalld.service #停止firewall

#systemctl Disable Firewalld.service #禁止firewall开机启动


6. Install and configure the Iptables firewall, open the 22,80,306 port (pre-install, mount the disk, configure Yum)

6.1 Mounting Discs

1. Set up connected in the selected CD-ROM

2. Command:

[email protected] ~]# mount/dev/cdrom/mnt

Mount:/dev/sr0 write protection, will be mounted as read-only

6.2 Configuring Yum

[[email protected] ~]# cd/etc/yum.repos.d/will see some of the system default to the CentOS start file, is the network Yum Source, temporarily do not use, you can create a file, MV moved to the file later use

[[email protected] yum.repos.d]# ls

1 Yum.repo

[[email protected] yum.repos.d]# Cat Yum.repo Create a text with repo as the file type, configured as follows:

[Yum]

Name=yum

Gpgcheck=0

Enabled=1

Baseurl=file:///mnt

[[email protected] yum.repos.d]# Yum repolist #检查yum是否配置成功, as shown below, indicates that a successful package has been loaded and Yum is used normally

Loaded plugins: Fastestmirror, LangPacks

Loading mirror speeds from cached hostfile

Source Identity Source Name status

Yum Yum 9,007

repolist:9,007

6.3 Installing Iptables

#yum Install iptables-services #安装

#vi/etc/sysconfig/iptables #编辑防火墙配置文件

# Firewall configuration written by System-config-firewall

# Manual Customization of this file are not recommended.

*filter

: INPUT ACCEPT [0:0]

: FORWARD ACCEPT [0:0]

: OUTPUT ACCEPT [0:0]

-A input-m state--state established,related-j ACCEPT

-A input-p icmp-j ACCEPT

-A input-i lo-j ACCEPT

-A input-m state--state new-m tcp-p TCP--dport 22-j ACCEPT

-A input-m state--state new-m tcp-p TCP--dport 80-j ACCEPT

-A input-m state--state new-m tcp-p TCP--dport 3306-j ACCEPT

-A input-j REJECT--reject-with icmp-host-prohibited

-A forward-j REJECT--reject-with icmp-host-prohibited

COMMIT

: wq! #保存退出

#systemctl Restart Iptables.service #最后重启防火墙使配置生效

#systemctl Enable Iptables.service #设置防火墙开机启动

Note: The above approach is to open the firewall, the use of rules through the 22 port using a virtual Terminal connection system. Novice recommends shutting down the firewall

6.4 Shutting down the firewall

#systemctl Stop Iptables.service #最后重启防火墙使配置生效

7. Turn off SELinux

#vi/etc/selinux/config

#SELINUX =enforcing #注释掉

#SELINUXTYPE =targeted #注释掉

Selinux=disabled #增加

: wq! #保存退出 # This practice must reboot the system for the configuration to take effect and is configured to take effect permanently!

#setenforce 0 #使配置立即生效 But the configuration is temporarily active after the shutdown, SELinux is still turned on without rebooting the system

Recommendation: Use two steps at the same time, the next boot does not have to configure, and meet the current use

8. See if the host is usually

#ping 172.18.19.213

9.shelll Connecting virtual machines





I have successfully connected, and you?









This article is from "Linux system" blog, declined reprint!

Centos 7.2 Configure network card remote connection

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.