配置软件网桥

软件网桥配置

 

实验环境:VMware Workstation 虚拟机 CentOS7

网桥是一个链路层设备,可基于MAC地址在网络之间转发流量。网桥识别哪些主机连接到每个网络,构建MAC地址表,然后根据该表做出包转发决策。可以在Linux环境中使用软件网桥以仿真硬件网桥。

软件网桥的最常见应用是在虚拟化应用程序中,用于在一个或多个虚拟NIC中共享一个硬件NIC

 

1.创建虚拟网桥

nmcli connection add type bridge con-name br0 ifname br0

    Connection 'br0' (8df02320-abb8-456d-b616-d3453adeafb9) successfully added.

 

2.配置虚拟网桥IP信息

nmcli connection modify br0 ipv4.method manual ipv4.addresses 192.168.76.10/24 ipv4.gateway 192.168.76.1 ipv4.dns 8.8.8.8

 

3.将网卡连接到虚拟网桥

nmcli connection add type  bridge-slave con-name br0-port1 ifname ens37 master br0

    Connection 'br0-port1' (c218a10a-98e0-4265-994d-ec466279bf8c) successfully added.

nmcli connection add type  bridge-slave  con-name br0-port2 ifname ens38 master br0

    Connection 'br0-port2' (ef599446-b04b-4691-8b6e-6718d7997a96) successfully added.

 

4.激活虚拟网桥

nmcli connection up br0

    Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/10)

 

5.查看虚拟网桥

brctl show

ifconfig

ip link

 

6.测试连通性

ping -I br0 192.168.76.10

 

posted @ 2018-01-20 21:42  前路~  阅读(744)  评论(0编辑  收藏  举报