How to set static IP in centOS7 NET mode

How to set static IP in centOS7 NET mode

Preface

NAT forwarding: Simply put, NAT is the use of internal addresses in the internal network of the LAN. When the internal node wants to communicate with the external network, the internal address is replaced with a public address at the gateway (which can be understood as the exit, like the door of the yard) so that it can be used normally on the external public network (the Internet). NAT allows multiple computers to share an Internet connection. This function solves the problem of shortage of public IP addresses very well. Through this method, you can apply for only one legal IP address to connect all computers in the LAN to the Internet. At this time, NAT shields the internal network, and all internal network computers are invisible to the public network, while internal network computer users are usually unaware of the existence of NAT. As shown in the figure below. The internal address mentioned here refers to the private IP address assigned to the node in the internal network. This address can only be used in the internal network and cannot be routed.

Check static IP and subnet mask

Click Edit-Virtual Network Editor

Click DHCP Settings

Static IP Yes

One between 192.168.230.128-192.168.230.254

Then we modify the IP definition 192.168.230.129

View Gateway

Then we also record the gateway address 192.168.191.2

Step 1: Enter the /etc/sysconfig/network-scripts/ directory

Step 2: Modify the ifcfg-eth(xxx) file

vim ifcfg-eth0 

The properties that need to be modified are:
ONBOOT=YES #Change no to yes
BOOTPROTO=static #Change dhcp to static
Add to:
IPADDR=192.168.191.129 #static ip address
GATEWAY=192.168.230.1 #Default gateway
NETMASK=255.255.255.0 #Subnet mask

Step 3: Restart the network

service network restart
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
IPADDR=192.168.191.129
GATEWAY=192.168.191.2
NETMASK=255.255.255.0
DNS1=8.8.8.8
UUID=6d7d57bc-db00-454d-b66e-40f65bc163ee
DEVICE=ens33
ONBOOT=yes

Turn off firewall

Test ping external network

Finally, 192.168.191.129 is the IP address of the virtual machine.

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM.

You may also be interested in:
  • Detailed explanation of how to configure static IP with dual network cards in centos7
  • CentOS7 mini installation and static ip setting tutorial
  • How to configure static IP in Centos7
  • Introduction to Centos7 Internet access and adding static IP
  • Mac VMware Fusion CentOS7 configuration static IP tutorial diagram
  • How to configure static IP in NAT mode of centos7 mini version under vm
  • How to set static IP in centOS7 bridge mode

<<:  WeChat applet realizes simple tab switching effect

>>:  Steps to install MySQL on Windows using a compressed archive file

Recommend

Setting up shadowsocks+polipo global proxy in Linux environment

1. Install shadowsocks sudo apt-get install pytho...

How Database SQL SELECT Queries Work

As Web developers, although we are not profession...

Detailed explanation of the benefits of PNG in various network image formats

BMP is an image file format that is independent o...

3 codes for automatic refresh of web pages

In fact, it is very simple to achieve this effect,...

Simple Implementation of HTML to Create Personal Resume

Resume Code: XML/HTML CodeCopy content to clipboa...

Implementation of a simple login page for WeChat applet (with source code)

Table of contents 1. Picture above 2. User does n...

A brief discussion on JavaScript throttling and anti-shake

Table of contents Throttling and anti-shake conce...

Graphic tutorial on installing Mac system in virtual machine under win10

1. Download the virtual machine version 15.5.1 I ...

How to calculate the frame rate FPS of web animations

Table of contents Standards for smooth animation ...

Implementation of fuzzy query like%% in MySQL

1, %: represents any 0 or more characters. It can...

Mysql index types and basic usage examples

Table of contents index - General index - Unique ...

Summary of MySQL5 green version installation under Windows (recommended)

1 Download MySQL Download address: http://downloa...

Gitlab practical tutorial uses git config for related configuration operations

This article introduces the content related to gi...

Use a table to adjust the format of the form controls to make them look better

Because I want to write a web page myself, I am al...