Linux:centos setting up IP and connecting the extranet

Source: Internet
Author: User

Note: I use the make CentOS 7, all filenames are IFCFG-ENP0S3,

First, set up the IP of Linux in the virtual machine, so that the Linux system that can connect the virtual machine locally

1> Enter cmd for local windows, enter ipconfig

  

2> According to the information above, the IP of the Linux in the virtual machine must be in the same network segment as the native IP, so that the Linux system that logs on to the virtual machine can be connected locally using the connection tool such as Xshell

The following is information about/ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-ENP0S3 files in Linux (set up below)

Type=ethernet #网卡类型
Bootproto=no #启用地址协议--static: Static protocol--BOOTP Protocol--DHCP Protocol
Defroute=yes
Ipv4_failure_fatal=no
Ipv6init=yes
Ipv6_autoconf=yes
Ipv6_defroute=yes
Ipv6_failure_fatal=no
Name=enp0s3
Uuid=848cf4b6-eb47-499c-ae44-59f19ef2c2b6
DEVICE=ENP0S3 #网卡接口名称
Onboot=yes #系统启动时是否自动加载
  ipaddr=192.168.0.48 #网卡IP地址
prefix=24/#子网掩码24位
Ipv6_peerdns=yes
Ipv6_peerroutes=yes
Ipv6_privacy=no

After Setup, perform the service network restart restart the NIC and use Ifconfig to query the following Linux IP

  

3>. Go to local cmd using the ping command to see if you can ping Linux with the virtual machine locally

  

The information that appears above indicates that the virtual machine's Linux IP configuration is successful and can now log on to the virtual machine's Linux system using remote connection tools such as Xshell.

But can not connect the network (that is, not in the virtual machine inside the Internet Oh!);

  

Second, the Linux system to set up the virtual machine can connect the extranet (that is, the use of Linux system in the virtual machine can also surf the net)

Open the/ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-ENP0S3 of the Linux system

   

After the settings are saved, perform the service network restart restart the network card, at which point Ping www.baidu.com can ping, at this time in the virtual machine's Linux system can be directly connected to the Internet

    

What happens when you check out the following Linux IPs?

   

192.168.0.48 is the IP we set before, and now modify the parameters, you can connect the network (can surf the internet), IP has become 103, then use 192.168.0.48 can also be used to connect to Linux through Xshell tools such as login?

The answer is yes, for some reason, every time I connect the time will have to wait a long time to prompt you to enter the password, of course, you can use 192.168.0.103 is also able to telnet to the Linux system

Linux:centos setting up the IP and connecting the extranet

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.