日省其身,有则改之,无则加勉!
当前位置:首页路由交换 - switch&hcp服务器为不同的vlan分配IP地址

switch&hcp服务器为不同的vlan分配IP地址

 

拓朴如下,用的是dy模拟器,iso是unzip-c3640-ik9o3s-mz.124-10.bin







模拟器不保存vlan信息:
(config)#vtp file nvram:vlan.dat
Setting device to store VLAN database at filename nvram:vlan.dat.

Switch(Config)Service Dhcp //默认是开启的
Switch(Config)Ip Dhcp Relay Information Option//这句不用配也可以分的。


交换机配置如下:
Switch1#show running
Building configuration...

Current configuration : 1398 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname Switch1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
no ip routing
!
!
no ip cef
no ip domain lookup
!
!
!
vtp file nvram:vlan.dat

!
interface FastEthernet0/0
!
interface FastEthernet0/1
!
interface FastEthernet0/2
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
switchport mode trunk
!
interface FastEthernet0/15
switchport mode trunk
!
interface Vlan1
ip address 192.168.254.1 255.255.255.0
no ip route-cache
!
interface Vlan2
no ip address
ip helper-address 192.168.168.168
no ip route-cache
!
interface Vlan3
no ip address
ip helper-address 192.168.168.168
no ip route-cache
!
interface Vlan4
no ip address
ip helper-address 192.168.168.168
no ip route-cache
!
interface Vlan168
no ip address
no ip route-cache
!
ip default-gateway 192.168.254.2
ip http server
!
!
!
!
!
!
control-plane
!
!
!
line con 0
line aux 0
line vty 0 4
privilege level 15
password onepc
login
!
!
end

///////////////////////////////////////////////////////////////////
Switch2#show running-config
Building configuration...

Current configuration : 1458 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname Switch2
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
no ip domain lookup
!
!
!
vtp file nvram:vlan.dat

!
!
!
!
interface FastEthernet0/0
switchport access vlan 168
!
interface FastEthernet0/1
switchport access vlan 168
!
interface FastEthernet0/2
switchport access vlan 2
!
interface FastEthernet0/3
switchport access vlan 2
!
interface FastEthernet0/4
switchport access vlan 2
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
switchport mode trunk
!
interface Vlan1
ip address 192.168.254.2 255.255.255.0
!
interface Vlan2
ip address 192.168.2.1 255.255.255.0
ip helper-address 192.168.168.168
!
interface Vlan3
ip address 192.168.3.1 255.255.255.0
ip helper-address 192.168.168.168
!
interface Vlan4
ip address 192.168.4.1 255.255.255.0
ip helper-address 192.168.168.168
!
interface Vlan168
ip address 192.168.168.1 255.255.255.0
!
ip http server
!
!
!
!
!
!
control-plane
!
!
!
!
line con 0
line aux 0
line vty 0 4
privilege level 15
password onepc
login
!
!
end

Switch2#

 


/////////////////////////////////////////////////////////////////
Switch3#show running
Building configuration...

Current configuration : 1389 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname Switch3
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
no ip routing
!
!
no ip cef
no ip domain lookup
!
!
!
!
vtp file nvram:vlan.dat

!
!
!
!
interface FastEthernet0/0
switchport access vlan 3
!
interface FastEthernet0/1
switchport access vlan 4
!
interface FastEthernet0/2
switchport access vlan 4
!
interface FastEthernet0/3
switchport access vlan 4
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
switchport mode trunk
!
interface Vlan1
ip address 192.168.254.3 255.255.255.0
no ip route-cache
!
interface Vlan2
no ip address
ip helper-address 192.168.168.168
no ip route-cache
!
interface Vlan3
no ip address
ip helper-address 192.168.168.168
no ip route-cache
!
interface Vlan4
no ip address
ip helper-address 192.168.168.168
no ip route-cache
!
ip default-gateway 192.168.254.2
ip http server
!
!
!
!
!
!
control-plane
!
!
!
!
line con 0
line aux 0
line vty 0 4
login
!
!
end

 


分享到: 更多
标签:DHCP VLAN
分类:路由交换| 发布:你认错人了| 点击: | 发表时间:2011-9-17
本文链接:http://www.netcento.com/archive/304.html
上一篇:« 如何加强Apache Web服务器的安全防范?
下一篇:IE6 li:hover兼容问题 »

相关文章

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。