如何设置cisco路由器成为一台dhcp服务器?
发布网友
发布时间:2022-04-20 20:50
我来回答
共3个回答
懂视网
时间:2022-04-13 00:22
version 12.0 no service pad service timestamps debug uptime service timestamps log uptime no service password-encryption service udp-small-servers service tcp-small-servers ! hostname Router ! ! ip subnet-zero ip dhcp excluded-address 172.
version 12.0
no service pad
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
service udp-small-servers
service tcp-small-servers
!
hostname Router
!
!
ip subnet-zero
ip dhcp excluded-address 172.16.240.1 172.16.240.10
ip dhcp excluded-address 172.16.240.201 172.16.240.254
!
ip dhcp pool flink
network 172.16.240.0 255.255.255.0
default-router 172.16.240.254
domain-name ns3.bta.net.cn
dns-server 202.106.196.115 202.106.0.20
!
no ip domain-lookup
!
!
process-max-time 200
!
interface Ethernet0
ip address 172.16.241.254 255.255.255.0 secondary
ip address 172.16.242.254 255.255.255.0 secondary
ip address 172.16.243.254 255.255.255.0 secondary
ip address 172.16.244.254 255.255.255.0 secondary
ip address 172.16.240.254 255.255.255.0
no ip directed-broadcast
ip nat inside
!
interface Serial0
ip address 192.168.108.22 255.255.255.252
no ip directed-broadcast
ip nat outside
!
ip nat pool gj 210.72.225.88 210.72.225.95 netmask 255.255.255.248
ip nat inside source list 1 pool gj overload
ip nat inside source static n
no ip http server
ip route 0.0.0.0 0.0.0.0 192.168.108.21
!
access-list 1 permit 172.16.240.0 0.0.0.255
!
line con 0
transport input none
stopbits 1
line vty 0 4
login
当然用W2K SERVER也可以做DHCP,她这样使客户机不用手工配置IP,这种IP就可动态产生!
热心网友
时间:2022-04-12 21:30
网络环境:一台3550EMI交换机,划分三个vlan,vlan2 为服务器所在网络,命名为server,IP地址段
为192.168.2.0,子网掩码:255.255.255.0,网关:192.168.2.1,域服务器为windows 2000 advance server,
同时兼作DNS服务器,IP地址为192.168.2.10,vlan3为客户机1所在网络,IP地址段为192.168.3.0,子网掩
码:255.255.255.0,网关:192.168.3.1命名为work01,vlan4为客户机2所在网络,命名为work02,IP地址段为
192.168.4.0,子网掩码:255.255.255.0,网关:192.168.4.1,
3550作DHCP服务器,端口1-8划到VLAN 2,端口9-16划分到VLAN 3,端口17-24划分到VLAN 4.
DHCP服务器实现功能:
各VLAN保留2-10的IP地址不分配置,例如:192.168.2.0的网段,保留192.168.2.2至192.168.2.10的IP地
址段不分配.
安全要求:
VLAN 3和VLAN 4 不允许互相访问,但都可以访问服务器所在的VLAN 2,
默认访问控制列表的规则是拒绝所有包.
配置命令及步骤如下:
第一步:创建VLAN:
Switch>en
Switch#Vlan Database
Switch(Vlan)>Vlan 2 Name server
Switch(Vlan)>Vlan 3 Name work01
Switch(vlan)>Vlan 4 Name work02
第二步:设置VLAN IP地址:
Switch#Config T
Switch(Config)>Int Vlan 2
Switch(Config-vlan)Ip Address 192.168.2.1 255.255.255.0
Switch(Config-vlan)No Shut
Switch(Config-vlan)>Int Vlan 3
Switch(Config-vlan)Ip Address 192.168.3.1 255.255.255.0
Switch(Config-vlan)No Shut
Switch(Config-vlan)>Int Vlan 4
Switch(Config-vlan)Ip Address 192.168.4.1 255.255.255.0
Switch(Config-vlan)No Shut
Switch(Config-vlan)Exit
/*注意:由于此时没有将端口分配置到VLAN2,3,4,所以各VLAN会DOWN掉,待将端口分配到各VLAN后,V
LAN会起来*/
第三步:设置端口全局参数
Switch(Config)Interface Range Fa 0/1 - 24
Switch(Config-if-range)Switchport Mode Access
Switch(Config-if-range)Spanning-tree Portfast
第四步:将端口添加到VLAN2,3,4中
/*将端口1-8添加到VLAN 2*/
Switch(Config)Interface Range Fa 0/1 - 8
Switch(Config-if-range)Switchport Access Vlan 2
/*将端口9-16添加到VLAN 3*/
Switch(Config)Interface Range Fa 0/9 - 16
Switch(Config-if-range)Switchport Access Vlan 3
/*将端口17-24添加到VLAN 4*/
Switch(Config)Interface Range Fa 0/17 - 24
Switch(Config-if-range)Switchport Access Vlan 4
Switch(Config-if-range)Exit
/*经过这一步后,各VLAN会起来*/
第五步:配置3550作为DHCP服务器
/*VLAN 2可用地址池和相应参数的配置,有几个VLAN要设几个地址池*/
Switch(Config)Ip Dhcp Pool Test01
/*设置可分配的子网*/
Switch(Config-pool)Network 192.168.2.0 255.255.255.0
/*设置DNS服务器*/
Switch(Config-pool)Dns-server 192.168.2.10
/*设置该子网的网关*/
Switch(Config-pool)Default-router 192.168.2.1
/*配置VLAN 3所用的地址池和相应参数*/
Switch(Config)Ip Dhcp Pool Test02
Switch(Config-pool)Network 192.168.3.0 255.255.255.0
Switch(Config-pool)Dns-server 192.168.2.10
Switch(Config-pool)Default-router 192.168.3.1
/*配置VLAN 4所用的地址池和相应参数*/
Switch(Config)Ip Dhcp Pool Test03
Switch(Config-pool)Network 192.168.4.0 255.255.255.0
Switch(Config-pool)Dns-server 192.168.2.10
Switch(Config-pool)Default-router 192.168.4.1
第六步:设置DHCP保留不分配的地址
Switch(Config)Ip Dhcp Excluded-address 192.168.2.2 192.168.2.10
Switch(Config)Ip Dhcp Excluded-address 192.168.3.2 192.168.3.10
Switch(Config)Ip Dhcp Excluded-address 192.168.4.2 192.168.4.10
第七步:启用路由
/*路由启用后,各VLAN间主机可互相访问*/
Switch(Config)Ip Routing
第八步:配置访问控制列表
Switch(Config)access-list 103 permit ip 192.168.2.0 0.0.0.255 192.168.3.0 0.0.0.255
Switch(Config)access-list 103 permit ip 192.168.3.0 0.0.0.255 192.168.2.0 0.0.0.255
Switch(Config)access-list 103 permit udp any any eq bootpc
Switch(Config)access-list 103 permit udp any any eq tftp
Switch(Config)access-list 103 permit udp any eq bootpc any
Switch(Config)access-list 103 permit udp any eq tftp any
Switch(Config)access-list 104 permit ip 192.168.2.0 0.0.0.255 192.168.4.0 0.0.0.255
Switch(Config)access-list 104 permit ip 192.168.4.0 0.0.0.255 192.168.2.0 0.0.0.255
Switch(Config)access-list 104 permit udp any eq tftp any
Switch(Config)access-list 104 permit udp any eq bootpc any
Switch(Config)access-list 104 permit udp any eq bootpc any
Switch(Config)access-list 104 permit udp any eq tftp any
第九步:应用访问控制列表
/*将访问控制列表应用到VLAN 3和VLAN 4,VLAN 2不需要*/
Switch(Config)Int Vlan 3
Switch(Config-vlan)ip access-group 103 out
Switch(Config-vlan)Int Vlan 4
Switch(Config-vlan)ip access-group 104 out
第十步:结束并保存配置
Switch(Config-vlan)End
Switch#Copy Run Start
热心网友
时间:2022-04-12 22:48
呵呵,好大的篇副。
router(config)#ip dhcp excluded-address 10.20.30.1 10.20.30.10
router(config)#interface fastethernet 0/0
router(config-if)#ip address 10.20.30.1 255.255.255.0
router(config-if)#exit
router(config)#ip dhcp pool border
router(dhcp-config)#network 10.20.30.0 255.255.255.0
router(dhcp-config)#default-router 10.20.30.1
router(dhcp-config)#domain-name cisco.com