实验拓扑:我习惯了用思科的模拟软件做图,其他的不习惯,所以这个拓扑图你能懂的
实验步骤:
(1)本实验既能实现不同vlan间通讯,又要使vlan动态获得IP地址,所以R1既要配置单臂路由,也要配置中继
在华为设备中开启中继命令
[R1]debugging ip relay protocol
开启后在路由的子接口e0.10和e0.20模式下指明DHCP服务器的IP地址命令ip relay address 服务器IP
[R1]dis cu
interface Ethernet0
ip address 192.168.1.254 255.255.255.0
!
interface Ethernet0.10
vlan-type dot1q vid 10
ip address 192.168.10.254 255.255.255.0
ip relay-address 192.168.30.100
!
interface Ethernet0.20
vlan-type dot1q vid 20
ip address 192.168.20.254 255.255.255.0
ip relay-address 192.168.30.100
!
interface Ethernet0.30
vlan-type dot1q vid 30
ip address 192.168.30.254 255.255.255.0
!
[R1]dis ip relay-address
** Ethernet0.10 Relay Address **
Relay Address [0] : 192.168.30.100
** Ethernet0.20 Relay Address **
Relay Address [0] : 192.168.30.100
(2)DHCP服务器配置
[Server]dis cu
dhcp server ip-pool 1
network 192.168.10.0 mask 255.255.255.0
gateway-list 192.168.10.254
!
dhcp server ip-pool 2
network 192.168.20.0 mask 255.255.255.0
gateway-list 192.168.20.254
!
dhcp server ip-pool 3
network 192.168.30.0 mask 255.255.255.0
gateway-list 192.168.30.254
!
interface Ethernet0
ip address 192.168.30.100 255.255.255.0
!
interface Ethernet1
!
interface Serial0
link-protocol ppp
!
interface Serial1
link-protocol ppp
!
quit
ip route-static 0.0.0.0 0.0.0.0 192.168.30.254 preference 60
(3)交换机SW1的配置
[SW1]dis cu
vlan 1
vlan 10
vlan 20
vlan 30
interface Vlan-interface1
ip address 192.168.1.1 255.255.255.0
interface Ethernet0/10
port access vlan 10
interface Ethernet0/15
port access vlan 30
interface Ethernet0/20
port access vlan 20
interface Ethernet0/24
port link-type trunk
port trunk permit vlan all
(4)验证
我用我的电脑连接到交换机的e0/20口,先释放后重新获得