思科的综合实战练习
需求
实现所有VLAN的PC都通过DHCP获取IP地址
实现所有的PC都可以互联互通
实现所有的PC都可以访问服务器0
拓扑图
配置思路
1)配置接入层交换机:创建vlan、接口加入vlan
2)配置核心交换机:配置vlan、trunk、接口IP、dhcp、路由
3)配置路由器:接口IP、路由
配置命令
第一步:配置接入层交换机(SW1/SW2/SW3)SW1(config)#vlan10SW1(config-vlan)#vlan20SW1(config-vlan)#vlan30SW1(config-vlan)#exitSW1(config)#interfacef0/1SW1(config-if)#switchportmodeaccessSW1(config-if)#switchportaccessvlan10SW2(config)#vlan10SW2(config-vlan)#vlan20SW2(config-vlan)#vlan30SW2(config-vlan)#exitSW2(config)#interfacef0/1SW2(config-if)#switchportmodeaccessSW2(config-if)#switchportaccessvlan20SW3(config)#vlan10SW3(config-vlan)#vlan20SW3(config-vlan)#vlan30SW3(config-vlan)#exitSW3(config)#interfacef0/1SW3(config-if)#switchportmodeaccessSW3(config-if)#switchportaccessvlan30第二步:配置核心交换机hx-1(config)#vlan10hx-1(config-vlan)#vlan20hx-1(config-vlan)#vlan30hx-1(config-vlan)#exithx-1(config)#ipdhcppoolvlan10hx-1(dhcp-config)#network192.168.10.0255.255.255.0hx-1(dhcp-config)#default-router192.168.10.254hx-1(dhcp-config)#dns-server8.8.8.8hx-1(dhcp-config)#ipdhcppoolvlan20hx-1(dhcp-config)#network192.168.20.0255.255.255.0hx-1(dhcp-config)#default-router192.168.20.254hx-1(dhcp-config)#dns-server8.8.8.8hx-1(dhcp-config)#ipdhcppoolvlan30hx-1(dhcp-config)#network192.168.30.0255.255.255.0hx-1(dhcp-config)#default-router192.168.30.254hx-1(dhcp-config)#dns-server8.8.8.8hx-1(dhcp-config)#exithx-1(config)#interfacerangeg1/0/1-3hx-1(config-if)#switchporttrunkencapsulationdot1qhx-1(config-if)#switchportmodetrunkhx-1(config-if)#interfaceg1/0/4hx-1(config-if)#noswitchporthx-1(config-if)#ipaddress192.168.40.1255.255.255.0hx-1(config-if)#interfacevlan10hx-1(config-if)#ipaddress192.168.10.254255.255.255.0hx-1(config-if)#interfacevlan20hx-1(config-if)#ipaddress192.168.20.254255.255.255.0hx-1(config-if)#interfacevlan30hx-1(config-if)#ipaddress192.168.30.254255.255.255.0hx-1(config-if)#exithx-1(config)#iproute192.168.50.0255.255.255.0192.168.40.2hx-1(config)#iprouting第三步:配置路由器R1(config)#interfaceg0/0R1(config-if)#ipaddress192.168.40.2255.255.255.0R1(config-if)#noshutdownR1(config-if)#interfaceg0/1R1(config-if)#ipaddress192.168.50.254255.255.255.0R1(config-if)#noshutdownR1(config-if)#exitR1(config)#iproute192.168.10.0255.255.255.0192.168.40.1R1(config)#iproute192.168.20.0255.255.255.0192.168.40.1R1(config)#iproute192.168.30.0255.255.255.0192.168.40.1第四步:验证结果:1)PC通过DHCP获取的IP地址2)不同VLAN内的PC都可以互访3)所有的PC都可以访问server0