免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3919 | 回复: 4
打印 上一主题 下一主题

Linux不同网口不同VLAN之间作桥接,单一网口不同VLAN作桥接可以工作吗? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-08-13 23:40 |只看该作者 |倒序浏览
比如

   brctl addif br0 eth0.2
   brctl addif br0 eth0.3

或者

   brctl addif br0 eth0.2
   brctl addif br0 eth1.3

好像不能工作阿?

有哪位大虾试过吗?

论坛徽章:
7
丑牛
日期:2013-10-18 14:43:21技术图书徽章
日期:2013-11-03 09:58:03辰龙
日期:2014-01-15 22:57:50午马
日期:2014-09-15 07:04:39丑牛
日期:2014-10-16 14:25:222015年亚洲杯之伊朗
日期:2015-03-16 10:24:352015亚冠之城南
日期:2015-05-31 09:52:32
2 [报告]
发表于 2010-08-14 00:04 |只看该作者
可以工作.只是你没用对
对VLAN的概念没弄清楚
建议看看 <网络互连> Perlman.

eth0 到eth0.2是解VLAN头 过BR0 然后从eth1.3转到eth1是加VLAN头.
所以从eth1出去的包要用eth1.3相同的tag的VLAN才能收到.

同样传给eth0的包只有和eth0.2相同的VLAN tag才被eth0.2上传

论坛徽章:
7
丑牛
日期:2013-10-18 14:43:21技术图书徽章
日期:2013-11-03 09:58:03辰龙
日期:2014-01-15 22:57:50午马
日期:2014-09-15 07:04:39丑牛
日期:2014-10-16 14:25:222015年亚洲杯之伊朗
日期:2015-03-16 10:24:352015亚冠之城南
日期:2015-05-31 09:52:32
3 [报告]
发表于 2010-08-14 00:06 |只看该作者
从VLAN端口上行的数据包都已经去掉VLAN头部了.在通过BR时就和普通的以太网数据包一样

论坛徽章:
0
4 [报告]
发表于 2010-08-14 07:55 |只看该作者
本帖最后由 Roemer 于 2010-08-14 08:39 编辑

我就是想在VLAN 2 3之间做通信~~
按照你的意思br0可以在VLAN 2 ,3之间转发数据?
(自动执行TAG 2 <=>3 之间的转化)

论坛徽章:
0
5 [报告]
发表于 2010-08-14 21:56 |只看该作者
本帖最后由 Roemer 于 2010-08-14 22:05 编辑

在网上看到一篇文章~


HowTo: VLAN's and Bridging through network-scripts


Bridging over VLAN's
What?

As if you weren't confused enough already, now let's combine the two concepts and create a bridge across a VLAN. That would be a bridge between two ethernet interfaces, where one is a real ethernet card in the PC (or a wifi, or some other regular type of ethernet interface), and the other will be a VLAN interface.
Why?

Let's say you have a piece of equipment which by itself doesn't know how to talk VLAN -but you want to connect it to a VLAN. By constructing a bridge between a "normal" and a "VLAN" ethernet interface, the Linux computer will add and remove the VLAN headers on behalf of any other device(s) plugged into the "normal" card.
How?

Okay, now for the tricky part. It takes a slight modification of the procedures above.  For this example, let's presume we have an ethernet interface eth0 connected to the network where a VLAN id 2 is present, and we have a device or devices on eth1 that need to be bridged into that VLAN 2.

Go ahead and first construct the VLAN interface like we did before (copy ifcfg-eth#, change DEVICE, add VLAN=yes), except also remove the BOOTPROTO, IPADDR, NETMASK, and GATEWAY lines if present.  Add a line BRIDGE=br2 (or a different named bridge device of your choice).
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP