首页 > 代码库 > VLAN配置及通信实验

VLAN配置及通信实验

技术分享

技术分享

实验结果

一、SW1启用DHCP,PC1-6开启DHCP获取IP地址。可以分别获得VLAN 10、20、30、40的IP,并且可以互相ping通。

二、PC7和PC9可以ping通;PC8和PC9可以ping通;PC7和PC8不能ping通。(hybrid接口功能)


SW1配置

#

sysname SW1

#

vlan batch 10 20 30 40 110 120 199

#

cluster enable

ntdp enable

ndp enable

#

drop illegal-mac alarm

#

dhcp enable

#

diffserv domain default

#

drop-profile default

#

aaa 

 authentication-scheme default

 authorization-scheme default

 accounting-scheme default

 domain default 

 domain default_admin 

 local-user admin password simple admin

 local-user admin service-type http

#

interface Vlanif1

#

interface Vlanif10

 ip address 192.168.10.1 255.255.255.0 

 dhcp select interface

 dhcp server dns-list 10.10.10.10 

#

interface Vlanif20

 ip address 192.168.20.1 255.255.255.0 

 dhcp select interface

 dhcp server dns-list 10.10.10.10 

#

interface Vlanif30

 ip address 192.168.30.1 255.255.255.0 

 dhcp select interface

 dhcp server dns-list 10.10.10.10 

#

interface Vlanif40

 ip address 192.168.40.1 255.255.255.0 

 dhcp select interface

 dhcp server dns-list 10.10.10.10 

#

interface MEth0/0/1

#

interface GigabitEthernet0/0/1

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

#

interface GigabitEthernet0/0/2

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

#

interface GigabitEthernet0/0/3

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

#

interface GigabitEthernet0/0/4

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

#

interface GigabitEthernet0/0/5

 port hybrid pvid vlan 110

 port hybrid untagged vlan 110 199

#

interface GigabitEthernet0/0/6

 port hybrid pvid vlan 120

 port hybrid untagged vlan 120 199

#

interface GigabitEthernet0/0/7

 port hybrid pvid vlan 199

 port hybrid untagged vlan 110 120 199

#


SW2配置

#

sysname SW2

#

vlan batch 10 20

#

cluster enable

ntdp enable

ndp enable

#

drop illegal-mac alarm

#

diffserv domain default

#

drop-profile default

#

aaa 

 authentication-scheme default

 authorization-scheme default

 accounting-scheme default

 domain default 

 domain default_admin 

 local-user admin password simple admin

 local-user admin service-type http

#

interface Vlanif1

#

interface MEth0/0/1

#

interface Ethernet0/0/1

 port link-type trunk

 port trunk allow-pass vlan 10 20

#

interface Ethernet0/0/2

 port link-type access

 port default vlan 10

#

interface Ethernet0/0/3

 port link-type access

 port default vlan 20

#


SW3配置

#

sysname SW3

#

vlan batch 10 20

#

cluster enable

ntdp enable

ndp enable

#

drop illegal-mac alarm

#

diffserv domain default

#

drop-profile default

#

aaa 

 authentication-scheme default

 authorization-scheme default

 accounting-scheme default

 domain default 

 domain default_admin 

 local-user admin password simple admin

 local-user admin service-type http

#

interface Vlanif1

#

interface MEth0/0/1

#

interface Ethernet0/0/1

 port link-type trunk

 port trunk allow-pass vlan 10 20

#

interface Ethernet0/0/2

 port link-type access

 port default vlan 10

#

interface Ethernet0/0/3

 port link-type access

 port default vlan 20

#


SW4配置

#

sysname SW4

#

vlan batch 30 40

#

cluster enable

ntdp enable

ndp enable

#

drop illegal-mac alarm

#

diffserv domain default

#

drop-profile default

#

vlan 30

 mac-vlan mac-address 5489-98df-06ba priority 0

vlan 40

 mac-vlan mac-address 5489-98ed-622e priority 0

#

aaa 

 authentication-scheme default

 authorization-scheme default

 accounting-scheme default

 domain default 

 domain default_admin 

 local-user admin password simple admin

 local-user admin service-type http

#

interface Vlanif1

#

interface MEth0/0/1

#

interface Ethernet0/0/1

 port link-type trunk

 port trunk allow-pass vlan 30 40

#

interface Ethernet0/0/2

 port hybrid untagged vlan 30 40

 mac-vlan enable

#

interface Ethernet0/0/3

 port hybrid untagged vlan 30 40

 mac-vlan enable

#



本文出自 “互联互通” 博客,请务必保留此出处http://jschinamobile.blog.51cto.com/11464420/1912713

VLAN配置及通信实验