锐捷系列 跨交换机实现DHCP

设备: 一台锐捷RG-S3760-24三层交换机和一台RG-S2026F两层交换机6台PC
拓扑:

VLAN ID IP             PC  接口

VLAN 10 IP 192.168.1.1 PC1 三层交换机上F0/1接口 

VLAN 20 IP 192.168.2.1 PC2 二层交换机上F0/1接口

S3760:

 

 Switch>en

 Switch#conf

 Switch(config)#ho 3c

 3c(config)#service dhcp/开启DHCP服务

 3c(config)#vlan 10/创建vlan 10

 3c(config-vlan)#exit

 3c(config)#vlan 20/创建vlan 20

 3c(config-vlan)#exit

 3c(config)#int range f0/1,f0/3-5/进入不连续端口的命令和格式

 3c(config-if-range)#swi acc vlan 10/把以上端口划分到vlan10中

 3c(config-if-range)#int range f0/6-12/进入同一组端口

 3c(config-if-range)#swi acc vlan 20/把以上端口划分到vlan20中

 3c(config-if-range)#int vlan 10/进入vlan10中

 3c(config-if)#ip add 192.168.1.1 255.255.255.0/配置IP地址和子网掩码

 3c(config-if)#no shutdown/启用该端口

 3c(config-if)#exit

 3c(config)#int vlan 20

 3c(config-if)#ip add 192.168.2.1 255.255.255.0

 3c(config-if)#no shutdown

 3c(config-if)#int f0/2

 3c(config-if)#swi mode trunk/设为TRUNK口

 3c(config-if)#ip dhcp excluded-address 192.168.1.1/排除192.168.1.1这个地址,这个地址
作为网关

 3c(config)#ip dhcp pool vlan10/创建名为VLAN10的地址池

 3c(dhcp-config)#network 192.168.1.0 255.255.255.0/可分配的ip地址为192.168.1.0段

 3c(dhcp-config)#default-router 192.168.1.1/配置默认网关

 3c(dhcp-config)#dns-server 61.177.7.1/配置DNS地址

 3c(dhcp-config)#lease 2/设置租期为2天,如果设为永久就不行了

 3c(dhcp-config)#domanin-name abc.cn/配置域

 3c(dhcp-config)#exit

 3c(config)#ip dhcp excluded-address 192.168.2.1

 3c(config)#ip dhcp pool vlan20

 3c(dhcp-config)#network 192.168.2.0 255.255.255.0

 3c(dhcp-config)#default-router 192.168.2.1

 3c(dhcp-config)#dns-server 61.177.7.1

 3c(dhcp-config)#lease 2

 3c(dhcp-config)#domanin-name abc.cn

 3c(dhcp-config)#exit

 3c(config)#

 

S2026F:

Switch(config)#ho 2c

 2c(config)#vlan 10

 2c(config-vlan)#exit

 2c(config)#vlan 20

 2c(config-if-range)#exit

 2c(config)#int range f0/6-12

 2c(config-if-range)#swi acc vlan 20

 2c(config-if-range)#exi

 2c(config)#int range f0/1,f0/3-5

 2c(config-if-range)#swi acc vlan 10

 2c(config-if-range)#exit

 2c(config)#int f0/2

 2c(config-if)#swi mode trunk

 2c(config-if)#exit

S3760的show

 3c#show runn

 

 hostname 3c

 !

 !

 !

 !

 ip dhcp excluded-address 192.168.1.1

 ip dhcp excluded-address 192.168.2.1

 !

 ip dhcp pool vlan10

  network 192.168.1.0 255.255.255.0

  default-router 192.168.1.1

  dns-server 61.177.7.1

 ip dhcp pool vlan20

  network 192.168.2.0 255.255.255.0

  default-router 192.168.2.1

  dns-server 61.177.7.1

 !

 !

 !

 !

 !

 !

 !

 

 interface FastEthernet0/1

  switchport access vlan 10

 !

 interface FastEthernet0/2

  switchport mode trunk

 !

 interface FastEthernet0/3

  switchport access vlan 10

 !

 interface FastEthernet0/4

  switchport access vlan 10

 !

 interface FastEthernet0/5

  switchport access vlan 10

 !

 interface FastEthernet0/6

  switchport access vlan 20

 !

 interface FastEthernet0/7

  switchport access vlan 20

 !

 interface FastEthernet0/8

  switchport access vlan 20

 !

 interface FastEthernet0/9

  switchport access vlan 20

 !

 interface FastEthernet0/10

  switchport access vlan 20

 !

 interface FastEthernet0/11

  switchport access vlan 20

 !

 interface FastEthernet0/12

  switchport access vlan 20

 !

 interface FastEthernet0/13

 !

 interface FastEthernet0/14

 !

 interface FastEthernet0/15

 !

 interface FastEthernet0/16

 !

 interface FastEthernet0/17

 !

 interface FastEthernet0/18

 !

 interface FastEthernet0/19

 !

 interface FastEthernet0/20

 !

 interface FastEthernet0/21

 !

 interface FastEthernet0/22

 !

 interface FastEthernet0/23

 !

 interface FastEthernet0/24

 !

 interface GigabitEthernet0/1

 !

 interface GigabitEthernet0/2

 !

 interface Vlan1

  no ip address

  shutdown

 !

 interface Vlan10

  ip address 192.168.1.1 255.255.255.0

 !

 interface Vlan20

  ip address 192.168.2.1 255.255.255.0

 !

 ip classless

 !

 line con 0

 line vty 0 4

  login

 !

 !

 !

 end

 S2026F的show:

 

hostname 2c

 !

 !

 !

 interface FastEthernet0/1

  switchport access vlan 10

 !

 interface FastEthernet0/2

  switchport access vlan 10

  switchport mode trunk

 !

 interface FastEthernet0/3

  switchport access vlan 10

 !

 interface FastEthernet0/4

  switchport access vlan 10

 !

 interface FastEthernet0/5

  switchport access vlan 10

 !

 interface FastEthernet0/6

  switchport access vlan 20

 !

 interface FastEthernet0/7

  switchport access vlan 20

 !

 interface FastEthernet0/8

  switchport access vlan 20

 !

 interface FastEthernet0/9

  switchport access vlan 20

 !

 interface FastEthernet0/10

  switchport access vlan 20

 !

 interface FastEthernet0/11

  switchport access vlan 20

 !

 interface FastEthernet0/12

  switchport access vlan 20

 !

 interface FastEthernet0/13

 !

 interface FastEthernet0/14

 !

 interface FastEthernet0/15

 !

 interface FastEthernet0/16

 !

 interface FastEthernet0/17

 !

 interface FastEthernet0/18

 !

 interface FastEthernet0/19

 !

 interface FastEthernet0/20

 !

 interface FastEthernet0/21

 !

 interface FastEthernet0/22

 !

 interface FastEthernet0/23

 !

 interface FastEthernet0/24

 !

 interface GigabitEthernet1/1

 !

 interface GigabitEthernet1/2

 !

 interface Vlan1

  no ip address

  shutdown

 !

 !

 line con 0

 !

 line vty 0 4

  login

 line vty 5 15

  login

 !

 !

 end

 

 PC1>ipconfig /all

 

 Physical Address................: 000A.4111.7CD0

 IP Address......................: 192.168.1.2

 Subnet Mask.....................: 255.255.255.0

 Default Gateway.................: 192.168.1.1

 DNS Servers.....................: 61.177.7.1

 PC2>ipconfig /all

 

 Physical Address................: 00E0.F753.2931

 IP Address......................: 192.168.1.3

 Subnet Mask.....................: 255.255.255.0

 Default Gateway.................: 192.168.1.1

 DNS Servers.....................: 61.177.7.1

 

 把pc1插在vlan20的接口内,就会分配为2.0段的地址

 把pc2插在vlan10,vlan20的接口内,就会分配地址了!

这样跨交换机实现VLAN总算实现了,

本来这个挺简单的,但是搞了我一下午,后来才发现原因,就是租期不能设为永久,第二个就是给

vlan10划分地址的其实就是给名为vlan10的DHCP服务器划分地址
感悟:做技术这行有些东西,看似简单但是如果做的话就会发现各种问题了!

最后欢迎各位博友,对我评论,提出问题共同探讨,共同进步!把您的收获、迷惑都写下来吧!
欢迎各位去投我发起的投票

你后悔走到现在吗?
http://home.51cto.com/apps/vote/index.php?s=/Index/pollDetail/id/1910 
 

htt
您觉得一下那个IT方向更有前景?

p://home.51cto.com/apps/vote/index.php?s=/Index/pollDetail/id/1909

 

 

你可能感兴趣的:(锐捷,交换机)