申明:本文为“老毛”原创,如需转载,请与作者联系。否则将视为侵权行为,作者将追究其法律责任。
环境如下:其中最左边的ROUTER模拟PC,中间的ROUTER做代理服务器,最后一台做DHCP服务器
目标:PC上能自动获得IP地址
1,pc上的配置
en
conf t
host pc
inter f0/0
ip add dhcp ip地址为从DHCP获取
no shut
以下是show run看到的
pc#show run
Building configuration...
Current configuration : 887 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname pc
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
ip subnet-zero
no ip routing
!
!
no ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
ip address dhcp
no ip route-cache
duplex half
!
interface FastEthernet1/0
no ip address
no ip route-cache
shutdown
duplex auto
speed auto
!
interface FastEthernet1/1
no ip address
no ip route-cache
shutdown
duplex auto
speed auto
!
ip classless
no ip http server
!
!
!
!
!
!
!
!
gatekeeper
shutdown
!
!
line con 0
exec-timeout 0 0
logging synchronous
transport preferred all
transport output all
stopbits 1
line aux 0
transport preferred all
transport output all
stopbits 1
line vty 0 4
login
transport preferred all
transport input all
transport output all
!
!
end
2,router的配置
en
conf t
inter f0/0
ip add 1.1.1.1 255.255.255.0
no shut
ip helper-address 2.2.2.2 监听放F0/0上的udp广播,并转发到2.2.2.2上
inter f1/1
ip add 2.2.2.1 255.255.255.0
no shut
exit
router eigrp 1 做EIGRP路由,否则路由表为空,两边无法连通
network 1.1.1.0
network 2.2.2.0
no auto-su 关闭路由汇总
以下是show run看到的
show run
Building configuration...
Current configuration : 981 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname router
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
ip subnet-zero
!
!
ip cef
ip dhcp excluded-address 1.1.1.1 1.1.1.100
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
ip address 1.1.1.1 255.255.255.0
ip helper-address 2.2.2.2
duplex half
!
interface FastEthernet1/0
no ip address
shutdown
duplex auto
speed auto
!
interface FastEthernet1/1
ip address 2.2.2.1 255.255.255.0
duplex auto
speed auto
!
router eigrp 1
network 1.0.0.0
network 2.0.0.0
no auto-summary
!
ip classless
no ip http server
!
!
!
!
!
!
!
!
gatekeeper
shutdown
!
!
line con 0
exec-timeout 0 0
logging synchronous
transport preferred all
transport output all
stopbits 1
line aux 0
transport preferred all
transport output all
stopbits 1
line vty 0 4
login
transport preferred all
transport input all
transport output all
!
!
end
3,DHCP上的配置
en
conf t
host dhcp
router eigrp 1
net 2.2.2.0
no auto
exit
inter f1/1
ip add 2.2.2.2 255.255.255.0
no shut
exit
ip dhcp pool test 定义一个地址池叫test
network 1.1.1.0 /24 地址池的地址范围
domain-name test.com 属于test.com域
default-router 1.1.1.1 PC的网关是多少
dns-server 1.1.1.1 DNS服务器是哪儿
exit
ip dhcp excluded-address 1.1.1.1 1.1.1.20 指定不分配出去的IP地址
以下是show run看到的
dhcp#show run
Building configuration...
Current configuration : 1013 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname dhcp
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
ip subnet-zero
!
!
ip cef
ip dhcp excluded-address 1.1.1.1 1.1.1.20
!
ip dhcp pool test
network 1.1.1.0 255.255.255.0
default-router 1.1.1.1
dns-server 1.1.1.1
domain-name test.com
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
no ip address
shutdown
duplex half
!
interface FastEthernet1/0
no ip address
shutdown
duplex auto
speed auto
!
interface FastEthernet1/1
ip address 2.2.2.2 255.255.255.0
duplex auto
speed auto
!
router eigrp 1
network 2.0.0.0
no auto-summary
!
ip classless
no ip http server
!
!
!
!
!
!
!
!
gatekeeper
shutdown
!
!
line con 0
transport preferred all
transport output all
stopbits 1
line aux 0
transport preferred all
transport output all
stopbits 1
line vty 0 4
login
transport preferred all
transport input all
transport output all
!
!
end
验证结果
在PC上
pc#show ip inter f0/0
FastEthernet0/0 is up, line protocol is up
Internet address is 1.1.1.21/24
Broadcast address is 255.255.255.255
Address determined by DHCP
MTU is 1500 bytes
Helper address is not set
Directed broadcast forwarding is disabled
Outgoing access list is not set
Inbound access list is not set
Proxy ARP is enabled
Local Proxy ARP is disabled
Security level is default
Split horizon is enabled
ICMP redirects are always sent
ICMP unreachables are always sent
ICMP mask replies are never sent
IP fast switching is disabled
IP fast switching on the same interface is disabled
IP Flow switching is disabled
IP CEF switching is disabled
IP Null turbo vector
IP Null turbo vector
IP multicast fast switching is disabled
IP multicast distributed fast switching is disabled
IP route-cache flags are None
Router Discovery is disabled
IP output packet accounting is disabled
IP access violation accounting is disabled
TCP/IP header compression is disabled
RTP/IP header compression is disabled
Policy routing is disabled
Network address translation is disabled
WCCP Redirect outbound is disabled
WCCP Redirect inbound is disabled
WCCP Redirect exclude is disabled
BGP Policy Mapping is disabled
实验完成,打完收功!!
本文出自 “毛渊的窝” 博客,谢绝转载!