cisco交换机作dhcp中继

简介:
有一次到一公司去面试,问到客户端DHCP的事,我只是简单的把原理说出来,后面试官要我写命令,因刚接触CISCO不久,把命令写得乱七八糟的,最后就把这个工作机会给弄丢了,今天在小凡上面以3725路由器模拟WINDOWS 2003作DHCP服务器,CISCO交换机作DHCP RELAY的一个DHCP网络环境,希望新手看到后,有所收获。
 
设备:四台3725路由器,SW4作DHCP SERVER,SW1,SW2,SW3作交换机。4台DHCP客户端,一台与DHCP SERVER
 
数据:SW4作如下DHCP 池
             pool vlan2 172.18.1.0 255.255.255.0 gateway 172.18.1.10
             pool vlan3 172.18.3.0 255.255.255.0 gateway 172.18.3.254
             pool vlan4 172.18.4.0 255.255.255.0 gateway 172.18.4.254
             pool vlan5 172.18.5.0 255.255.255.0 gateway 172.18.5.254
             f1/1 ip 172.18.1.11(模拟windows的IP地址)
             ip route 0.0.0.0 0.0.0.0 172.18.1.10(模拟windows的网关)
 
             SW1交换机划分VLAN 2,VLAN3,VLAN4,VLAN5
            VLAN2 IP 172.18.1.10
            VLAN3 IP 172.18.3.254
            VLAN4 IP 172.18.4.254
            VLAN5 IP 172.18.5.254
            F1/1 ,F1/4 属于 vlan2,并且f1/4接PC4 (设计目的为,同一 vlan里,应该不要用ip helper-address命令,就可以获取IP)
            F1/2属于 vlan3(设计目的为,不同VLAN里,应用ip helper-address命令,可以获取vlan 3的IP)
            f1/3 trunk 口(设计目的为,如果dhcp广播通过trunk后,各个vlan应用ip helper-address命令后,能不能获取各自的IP)
           
            SW2交换机
            f1/2 接sw1的f1/2
            f1/1 接pc1
           
            SW3交换机划分vlan4,vlan5
            f1/3 trunk口接sw1的f1/3
            f1/1 属于 vlan4 接pc2
            f1/2 属于 vlan5接pc3
具体拓朴图如下:
 
SW1,SW2,SW3,SW4的具体配置分别如下:
 
R1的具体配置:
R1#sh run
Building configuration...
Current configuration : 1461 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
ip cef
!
!
multilink bundle-name authenticated
!
interface FastEthernet1/0
!
interface FastEthernet1/1
 switchport access vlan 2 (把它放到vlan2里,vlan1一般作管理地址)
!
interface FastEthernet1/2
 switchport access vlan 3 (接下级交换机,如果下级交换机没有划分vlan,那么这个交换机的所有口都属于vlan3)
!
interface FastEthernet1/3
 switchport mode trunk (便于vlan4,vlan5通过trunk口与下级交换机SW3通信)
!
interface FastEthernet1/4
 switchport access vlan 2 (这个口接PC,验证同vlan里DHCP情况)
!
interface FastEthernet1/5
!
interface FastEthernet1/6
!
interface Vlan1
 no ip address
!
interface Vlan2
 ip address 172.18.1.10 255.255.255.0  (设个IP,意为着SW4在vlan2的网络里)
!
interface Vlan3
 ip address 172.18.3.254 255.255.255.0
 ip helper-address 172.18.1.11        (这里为SW4的IP,即服务器的IP地址)
!
interface Vlan4
 ip address 172.18.4.254 255.255.255.0
 ip helper-address 172.18.1.11
!
interface Vlan5
 ip address 172.18.5.254 255.255.255.0
 ip helper-address 172.18.1.11
!
!
ip http server
no ip http secure-server
!
!
control-plane
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
=============
R2的具体配置:
R2#sh run
Building configuration...
Current configuration : 1040 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R2
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
ip cef
!
!
!
!
multilink bundle-name authenticated
!
interface FastEthernet1/0
!
interface FastEthernet1/1
!
interface FastEthernet1/2
!
interface FastEthernet1/3
!
interface FastEthernet1/4
!
interface FastEthernet1/5
!
interface Vlan1                           (这个交换机没有什么配置的,当HUB用)
 no ip address
!
!
ip http server
no ip http secure-server
!
!
control-plane
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
=========
R3的具体配置:
R3#sh run
Building configuration...
Current configuration : 1243 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R3
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
ip cef
!
!
!
!
multilink bundle-name authenticated
!
interface FastEthernet1/0
!
interface FastEthernet1/1
 switchport access vlan 4
!
interface FastEthernet1/2
 switchport access vlan 5
!
interface FastEthernet1/3
 switchport mode trunk           (本交换机的vlan4,vlan5数据通过这个口上连至SW)
!
interface FastEthernet1/4
!
interface FastEthernet1/5
!
interface FastEthernet1/6
!
interface FastEthernet1/7
!
interface Vlan1
 no ip address
!
interface Vlan4
 no ip address
!
interface Vlan5
 no ip address
!
!
ip http server
no ip http secure-server
!
!
control-plane
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
==============
R4的具体配置:
R4#sh run
Building configuration...
Current configuration : 1774 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R4
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
ip cef
!
!
no ip dhcp use vrf connected
!
ip dhcp pool vlan2                            (cisco作dhcp服务器的命令)
   network 172.18.1.0 255.255.255.0
   default-router 172.18.1.10
   dns-server 172.18.1.110
   netbios-name-server 172.18.1.110
!
ip dhcp pool vlan3
   network 172.18.3.0 255.255.255.0
   default-router 172.18.3.254
   dns-server 172.18.1.110
   netbios-name-server 172.18.1.110
!
ip dhcp pool vlan4
   network 172.18.4.0 255.255.255.0
   default-router 172.18.4.254
   netbios-name-server 172.18.1.110
   dns-server 172.18.1.110
!
ip dhcp pool vlan5
   network 172.18.5.0 255.255.255.0
   dns-server 172.18.1.110
   netbios-name-server 172.18.1.110
   default-router 172.18.5.254
!
!
multilink bundle-name authenticated
!
interface FastEthernet1/0
!
interface FastEthernet1/1
 no switchport
 ip address 172.18.1.11 255.255.255.0
!
interface FastEthernet1/2
!
interface FastEthernet1/3
!
interface FastEthernet1/4
!
interface FastEthernet1/5
!
interface FastEthernet1/6
!
interface FastEthernet1/7
!
interface Vlan1
 no ip address
!
ip route 0.0.0.0 0.0.0.0 172.18.1.10    (模拟windwos服务器的网关)
!
ip http server
no ip http secure-server
!
!
control-plane
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
R4#
 
要注意的地方:
ip helper-address 的地址一定是dhcp server服务器的ip地址,不是dhcp server服务器所在网络的网关。




     本文转自itwork 51CTO博客,原文链接:http://blog.51cto.com/369369/273474 ,如需转载请自行联系原作者

相关文章
|
3月前
|
算法 网络协议 Linux
【Cisco Packet Tracer】交换机的自学习算法
【Cisco Packet Tracer】交换机的自学习算法
58 0
|
5月前
|
网络协议 Linux Shell
CentOS 7系统下DHCP及中继服务部署
设备 IP地址 主DNS服务器 192.168.100.254 从DNS服务器 192.168.100.1 客户端 192.168.200.2 一、DHCP服务器的部署
132 0
|
3月前
|
网络协议 Linux 网络架构
【Cisco Packet Tracer】集线器和交换机区别
【Cisco Packet Tracer】集线器和交换机区别
108 1
|
13天前
|
网络虚拟化 网络架构
|
25天前
|
网络协议 网络架构
DHCP中继实验
DHCP中继实验
网络技术基础(16)——DHCP中继
【3月更文挑战第3天】刚加完班又去南京出差了,实在是太忙了。。。。网络基础笔记(加班了几天,中途耽搁了,预计推迟6天),这篇借鉴了之前师兄的笔记。
|
3月前
|
网络协议 Linux 网络架构
【Cisco Packet Tracer】运输层端口与DHCP的作用
【Cisco Packet Tracer】运输层端口与DHCP的作用
37 0
|
7月前
|
算法 网络虚拟化 C语言
【Cisco Packet Tracer】交换机划分Vlan实验
文章目录 一、前期准备 二、实验要求 三、搭建局域网 四、配置pc端的ip 五、配置VLAN 六、设置端口模式trunk 七、PING检验是否通路
|
8月前
|
网络架构
交换机与路由器技术-08-路由器上配置DHCP
交换机与路由器技术-08-路由器上配置DHCP
21 0
|
12月前
DHCP中继(实验操作)
DHCP中继(实验操作)