一个VLAN配置的实际例子

时间:2023年05月09日

/

来源:奇

/

编辑:本站小编

收藏本文

下载本文

这次小编在这里给大家整理了一个VLAN配置的实际例子,本文共6篇,供大家阅读参考。本文原稿由网友“奇”提供。

篇1:一个VLAN配置的实际例子

背景很简单,和一般的eth-switch通过VLAN做成路由的方式一样,

首先看一种硬件效率较高的方法:

Port1~4作为access口,同时在硬件上作为用户模式,即从PC发往这些端口的数据包,是不带VLAN-tag的,SW硬件接收到后,会根据内部的vlan配置,若目的是同一个vlan的其他PC,则直接转发;若要发往CPU,则硬件自动为它们打上tag,然后交由Kernel的vlan设备。同样,由Kernel下发的数据包是带tag的(因为是由vlan设备发出的),最后硬件根据tag找到对应的port后,剥去tag,发往PC。

Port5作为trunk口,同时在硬件上作为传输模式,(作为WAN口)即外部PC发给它的包是要带tag的(会有多种tag),然后硬件查看是否是发往同一个vlan的其它port的,是则直接转发,否则,直接传输给CPU的Kernel的vlan设备。Kernel下发的带tag的数据包,也直接发往PC,

这里的PC一般是外部的ISP,它们对哪些应用(如PPP、TR069等)用什么VID有自己的要求,当然也能识别各种vlan-tag。

这种方法的一个缺点是,WAN口(port5)的vid不能和LAN口重合,即LAN口用了哪些vid,WAN口就不能再用了,这对ISP来说是不利的。

下面看另一种方法:

LAN口的方式不变,WAN口(port5)不再作为trunk口,而是和LAN口一样,作为access口,且硬件上采用用户模式。

不同的是,它在Kernel采用两层vlan的方式。这就允许ISP发给SW的数据包可以自由带仍和vid的tag,SW硬件上会自动给数据包加上vid5(该port在SW内的vlan标示)的tag,然后交给Kernel,Kernel中的eth2.5首先剥掉vid5-tag,再根据二层vid交给相应的二层vlan设备来处理。

这样做的优点就是ISP的vid不再有限制。

但缺点也很明显,首先效率降低,因为大部分工作要通过Kernel软件来完成;其次,WAN作为access口,不可能再和LAN口直接交换。

篇2:private vlan的配置

private vlan:

private vlan是一个私有vlan,配置之后可以实现同一vlan的主机之间实现隔离,加强了网络安全,

private vlan包括三部分,分别是:primary vlan、isolated vlan、community vlan。primary vlan是一个整体vlan,各部分的主机都能和这部分的主机通信;isolated vlan是一个隔离vlan,isolated vlan中的用户之间不能相互通信,isolated vlan中的用户只能和primary vlan中的用户通信;相同community vlan中的主机相互之间能够通信,不同community vlan之间的用户不能通信,community vlan中的用户可以和primary vlan中的用户通信,一个vlan中至少有isolated vlan和community vlan的和至少是一个,同时一个vlan中最多有一个isolated vlan。在对外表现时,这个vlan表现的是primary vlan的id号码和信息,isolated vlan和community vlan的信息不对外表现。在vlan中,位于primary vlan中的端口是promiscuous port,位于isolated vlan中的端口是isolated port,位于community vlan中的端口是community port。www.dnzg.cn

配置代码:(因为没有找到能够模拟private vlan这个功能的模拟器,所以了这个朋友的代码)

switch(config)#vtp mode transparent #将VTP版本设置为1或2,并且要求工作在transparent模式下

switch(config)# vlan 200

switch(config-vlan)#private-vlan community #定义vlan 200为团体vlan

switch(config)#vlan 300

switch(config-vlan)#private-vlan isolated #定义vlan 300为隔离vlan

switch(config)#vlan 100

switch(config-vlan)#private-vlan primary #定义vlan 100为主vlan

switch(config-vlan)#private-vlan association 200,300 #进入主vlan中,将所有辅助vlan关联到主vlan,

这里可以配置添加哪些辅助vlan的关联或移除哪些辅助vlan的关联。

switch(config)#interface range fa0/1 – 2

switch(config-if)#switchport mode private-vlan host #配置fa0/1 – 2为主机端口

switch(config-if)# switchport private-vlan host-assocition 100 200 #在主机端口上配置PVLAN的端口关联

switch(config)#interface fa0/3 – 4

switch(config-if)#switchport mode private-vlan host #配置fa0/3 – 4为主机端口

switch(config-if)# switchport private-vlan host-assocition 100 300 #在主机端口上配置PVLAN的端口关联

switch(config)#interface fa0/24 #配置fa0/24为混杂端口

switch(config-if)#switchport mode private-vlan promiscuous

switch(config-if)# switchport private-vlan mapping 100 200,300 #在混杂端口上配置PVLAN的端口关联

篇3:cisco VLAN配置典型案例

cisco VLAN配置典型案例

在网上看过一些交换,关于vlan的配置,都比较模糊,自己整理一下资料,

希望对兄妹们有所帮助,

2台Switch与Router Vlan试验

试验设备

Switch 2 台2950

Router 1 台2620

试验要求

在两台Switch上, Switch1和Switch2分别创建Vlan,并用dot1q封装干道

两台Switch上分别是fa0/1与fa0/1连接

Switch1的fa0/12与Router fa0/0连接

Vlan2的主机网关 10.1.1.1 掩码255.255.255.0

Vlan3的主机网关 192.168.1.1 掩码255.255.255.0

Switch1里配置

Switch>

Switch>en

Switch#conf t

Switch(config)#int fa0/1

Switch(config-if)#switchport mode trunk

Switch(config-if)#switchport trunk encapsulation dot1q

Switch(config-if)#end

Switch#conf t

Switch(config)#int fa0/12

Switch(config-if)#switchport mode trunk

Switch(config-if)#switchport trunk encapsulation dot1q

Switch(config-if)#end

Switch#vlan da

Switch(vlan)#vtp server

Switch(vlan)#vtp do cisco

Switch(vlan)#vtp password cisco

Switch(vlan)#vlan 2

Switch(vlan)#vlan 3

Switch(vlan)#exit

Switch#conf t

Switch(config)#int fa0/2

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 2

Switch(config-if)#int fa0/3

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 3

Switch(config-if)#end

Switch2里配置

Switch>

Switch>en

Switch#conf t

Switch(config)#int fa0/1

Switch(config-if)#switchport mode trunk

Switch(config-if)#switchport trunk encapsulation dot1q

Switch(config-if)#end

Switch#vlan database

Switch(vlan)#vtp client

Switch(vlan)#vtp do cisco

Switch(vlan)#vtp password cisco

Switch(vlan)#end

Switch#conf t

Switch(config)#int fa0/2

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 2

Switch(config-if)#end

Switch#conf t

Switch(config)#int fa0/3

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 3

Switch(config-if)#end

Router路由器里的配置

Router>

Router>en

Router#conf t

Router(config)#in fa0/0

Router(config-if)#no ip address

Router(config-if)#no sh

Router(config-if)#int fa0/0.2

Router(config-subif)#encapsulation dot1q 2

Router(config-subif)#ip address 10.1.1.1 255.255.255.0

Router(config-subif)#end

Router#conf t

Router(config)#int fa0/0.3

Router(config-subif)#e

Router(config-subif)#encapsulation dot1q 3

Router(config-subif)#ip address 192.168.1.1 255.255.255.0

Router(config-subif)#end

作者 stan_xiaoming

篇4:DNS的一个配置例子Unix系统

DNS的一个配置例子,正式俺需要的,先记录下地址,稍后再慢慢研究,

blog.chinaunix.net/article.php?articleId=46605&blogId=9575

原文转自:www.ltesting.net

篇5:跨交换机的VLAN配置实验

SW1:

添加VLAN

SW1#vlan database

SW1(vlan)#vlan 10

VLAN 10 added:

Name: VLAN0010

SW1(vlan)#vlan 20

VLAN 20 added:

Name: VLAN0020

SW1(vlan)#vlan 30

VLAN 30 added:

Name: VLAN0030

SW1(vlan)#vlan 40

VLAN 40 added:

Name: VLAN0040

SW1(vlan)#vlan 50

VLAN 50 added:

Name: VLAN0050

SW1(vlan)#exit

APPLY completed.

Exiting....

SW1#show vlan-sw brief

VLAN Name Status Ports

---- -------------------------------- --------- -------------------------------

1 default active Fa0/0, Fa0/1, Fa0/2, Fa0/3

Fa0/4, Fa0/5, Fa0/6, Fa0/7

Fa0/8, Fa0/9, Fa0/10, Fa0/11

Fa0/12, Fa0/13, Fa0/14, Fa0/15

10 VLAN0010 active

20 VLAN0020 active

30 VLAN0030 active

40 VLAN0040 active

50 VLAN0050 active

1002 fddi-default active

1003 token-ring-default active

1004 fddinet-default active

1005 trnet-default active

设置中继并配置以太通道捆绑

SW1#conf t

Enter configuration commands, one per line. End with CNTL/Z.

SW1(config)#interface range fastethernet0/1 - 4

SW1(config-if-range)#switchport mode trunk

*Mar 1 01:12:29.463: %DTP-5-TRUNKPORTON: Port Fa0/1-4 has become dot1q trunk

SW1(config-if-range)#switchport trunk encapsulation dot1q

SW1(config-if-range)#channel-group 1 mode on

Creating a port-channel interface Port-channel1

SW1(config-if-range)#

*Mar 1 01:12:45.775: %EC-5-BUNDLE: Interface Fa0/1 joined port-channel Po1

*Mar 1 01:12:45.991: %EC-5-BUNDLE: Interface Fa0/2 joined port-channel Po1

*Mar 1 01:12:46.159: %EC-5-BUNDLE: Interface Fa0/3 joined port-channel Po1

*Mar 1 01:12:46.339: %EC-5-BUNDLE: Interface Fa0/4 joined port-channel Po1

*Mar 1 01:12:48.487: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to up

SW1(config-if-range)#int range f0/5 - 8

SW1(config-if-range)#switchport mode trunk

*Mar 1 01:13:15.699: %DTP-5-TRUNKPORTON: Port Fa0/5-8 has become dot1q trunk

SW1(config-if-range)#switchport trunk encapsulation dot1q

SW1(config-if-range)#channel-group 2 mode on

Creating a port-channel interface Port-channel2

SW1(config-if-range)#

*Mar 1 01:13:22.123: %EC-5-BUNDLE: Interface Fa0/5 joined port-channel Po2

*Mar 1 01:13:22.411: %EC-5-BUNDLE: Interface Fa0/6 joined port-channel Po2

*Mar 1 01:13:22.591: %EC-5-BUNDLE: Interface Fa0/7 joined port-channel Po2

*Mar 1 01:13:22.795: %EC-5-BUNDLE: Interface Fa0/8 joined port-channel Po2

SW1(config-if-range)#

*Mar 1 01:13:24.831: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel2, changed state to up

SW1(config-if-range)#end

SW1#show etherchannel summary

Flags: D - down P - in port-channel

I - stand-alone s - suspended

R - Layer3 S - Layer2

U - in use

Group Port-channel Ports

-----+------------+-----------------------------------------------------------

1 Po1(SU) Fa0/1(P) Fa0/2(P) Fa0/3(P) Fa0/4(P)

2 Po2(SU) Fa0/5(P) Fa0/6(P) Fa0/7(P) Fa0/8(P)

配置VTP域:

SW1#vlan database

SW1(vlan)#vtp server

Device mode already VTP SERVER.

SW1(vlan)#vtp domain TK

Changing VTP domain name from NULL to TK

SW1(vlan)#vtp password cisco

Setting device VLAN database password to cisco.

SW1(vlan)#vtp pruning

Pruning switched ON

SW1(vlan)#exit

APPLY completed.

Exiting....

SW1#show vtp status

VTP Version : 2

Configuration Revision : 2

Maximum VLANs supported locally : 256

Number of existing VLANs : 10

VTP Operating Mode : Server

VTP Domain Name : TK

VTP Pruning Mode : Enabled

VTP V2 Mode : Disabled

VTP Traps Generation : Disabled

MD5 digest : 0xAA 0x90 0x65 0x7A 0x72 0x0C 0x31 0x6A

Configuration last modified by 0.0.0.0 at 3-1-02 01:15:38

Local updater ID is 0.0.0.0 (no valid interface found)

配置以太通道不承载vlan 40和vlan50的流量:

SW1(config)#int range f0/1 - 4

SW1(config-if-range)#switchport trunk allowed vlan remove 40

SW1(config-if-range)#switchport trunk allowed vlan remove 50

SW1#show int f0/1 switchport

Name: Fa0/1

Switchport: Enabled

Administrative Mode: trunk

Operational Mode: down (suspended member of bundle Po1)

Administrative Trunking Encapsulation: dot1q

Negotiation of Trunking: Disabled

Access Mode VLAN: 0 ((Inactive))

Trunking Native Mode VLAN: 1 (default)

Trunking VLANs Enabled: 1-39,41-49,51-1005

Trunking VLANs Active: none

Priority for untagged frames: 0

Override vlan tag priority: FALSE

Voice VLAN: none

Appliance trust: none

SW1#conf t

Enter configuration commands, one per line. End with CNTL/Z.

SW1(config)#int range f0/5 - 8

SW1(config-if-range)#switchport trunk allowed vlan remove 40

SW1(config-if-range)#switchport trunk allowed vlan remove 50

SW1(config-if-range)#end

SW1#show int f0/5 switchport

Name: Fa0/5

Switchport: Enabled

Administrative Mode: trunk

Operational Mode: down (suspended member of bundle Po2)

Administrative Trunking Encapsulation: dot1q

Negotiation of Trunking: Disabled

Access Mode VLAN: 0 ((Inactive))

Trunking Native Mode VLAN: 1 (default)

Trunking VLANs Enabled: 1-39,41-49,51-1005

Trunking VLANs Active: none

Priority for untagged frames: 0

Override vlan tag priority: FALSE

Voice VLAN: none

Appliance trust: none

SW2:

设置中继并配置以太通道捆绑:

SW2#conf t

Enter configuration commands, one per line. End with CNTL/Z.

SW2(config)#int range f0/1 - 4

SW2(config-if-range)#switchport mode trunk

*Mar 1 01:16:14.267: %DTP-5-TRUNKPORTON: Port Fa0/1-4 has become dot1q trunk

SW2(config-if-range)#switchport trunk encapsulation dot1q

SW2(config-if-range)#channel-group 1 mode on

Creating a port-channel interface Port-channel1

SW2(config-if-range)#

*Mar 1 01:16:20.703: %EC-5-BUNDLE: Interface Fa0/1 joined port-channel Po1

*Mar 1 01:16:20.847: %EC-5-BUNDLE: Interface Fa0/2 joined port-channel Po1

*Mar 1 01:16:20.991: %EC-5-BUNDLE: Interface Fa0/3 joined port-channel Po1

*Mar 1 01:16:21.111: %EC-5-BUNDLE: Interface Fa0/4 joined port-channel Po1

篇6:Linux下配置vlan网卡教程

这篇文章主要介绍了Linux下配置vlan网卡教程,本文使用7步完成vlan网卡设置,需要的朋友可以参考下

1.需要使用到vconfig软件,首先yum安装vconfig

代码如下:

yum install vconfig

2.查看核心是否提供VLAN 功能,绦

代码如下:

dmesg | grep -i 802

查看是否支持,如下图表示支持

代码如下:

[root@CactiServ]# dmesg | grep -i 802

802.1Q VLAN Support v1.8 Ben Greear

3.检查「/proc/net/vlan」档案是否存在:

代码如下:

ls /proc/net/vlan

如果]有提供VLAN 功能,「/proc/net/vlan」目是不存在的。

如果存在如下所示:

代码如下:

[root@CactiServ]# ls /proc/net/vlan

config eth1.100 eth1.25

4.使用「m o d p ro b e 」模组命令载入「802.1q.o」模组,而且利用「lsmod」命令确认模M是否已经载入到核心龋

电脑资料

代码如下:

[root@CactiServ]# modprobe 8021q

[root@CactiServ]# lsmod | grep 8021q

8021q25493 0

garp 7152 1 8021q

5.使用vconfig命令增加子接口:增加vlan为25和vlan为100的子接口

代码如下:

vconfig add eth1 25

vconfig add eth1 100

然后,利用ls 指令查看「/proc/net/vlan」目录下有何变化,发现多了一哥名为「eth1.25」的档案,而且可使用「ifconfig eth1.25」命令砣范VLAN 介面是否存在。

注意增加vlan,增加子接口时,首先确保eth1端口无ipadd。

6.增加好以后,利用cp命令复制接口的ip地址配置。

代码如下:

cp ifcfg-eth1 ifcfg-eth1.25

cp ifcfg-eth1 ifcfg-eth1.100

再vi修改ifcfg-eth1.25 ifcfg-eth1.100文件,设置IP地址等信息。

7.最后重启network服务。令配置生效。

一个用SearchValidAddr搜索基址的例子

实际的近义词

好词好句的例子

比尔盖茨成功的例子

日常生活实际随笔150字

下载一个VLAN配置的实际例子(共6篇)
一个VLAN配置的实际例子.doc
将本文的Word文档下载到电脑,方便收藏和打印
推荐度:
点击下载文档
点击下载本文文档