一、实验拓扑
二、实验配置
1、DHCP自动获取IP
[r3]dhcp enable //先开启设备的dhcp服务
[r3]ip pool wangcai //创建名为wangcai的dhcp池塘
[r3-ip-pool-wangcai]network 192.168.1.160 mask 27 //绑定接口
[r3-ip-pool-wangcai]gateway-list 192.168.1.161 //该网段网关地址
[r3-ip-pool-wangcai]dns-list 114.114.114.114 //DNS服务器地址
[r3]interface Eth0/0/2
[r3-Ethernet0/0/2]dhcp select global //在路由器进行地址分配的接口上再单独开启dhcp服务
检测自动配置IP地址:
2、实现全网可达
缺省路由:
[r1]ip route-static 0.0.0.0 0 192.168.1.2
[r1]ip route-static 0.0.0.0 0 192.168.1.22
[r2]ip route-static 0.0.0.0 0 192.168.1.6
[r3]ip route-static 0.0.0.0 0 192.168.1.17
[r4]ip route-static 0.0.0.0 0 192.168.1.10
[r5]ip route-static 0.0.0.0 0 56.1.1.2
添加路由:
[r1]ip route-static 192.168.1.16 30 192.168.1.22
[r1]ip route-static 192.168.1.160 27 192.168.1.22
[r1]ip route-static 192.168.1.4 30 192.168.1.2
[r1]ip route-static 192.168.1.64 27 192.168.1.2
[r2]ip route-static 192.168.1.32 27 192.168.1.1
[r2]ip route-static 192.168.1.160 27 192.168.1.1
[r2]ip route-static 192.168.1.160 27 192.168.1.6
[r2]ip route-static 192.168.1.20 30 192.168.1.1
[r2]ip route-static 192.168.1.16 30 192.168.1.6
[r3]ip route-static 192.168.1.32 27 192.168.1.21
[r3]ip route-static 192.168.1.0 30 192.168.1.21
[r3]ip route-static 192.168.1.64 27 192.168.1.21
[r3]ip route-static 192.168.1.64 27 192.168.1.17
[r4]ip route-static 192.168.1.64 27 192.168.1.5
[r4]ip route-static 192.168.1.0 30 192.168.1.5
[r4]ip route-static 192.168.1.32 27 192.168.1.5
[r4]ip route-static 192.168.1.32 27 192.168.1.18
[r4]ip route-static 192.168.1.160 27 192.168.1.18
[r4]ip route-static 192.168.1.20 30 192.168.1.18
[r5]ip route-static 192.168.1.32 27 192.168.1.9
[r5]ip route-static 192.168.1.64 27 192.168.1.9
[r5]ip route-static 192.168.1.96 27 192.168.1.9
[r5]ip route-static 192.168.1.160 27 192.168.1.9
[r5]ip route-static 192.168.1.20 30 192.168.1.9
[r5]ip route-static 192.168.1.0 30 192.168.1.9
[r5]ip route-static 192.168.1.4 30 192.168.1.9
[r5]ip route-static 192.168.1.16 30 192.168.1.9
3、空接口防环
[r1]ip route-static 192.168.1.32 27 NULL 0
[r2]ip route-static 192.168.1.64 27 NULL 0
[r4]ip route-static 192.168.1.96 27 NULL 0
4、NAT实现内部对ISP访问
[r5]acl 2000
[r5-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r5-acl-basic-2000]q
[r5]int g0/0/1
[r5-GigabitEthernet0/0/1]nat outbound 2000
[r5-GigabitEthernet0/0/1]q
5、百兆路径备份
对百兆路径添加,并修改其优先级为61,当千兆路径不可用时百兆路径可以作为备用路径使用
[r4]ip route-static 0.0.0.0 0 192.168.1.10 preference 61
[r5]ip route-static 192.168.1.32 27 192.168.1.14 preference 61
[r5]ip route-static 192.168.1.64 27 192.168.1.14 preference 61
[r5]ip route-static 192.168.1.96 27 192.168.1.14 preference 61
[r5]ip route-static 192.168.1.160 27 192.168.1.14 preference 61
[r5]ip route-static 192.168.1.20 30 192.168.1.14 preference 61
[r5]ip route-static 192.168.1.0 30 192.168.1.14 preference 61
[r5]ip route-static 192.168.1.4 30 192.168.1.14 preference 61
[r5]ip route-static 192.168.1.16 30 192.168.1.14 preference 61
6、端口映射
在R1上配置:
[r1]aaa
[r1-aaa]local-user 123 privilege level 15 password cipher 123456Info: Add a new user.
[r1-aaa]local-user 123 service-type telnet
[r1]user-interface vty 0 4
[r1-ui-vty0-4]authentication-mode aaa
r5进行telent远程登录:
[r5]int g0/0/1
[r5-GigabitEthernet0/0/1]nat static protocol tcp global current-interface 23 i
nside 192.168.1.33 23
Are you sure to continue?[Y/N]:y
[r5-GigabitEthernet0/0/1]