Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set static Ip in NET mode in centOS7

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the centOS7 NET mode how to set static Ip, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

Preface

NAT forwarding: to put it simply, NAT uses an internal address in the internal network of the local area network, and when the internal node wants to communicate with the external network, it replaces the internal address with a public address at the gateway (which can be understood as an exit, for example, like a gate in the yard), so that it can be used normally on the external public network (internet). NAT can enable multiple computers to share Internet connections. This function solves the problem of shortage of public IP addresses. In this way, computers in the entire local area network can be connected to the Internet by applying for only one legal IP address. At this time, NAT shields the internal network, all intranet computers are invisible to the public network, and intranet computer users are usually not aware of the existence of NAT. This is shown in the following figure. 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 and forwarded.

View of static IP and subnet mask

Click Edit-Virtual Network Editor

Click DHCP Settings

Static IP is

One between 192.168.230.128 and 192.168.230.254

So let's modify the ip definition 192.168.230.129

View Gateway

So let's also record the address of the gateway 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 attributes that need to be modified are:

Replace ONBOOT=YES # no with yes

Replace BOOTPROTO=static # dhcp with static

Add:

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 restartTYPE=EthernetPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=staticDEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noIPV6_ADDR_GEN_MODE=stable-privacyNAME=ens33IPADDR=192.168.191.129GATEWAY=192.168.191.2NETMASK=255.255.255.0DNS1=8.8.8.8UUID=6d7d57bc-db00-454d-b66e-40f65bc163eeDEVICE=ens33ONBOOT=yes

Turn off the firewall

Test the ping public network

Finally, 192.168.191.129 is the ip of the virtual machine.

Thank you for reading this article carefully. I hope the article "how to set static Ip in NET mode in centOS7" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report