12月 122017
 

我们通过一个网桥两个设备对,来连接两个网络名字空间,每个名字空间中创建两个vlan

借助vconfig来配置vlan:

 

查看一下vlan配置:

 

现在,我们可以分别在两个名字空间来ping另外一个名字空间的两个IP,虽然两个IP都能ping通,但是使用的源IP是不同的,走的vlan也是不同的,我们可以在veth01/veth10/veth02/veth20/br-test-vlan 任意一个上抓包,会看到vlan信息:

 

如果试图从veth10.3001 去ping 172.16.30.22 是不能通的,因为是不同的vlan呀:

 

不适用vconfig的解法:

另: vlan 一般以  设备名.vlanid 来命名,不过并非强制,如下命名为 vlan3003也是没问题的

注意:一个主设备上相同vlan好的子设备最多只能有一个

 

所以,正常来讲,一般是这样的:

 

参考: http://network.51cto.com/art/201504/473419.htm

http://www.mamicode.com/info-detail-2357921.html

 Posted by at 下午 3:42

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

(required)

(required)

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据