In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to create a virtual machine," interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let Xiaobian take you to learn "how to create a virtual machine"!
Add Bridge Device Files
[devops@192 ~]$ touch /etc/sysconfig/network-scripts/ifcfg-br0
configure bridge
[devops@192 ~]$ cat /etc/sysconfig/network-scripts/ifcfg-br0
TYPE=Bridge
BOOTPROTO=static
IPADDR=192.168.1.10
PREFIX=24
GATEWAY=192.168.1.1
DNS1=192.168.1.1
NM_CONTROLLED=no
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
DEVICE=br0
ONBOOT=yes
[devops@192 ~]$
Attach the network card to the bridge
Comment out the em1 NIC IP address configuration and add BRIDGE=br0.
[devops@192 ~]$ cat /etc/sysconfig/network-scripts/ifcfg-em1
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_PRIVACY=no
NAME=em1
UUID=48f1a196-a6ff-4966-8b93-fb0d7b707e47
DEVICE=em1
ONBOOT=yes
#BOOTPROTO=static
#IPADDR=192.168.1.10
#PREFIX=24
#GATEWAY=192.168.1.1
#DNS1=192.168.1.1
NM_CONTROLLED=no
#BRIDGE=br0
[devops@192 ~]$
View current host routes and bridge interfaces
[devops@192 ~]$ route -v
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.1.1 0.0.0.0 UG 0 0 0 br0
link-local 0.0.0.0 255.255.0.0 U 1002 0 0 em1
link-local 0.0.0.0 255.255.0.0 U 1004 0 0 br0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 br0
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
[devops@192 ~]$
[devops@192 ~]$
[devops@192 ~]$ brctl show
bridge name bridge id STP enabled interfaces
br0 8000.1866daa0cb22 no em1
virbr0 8000.5254002a0526 yes virbr0-nic
[devops@192 ~]$
Restart network services
sudo systemctl restart network
Failed to start LSB: Bring up/down networking. You need to check whether the network interface file defined under/etc/sysconfig/network-scripts/has a problem. I have dual network cards here, one of which has a configuration problem, resulting in network service startup failure.
Create virtual machines using br0
With the bridge br0 above, we can create three virtual machines using bridge br0 in minutes with the following command:
ansible-playbook ./ virt-infra.yml \
--limit kvmhost,k8shosts \
-e virt_infra_root_password=password \
-e virt_infra_disk_size=100 \
-e virt_infra_ram=4096 \
-e virt_infra_ram_max=8192 \
-e virt_infra_cpus=8 \
-e virt_infra_cpus_max=16 \
-e '{ "virt_infra_networks": [{ "name": "br0", "type": "bridge" }] }' \
-e virt_infra_state=running
Log in to the created k8s_host virtual machine and ping the local area network and the internet network are open, proving that the br0 bridge works normally.
In the future, we can use these virtual machines to toss around the K8S.
At this point, I believe everyone has a deeper understanding of "how to create virtual machines," so let's actually operate them! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.