
实验环境:
操作系统:Mac OS X 10.11.5 beta 3(当时最新测试版),模拟器:GNS3 IOU for Mac 1.4.6(当时最新版本)
注:当然,只要有思科模拟器都可以做这个实验
实验需求:
- PC1/2/3/4 根据拓扑能获取到相应 IP 网段的 IP 地址,VLAN 10 和 VLAN 20 的 DHCP Server 在 L3SW 上;
- printer 是 IP 打印机,需要固定的 IP 地址 192.168.3.100/24,同时 VLAN 30 的 DHCP Server 在 GW 上(而不是 L3SW 上);
- PC1/2/3/4 能访问互联网 8.8.8.8/32。
实验配置命令:
PC1/2/3/4/Printer:
conf t int e 0/0 |
Internet:
conf t int e 0/0 int l 0 |
L2SW1:
conf t ! 模拟二层交换机,关闭路由功能 ! 配置 port-channel ! 配置 VTP ! 划分 VLAN interface Ethernet0/1 |
L2SW2:
conf t ! 模拟二层交换机,关闭路由功能 ! 配置 port-channel ! 配置 VTP ! 划分 VLAN interface Ethernet0/1 interface Ethernet0/2 |
L3SW:
conf t ! 配置 port-channel int r e 3/0-1 ! 配置 VTP ! 配置 VLAN ! 配置 SVI 接口 int vlan 20 int vlan 30 ! 配置 VLAN 10 和 VLAN 20 的 DHCP 服务器 ip dhcp pool VLAN20 int e 0/1 ! 与 GW 运行 OSPF |
GW:
conf t int e 0/1 int e 0/0 ! 配置默认路由指向 Internet ! 与 L3SW 运行 OSPF ! 配置 PAT ip nat inside source list 1 interface e 0/0 overload int e 0/0 int e 0/1 ! 配置 VLAN 30 的 DHCP 服务器 |
client-identifier 需要你自己获取了。如果不知道怎么获取,可以先配置成:
ip dhcp pool VLAN30 network 192.168.3.0 255.255.255.0 default-router 192.168.3.254
等 printer 获取到 IP 地址后,再在 GW 上 show ip dhcp binding 就可以查看 printer 的 Client-ID,然后再配置成 host 192.168.3.100 255.255.255.0,client-identifier xxx…x 这样的形式。
测试:
VLAN 内 Ping 通测试(PC3 是 192.168.1.x 网段的):
PC3#p 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/2 ms
VLAN 间 Ping 通测试(PC2 是 192.168.2.x 网段的):
PC2#p 192.168.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/5/7 ms
互联网访问测试:
PC1/2/3/4#p 8.8.8.8
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms
这里可以查看 printer 的 Client-ID:
GW#sh ip dhcp binding Bindings from all pools not associated with VRF: IP address Client-ID/ Lease expiration Type Hardware address/ User name 192.168.3.100 0063.6973.636f.2d61. Infinite Manual 6162.622e.6363.3030. 2e30.6130.302d.4574. 302f.30
本文完。如有疑问,欢迎在下方留言;如本文有什么错误,欢迎在下方留言指正,谢谢。
router ospf 1,我二层交换机配不了这条命令,我应该下载哪个 IOU 呢?
二层交换机怎么能配三层路由协议呢?配不了的,三层交换机和路由器才行。IOU 的话,路由器的 IOU 和三层交换机的 IOU 都可以配置 OSPF。