centos7 KVM网桥桥接、网卡绑定

设备环境:
dell R710
网卡名字:em1、 em2、em3、em4
IP网段:10.0.0.x

[root@centos7 ~]# nmcli connection show
NAME    UUID                                  TYPE      DEVICE 
em1     3dc232fa-216b-4915-ab18-f10f7d3d93eb  ethernet  em1    
virbr0  fb5ff432-8ba6-400f-9d7f-063c6bfe250e  bridge    virbr0 
em2     a0d2e299-4b73-4aa3-bd76-71abbe0aec69  ethernet  --     
em3     593cdfbd-9603-4ae8-a052-48fab2f460e7  ethernet  --     
em4     7ebb584b-077d-4fda-9f1e-d65915b7dcda  ethernet  -- 

[root@centos7 ~]# 
ifc_bridge_name="br0"
ip_address="10.0.0.11/24"
ip_gateway="10.0.0.1"
ip_dns1="202.103.24.68"
ip_dns2="202.103.44.150"
nmcli connection add type bridge con-name ${ifc_bridge_name} ifname ${ifc_bridge_name}
nmcli connection modify ${ifc_bridge_name} ipv4.method manual ipv4.addr "${ip_address}"
nmcli connection modify ${ifc_bridge_name} ipv4.gateway "${ip_gateway}"
nmcli connection modify ${ifc_bridge_name} +ipv4.dns "${ip_dns1}"
nmcli connection modify ${ifc_bridge_name} +ipv4.dns "${ip_dns2}"

[root@centos7 ~]# nmcli connection 
NAME    UUID                                  TYPE      DEVICE 
br0     d267bc86-8314-4ebb-a4ee-a44c77f72b4f  bridge    br0    
em1     3dc232fa-216b-4915-ab18-f10f7d3d93eb  ethernet  em1    
virbr0  fb5ff432-8ba6-400f-9d7f-063c6bfe250e  bridge    virbr0 
em2     a0d2e299-4b73-4aa3-bd76-71abbe0aec69  ethernet  --     
em3     593cdfbd-9603-4ae8-a052-48fab2f460e7  ethernet  --     
em4     7ebb584b-077d-4fda-9f1e-d65915b7dcda  ethernet  --     
[root@centos7 ~]# nmcli connection up d267bc86-8314-4ebb-a4ee-a44c77f72b4f
[root@centos7 ~]# ifc_slave_name="em1"
[root@centos7 ~]# ifc_bridge_name="br0"
[root@centos7 ~]# nmcli connection modify ${ifc_slave_name} connection.slave-type bridge connection.master ${ifc_bridge_name}
[root@centos7 ~]# service NetworkManager restart
Redirecting to /bin/systemctl restart NetworkManager.service
[root@centos7 network-scripts]#cd /etc/sysconfig/network-scripts
[root@centos7 network-scripts]# vim ifcfg-br0
STP=yes
BRIDGING_OPTS=priority=32768
TYPE=Bridge
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=br0
UUID=d267bc86-8314-4ebb-a4ee-a44c77f72b4f
DEVICE=br0
ONBOOT=yes ##注意这里!!!
IPADDR=10.0.0.11
PREFIX=24
GATEWAY=10.0.0.1
DNS1=202.103.24.68
DNS2=202.103.44.150
[root@centos7 ~]# nmcli connection reload 
[root@centos7 ~]# systemctl restart network
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值