阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

KVM虚拟机网络设置

119次阅读
没有评论

共计 1054 个字符,预计需要花费 3 分钟才能阅读完成。

一、虚拟机网络

  • NAT
  • 桥接

1.1、NAT 网络

NAT 网络是虚拟机默认的网络,安装好 KVM 后就会有一个网卡

KVM 虚拟机网络设置

默认使用的地址是:192.168.122.0 网段,该 virbr0 ip 地址 也是使用 nat 网络虚拟机的网关.

虚拟机上网是通过防火墙配置 nat 转换规则实现的。

NAT 拓展知识:

NAT(Network Address Translation,网络地址转换)

KVM 虚拟机网络设置

私网 A: 10.0.0.0 10.255.255.255 B: 172.16.0.0 172.31.255.255 C: 192.168.0.0 192.168.255.255 # 发包 SIP 192.168.1.4 DIP 114.113.112.111 SPORT 6543 DPORT 80 SIP 202.106.1.3 DIP 114.113.112.111 SPORT 6543 DPORT 80 # 回包 SIP 114.113.112.111 DIP 202.106.1.3 SPORT 80 DPORT 6543 SIP 114.113.112.111 DIP 192.168.1.4 SPORT 80 DPORT 6543

1.2、桥接网卡

  1. 启用一个物理网卡网络
  2. 创建一个桥接网卡
  3. 将物理网卡和桥接网卡绑定
#1、给物理网卡设置 IP 信息 [root@zutuanxue ~]# nmcli connection add con-name eno1 ifname eno1 ipv4.addresses 192.168.1.200/24 ipv4.method manual ipv4.gateway 192.168.1.1 ipv4.dns 202.106.0.20 type 802-3-ethernet #2、创建一个桥接网卡 [root@zutuanxue ~]# nmcli connection add con-name br0 ifname br0 type bridge ipv4.method manual ipv4.addresses 192.168.1.200/24 ipv4.gateway 192.168.1.1 ipv4.dns 202.106.0.20 autoconnect yes #3、绑定物理网卡 [root@zutuanxue ~]# nmcli connection add type bridge-slave ifname eno1 master br0 #4、重启生效 [root@zutuanxue ~]# nmcli connection down eno1 [root@zutuanxue ~]# nmcli connection down br0 [root@zutuanxue ~]# nmcli connection up br0

正文完
星哥说事-微信公众号
post-qrcode
 
星锅
版权声明:本站原创文章,由 星锅 2022-06-09发表,共计1054字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中