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 centOS7 bridging mode

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to set static Ip in centOS7 bridge mode". In daily operation, I believe many people have doubts about how to set static Ip in centOS7 bridge mode. I have consulted all kinds of information and sorted out simple and easy operation methods. I hope to help you answer the doubts about "how to set static Ip in centOS7 bridge mode"! Next, please follow the small series to learn together!

Linux login administrator account password

I. Virtual machine selection bridge mode

1. Open the editor in Edit-Virtual Network Editor, as shown in the following two figures, select vmnet0, select bridge in the following type, that is, bridge, network card do not select automatic (automatic), manually select the actual network card name for your current host, and then click Apply, OK.

Note that the default setting of the virtual machine is automatic bridging. Notebooks generally have 2 network cards. Be sure to bridge to the network card that is currently on the Internet to avoid errors!

How to check the network card that is surfing the Internet? Check your PC's adapter settings and find your Internet card

2. Virtual machine select bridge mode (custom vmnet0), OK.

Second, manually set static ip in the virtual machine

Check the IP address of Linux.

centos6 command: ifconfig

centos7 command: ip addr

Remember: record the name of the network card, this machine is ens33

Look at the IP of the host window.

win+r --cmd ----ipconfig/all

IP: 192.168.3.9

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

Step 2: Modify ifcfg-eth(xxx) file

vim ifcfg-eth0

ps: ifcfg-ens33 of centos7 is the same as just recorded

If you see that your linux distribution has a different device name than mine, don't ask why, change is hope! (-)I didn't say it was ubuntu, why did I say centos? We all know that redhat is the most widely used linux distribution in enterprise applications, but redhat has to be charged, why? This is a good job! Smaller companies probably use centos the most. Why centos? This is because redhat centos to the acquisition, centos is now called community version, redhat in the service, is the first service to the community version centos, through community feedback, when the technology is mature enough, will add new technology or services to redhat, so centos is actually indirect in the use of radhat! This is the way, of course, you can go to Baidu to understand, not to mention let you Google, in heaven is really a little powerless to surf the Internet, you know good! Haha...

Press i to edit the file command, insert appears at the bottom, which means you can edit it.

The attributes that need to be modified are:

onboot=yes #no replaced by yesbootproto=static #dhcp replaced by static Add: ipaddr=192.168.230.129 #The static IP address is consistent with the first three bits of IP in the host, and the last bit needs to be modified. Do not cause conflicts like host ip gateway=192.168.230.1 #default gateway is OK like physical host netmask=255.255.255.0 #subnet mask is OK like physical host dns1=8.8.8.8 #dns, just write Google's address.

specific explanation

type=ethernet #Network card type: Ethernet proxy_method=none #proxy mode: closed status browser_only=no #Browser only: No bootproto=dhcp #Boot protocol of NIC: dhcp[Chinese name: Dynamic Host Configuration Protocol] deroute =yes #Default route: yes, don't understand Baidu keyword `default route`ipv4_failure_fatal=no #Yes do not enable ipv4 fatal error detection: no ipv6init=yes # ipv6 autoconf = yes [no impact, not yet used ipv6]ipv6_autoconf=yes # ipv6 automatic configuration: Yes [no impact, not yet used ipv6] ipv6_deroute =yes # IPv6 can be the default route: Yes [no impact, not yet used ipv6]ipv6_failure_fatal=no #Yes IPv6 fatal error detection is not enabled: No ipv6_addr_gen_mode=stable-privacy # IPv6 address generation model: stable-privacy [this is only a policy to generate IPv6]name=ens33 #NIC physical device name uuid=f47bde51-fa78-4f79-b68f-d5dd90cfc698 #Universal unique identification code, each NIC will have, cannot be repeated, no Two linux only one NIC available device=ens33 #NIC device name, must be the same as `name` value onboot=no #Whether to boot up or not. To boot up the NIC or control the NIC through `systemctl restart network`, it must be set to `yes`.

Press esc to exit editing and then press shift+z +z to save and exit

Restart network services

service network restart

IV. Test effect

Enter the command ping www.baidu.com (test external network)

Enter the command ping 192.168.2.153 (host ip)

The following message indicates success.

Fill in picture abstract (optional)

At this point, the study of "how to set static Ip in centOS7 bridge mode" is over, hoping to solve everyone's doubts. Theory and practice can better match to help you learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

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

Internet Technology

Wechat

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

12
Report