关注分享主机优惠活动
国内外VPS云服务器

KVM虚拟化LinuxBridge环境部署的方法和步骤

KVM虚拟化Linux桥环境部署本节给出了部署Linux桥环境以将虚拟机连接到网络的方法。

1安装Linux Bridge以将物理网卡ens33绑定到Linux Bridge br0的操作为例,使用root用户执行以下命令来构建Linux Bridge:

1.1安装bridge-utils软件包Linux Bridge+utils通常由brctl工具管理,其对应的安装包是bridge-utils。安装命令如下:

# yum install -y bridge-utils示例命令如下:

[root @ superman -21 ~]# yum install -y bridge -utilslist元数据到期检查:1天,2023年2月5日星期日22: 41: 25,12: 32: 06 agoon。依赖关系已解决。= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =包架构版本库大小= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =安装:bridg E- 包总下载大小:33k已安装大小:62k下载包:bridge -utils -1 . 7 . 1-1 . OE 2203 . x86 _ 64 . rpm 186 kB/s | 33kb 00:00 -------------------------------------------4 运行事务测试事务测试成功。运行事务准备aring : 1/ 1安装:bridge-utils-1.7.1-1.oe2203 . x86 _ 64 1/1运行script let:bridge -utils -1 . 7 . 1-1 . OE 2203 . x86 _ 64 1/1验证:bridge -utils -1 . 7 . 1-1 . OE 2203 . x86 _ 64 1/1安装:bridge -utils -1 . 7 . 1-1 . OE 2203[root@superman-21 ~]#

1.2确认安装是否成功。确认bridge-utils组件是否安装成功。如果安装成功,可以查看软件包的相关信息。

# rpm -qi bridge-utils示例命令如下:

[root @ superman -21 ~]# RPM -IQ bridge -utils bridge -utils -1 . 7 . 1-1.oe2203 . x86_64[root @ superman -21 ~]#[root @ superman -21 ~]# RP M-qi bridge -utils name:bridge -utils version:1 . 7 . 1版本:1 . OE 2203架构:x86 _ 64安装日期:2023年2月7日星期二11:kager:http://open Euler . org vendor:http://open Euler . orgurl:https://wiki.linuxfoundation.org/networking/桥摘要:用于配置linux以太网桥的实用程序描述:该软件包提供了用于配置linux以太网桥的实用程序。linux以太网桥可用于将多个以太网设备连接在一起。[root@superman-21 ~]#

2配置Linux桥

2.1创建桥br0# brctl addbr br0命令示例如下:

[root @超人-21 ~] # brctl addbrbr0 [root @超人-21 ~] #查看创建的桥br0。

# brctl显示示例命令如下:

[root @ superman -21 ~]# brctl show bridge name bridge id STP enabled interfaces br 0 8000.0000000000 no[root @ superman -21 ~]#

2.2将物理网卡ens33绑定到Linux Bridge# brctl addif br0 ens33。命令示例如下:

[root @超人-21 ~] # brctl addif br 0 ens 33[root @超人-21 ~]#查看绑定Linux桥的配置。

使用brctl show检查Linux bridge的当前配置。ens33已经挂在br0上了。

# brctl显示示例命令如下:

[root @ superman -21 ~]# brctl show bridge name bridge id STP enabled interfaces br 0 8000.000 c 2996 c9d 7 no ens 33[root @ superman -21 ~]#

2.3配置了ens33的IPens33连接到网桥后,不再需要IP地址,ens33的IP设置为0.0.0.0。

# ifconfig ens33 0.0.0.0示例命令如下:

[root @ superman -21 ~]# ifconfig ens 33 0 . 0 . 0 . 0[root @ superman -21 ~]#

2.4将ip2.4.1 DHCP设置分配给Linux Bridge br0。

如果有DHCP服务器,可以通过dhclient设置动态IP地址。

# dhclient br0命令示例如下:

[root @ superman -21 ~]# dhclientbr 0[root @ superman -21 ~]#查看dhcp自动获取ip地址信息。

# ip add list示例命令如下:

[root@superman-21 ~]# ip添加列表1:lo:& lt;LOOPBACK,UP,LOWER _ UP & gtmtu 65536 qdisc noqueue状态未知组默认qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127 . 0 . 0 . 1/8作用域主机lo valid _ lft forever _ lft forever 6::1/128作用域主机valid _ lft forever 2:ens 33:& lt;广播、多播、UP、LOWER _ UP & gtMTU 1500 qdisc FQ _ codel master br0 state UP group default qlen 1000 link/ether 00:0c:29:96:C9:D7 brd ff:ff:ff:ff:ff altname enp 2s 1 inet 6 fe80::9393:f6ae:ced 9:7759/64 scope link noprefixroute valid _ lft forever 3:br0:& lt;广播、多播、UP、LOWER _ UP & gtmtu 1500 qdisc noqueue状态UP组默认qlen 1000 link/ether 00:0c:29:96:C9:D7 brd ff:ff:ff:ff:ff:ff inet 192 . 168 . 1 . 131/24 brd 192 . 168 . 1 . 255作用域全局动态br0 valid _ lft 6804 sec preferred _ lft 6804 sec inet 6 fe80::20c:29ff:fe96:c9d

如果没有DHCP服务器,为br0配置一个静态IP,例如将静态IP设置为192.168.1.21,子网掩码设置为255.255.255.0。

# ifconfig br0 192.168.1.21网络掩码255.255.255.0示例命令如下:

[root @超人-21 ~] # ifconfig br0 192.168.1.21网络掩码255.255.0 [root @超人-21 ~] #设置静态ip后查看信息。

# ip add list示例命令如下:

[root@superman-21 ~]# ip添加列表1:lo:& lt;LOOPBACK,UP,LOWER _ UP & gtmtu 65536 qdisc noqueue状态未知组默认qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127 . 0 . 0 . 1/8作用域主机lo valid _ lft forever _ lft forever 6::1/128作用域主机valid _ lft forever 2:ens 33:& lt;广播、多播、UP、LOWER _ UP & gtMTU 1500 qdisc FQ _ codel master br0 state UP group default qlen 1000 link/ether 00:0c:29:96:C9:D7 brd ff:ff:ff:ff:ff altname enp 2s 1 inet 6 fe80::9393:f6ae:ced 9:7759/64 scope link noprefixroute valid _ lft forever 3:br0:& lt;广播、多播、UP、LOWER _ UP & gtmtu 1500 qdisc noqueue状态UP组默认qlen 1000 link/ether 00:0c:29:96:C9:D7 brd ff:ff:ff:ff:ff:ff inet 192 . 168 . 1 . 21/24 brd 192 . 168 . 1 . 255作用域全局br0 valid_lft forever preferred _ lft forever inet 6 fe80::20c:29ff:fe96:c9d 7/64作用域链接valid _ lft关于KVM Linux Bridge环境部署的更多信息,请搜索主机频道zhujipindao以前的文章。或继续浏览以下相关文章。希望大家支持主机频道zhujipindao。未来的com!

未经允许不得转载:主机频道 » KVM虚拟化LinuxBridge环境部署的方法和步骤

评论 抢沙发

评论前必须登录!