天坛校区教学和办公网络平台组建
– 有5个教室
– 1个办公区
– 1个服务器机房(教学服务器、DNS服务器)
组建教学及办公网络实现办公区域访问Internet,网络环境拓扑如图-1所示:
基于项目的需求,需要用到如下技术:
·VLAN:广播控制
·VLAN间通信:三层交换
·RIP路由协议:实现网络路径的自动学习
·ACL:定义允许访问Internet的vlan
·NAT:实现Internet的访问
现有网络连接说明如表-1所示:
实现此案例需要按照如下步骤进行。
步骤一:二层交换机创建vlan并把端口加入vlan
1)SW1创建vlan10将f0/1-f0/2接口加入vlan10
SW1(config)#vlan 10
SW1(config-vlan)#exit
SW1(config)#interface range f0/1 - 2
SW1(config-if-range)#switchport access vlan 10
SW1#show vlan
2)SW2创建vlan20将f0/1-f0/2接口加入vlan20
SW2(config)#vlan 20
SW2(config-vlan)#exit
SW2(config)#interface range f0/1 - 2
SW2(config-if-range)#switchport access vlan 20
SW2#show vlan
3)SW3创建vlan30将f0/1-f0/2接口加入vlan30
SW3(config)#vlan 30
SW3(config-vlan)#exit
SW3(config)#interface range f0/1 - 2
SW3(config-if-range)#switchport access vlan 30
SW3#show vlan
4)SW4创建vlan40将f0/1-f0/2接口加入vlan40
SW4(config)#vlan 40
SW4(config-vlan)#exit
SW4(config)#interface range f0/1 - 2
SW4(config-if-range)#switchport access vlan 40
SW4#show vlan
5)SW5创建vlan50将f0/1-f0/3接口加入vlan50
SW5(config)#vlan 50
SW5(config-vlan)#exit
SW5(config)#interface range f0/1 - 3
SW5(config-if-range)#switchport access vlan 50
SW5#show vlan
6)SW6端口默认vlan1
1)三层交换机创建vlan
Switch#configure terminal
MS1(config)#VLan 10
MS1(config-vlan)#VLan 20
MS1(config-vlan)#VLan 30
MS1(config-vlan)#VLan 40
MS1(config-vlan)#VLan 50
2)三层交换机开启路由功能
MS1(config)#ip routing //开启路由功能
3)三层交换配置vlan IP地址
MS1(config)#interface vlan 1
MS1(config-if)#ip address 192.168.1.254 255.255.255.0
MS1(config-if)#no shutdown
MS1(config)#interface vlan 10
MS1(config-if)#ip address 192.168.10.254 255.255.255.0
MS1(config-if)#no shutdown
MS1(config)#interface vlan 20
MS1(config-if)#ip address 192.168.20.254 255.255.255.0
MS1(config-if)#no shutdown
MS1(config)#interface vlan 30
MS1(config-if)#ip address 192.168.30.254 255.255.255.0
MS1(config-if)#no shutdown
MS1(config)#interface vlan 40
MS1(config-if)#ip address 192.168.40.254 255.255.255.0
MS1(config-if)#no shutdown
MS1(config)#interface vlan 50
MS1(config-if)#ip address 192.168.50.254 255.255.255.0
MS1(config-if)#no shutdown
4)配置三层交换机连接二层交换机的端口为trunk模式
MS1(config)#interface range f0/5 - 10
MS1(config-if-range)#switchport trunk encapsulation dot1q
MS1(config-if-range)#switchport mode trunk
1)配置二层交换机接口为trunk模式
SW1(config)#interface fastEthernet 0/5
SW1(config-if)#switchport mode trunk
SW2(config)#interface fastEthernet 0/5
SW2(config-if)#switchport mode trunk
SW3(config)#interface fastEthernet 0/5
SW3(config-if)#switchport mode trunk
SW4(config)#interface fastEthernet 0/5
SW4(config-if)#switchport mode trunk
SW5(config)#interface fastEthernet 0/5
SW5(config-if)#switchport mode trunk
SW6(config)#interface fastEthernet 0/5
SW6(config-if)#switchport mode trunk
MS1#configure terminal
MS1(config)#ip dhcp pool vlan10
MS1(dhcp-config)#network 192.168.10.0 255.255.255.0
MS1(dhcp-config)#default-router 192.168.10.254
MS1(dhcp-config)#dns-server 192.168.1.6
MS1(config)#ip dhcp pool vlan20
MS1(dhcp-config)#network 192.168.20.0 255.255.255.0
MS1(dhcp-config)#default-router 192.168.20.254
MS1(dhcp-config)#dns-server 192.168.1.6
MS1(config)#ip dhcp pool vlan30
MS1(dhcp-config)#network 192.168.30.0 255.255.255.0
MS1(dhcp-config)#default-router 192.168.30.254
MS1(dhcp-config)#dns-server 192.168.1.6
MS1(config)#ip dhcp pool vlan40
MS1(dhcp-config)#network 192.168.40.0 255.255.255.0
MS1(dhcp-config)#default-router 192.168.40.254
MS1(dhcp-config)#dns-server 192.168.1.6
MS1(config)#ip dhcp pool vlan50
MS1(dhcp-config)#network 192.168.50.0 255.255.255.0
MS1(dhcp-config)#default-router 192.168.50.254
MS1(dhcp-config)#dns-server 192.168.1.6
PC>ipconfig
FastEthernet0 Connection:(default port)
Link-local IPv6 Address…: FE80::260:2FFF:FEE3:C475
IP Address…: 192.168.10.1
Subnet Mask…: 255.255.255.0
Default Gateway…: 192.168.10.254
PC>ping 192.168.20.1
Pinging 192.168.20.1 with 32 bytes of data:
Reply from 192.168.20.1: bytes=32 time=0ms TTL=127
Reply from 192.168.20.1: bytes=32 time=0ms TTL=127
Reply from 192.168.20.1: bytes=32 time=0ms TTL=127
Reply from 192.168.20.1: bytes=32 time=0ms TTL=127
Ping statistics for 192.168.20.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
PC>ping 192.168.30.1
Pinging 192.168.30.1 with 32 bytes of data:
Reply from 192.168.30.1: bytes=32 time=0ms TTL=127
Reply from 192.168.30.1: bytes=32 time=0ms TTL=127
Reply from 192.168.30.1: bytes=32 time=0ms TTL=127
Reply from 192.168.30.1: bytes=32 time=0ms TTL=127
Ping statistics for 192.168.30.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
PC>ping 192.168.40.1
Pinging 192.168.40.1 with 32 bytes of data:
Reply from 192.168.40.1: bytes=32 time=0ms TTL=127
Reply from 192.168.40.1: bytes=32 time=0ms TTL=127
Reply from 192.168.40.1: bytes=32 time=1ms TTL=127
Reply from 192.168.40.1: bytes=32 time=0ms TTL=127
Ping statistics for 192.168.40.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms
PC>ping 192.168.50.1
Pinging 192.168.50.1 with 32 bytes of data:
Reply from 192.168.50.1: bytes=32 time=0ms TTL=127
Reply from 192.168.50.1: bytes=32 time=0ms TTL=127
Reply from 192.168.50.1: bytes=32 time=0ms TTL=127
Reply from 192.168.50.1: bytes=32 time=0ms TTL=127
Ping statistics for 192.168.50.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
PC>ping 192.168.60.1
Pinging 192.168.60.1 with 32 bytes of data:
Reply from 192.168.60.1: bytes=32 time=0ms TTL=255
Reply from 192.168.60.1: bytes=32 time=1ms TTL=255
Reply from 192.168.60.1: bytes=32 time=0ms TTL=255
Reply from 192.168.60.1: bytes=32 time=0ms TTL=255
Ping statistics for 192.168.60.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms
PC>
1)配置三层交换机连接路由的接口IP
MS1(config)#interface fastEthernet 0/11
MS1(config-if)#no switchport
MS1(config-if)#ip address 192.168.60.1 255.255.255.0
2)配置路由接口IP
R1(config)#interface fastEthernet 0/1
R1(config-if)#ip address 192.168.60.2 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip address 61.159.62.129 255.255.255.248
R1(config-if)#no shutdown
1)路由R1添加默认路由并配置RIPv2
R1(config)#ip route 0.0.0.0 0.0.0.0 f0/0
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#no auto-summary
R1(config-router)#network 192.168.6.0
R1(config-router)#default-information originate
2)三层交换配置RIPv2
MS1(config)#router rip
MS1(config-router)#version 2
MS1(config-router)#no auto-summary
MS1(config-router)#network 192.168.10.0
MS1(config-router)#network 192.168.20.0
MS1(config-router)#network 192.168.30.0
MS1(config-router)#network 192.168.40.0
MS1(config-router)#network 192.168.50.0
MS1(config-router)#network 192.168.60.0
MS1(config-router)#network 192.168.1.0
3)查看路由表
R1#show ip route //查看路由器路由表
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is 0.0.0.0 to network 0.0.0.0
61.0.0.0/29 is subnetted, 1 subnets
C 61.159.62.128 is directly connected, FastEthernet0/0
R 192.168.1.0/24 [120/1] via 192.168.60.1, 00:00:08, FastEthernet0/1
R 192.168.10.0/24 [120/1] via 192.168.60.1, 00:00:08, FastEthernet0/1
R 192.168.20.0/24 [120/1] via 192.168.60.1, 00:00:08, FastEthernet0/1
R 192.168.30.0/24 [120/1] via 192.168.60.1, 00:00:08, FastEthernet0/1
R 192.168.40.0/24 [120/1] via 192.168.60.1, 00:00:08, FastEthernet0/1
R 192.168.50.0/24 [120/1] via 192.168.60.1, 00:00:08, FastEthernet0/1
C 192.168.60.0/24 is directly connected, FastEthernet0/1
S* 0.0.0.0/0 is directly connected, FastEthernet0/0
MS1#show ip route //查看三层交换路由表
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is 192.168.60.2 to network 0.0.0.0
C 192.168.1.0/24 is directly connected, Vlan1
C 192.168.10.0/24 is directly connected, Vlan10
C 192.168.20.0/24 is directly connected, Vlan20
C 192.168.30.0/24 is directly connected, Vlan30
C 192.168.40.0/24 is directly connected, Vlan40
C 192.168.50.0/24 is directly connected, Vlan50
C 192.168.60.0/24 is directly connected, FastEthernet0/11
C 192.168.70.0/24 is directly connected, FastEthernet0/2
R* 0.0.0.0/0 [120/1] via 192.168.60.2, 00:00:15, FastEthernet0/11
1)配置SW7 IP地址模拟Internet
SW7#configure terminal
SW7(config)#interface vlan 1
SW7(config-if)#ip address 61.159.62.130 255.255.255.248
SW7(config-if)#no shutdown
2)R1配置NAT
R1(config)#ip access-list extended nsd
R1(config-ext-nacl)#permit ip 192.168.50.0 0.0.0.255 any
R1(config)#ip nat inside source list nsd interface fastEthernet 0/0 overload
R1(config)#interface fastEthernet 0/1
R1(config-if)#ip nat inside
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip nat outside
2)测试Internet访问
PC>ipconfig
FastEthernet0 Connection:(default port)
Link-local IPv6 Address…: FE80::203:E4FF:FEC5:6345
IP Address…: 192.168.50.1
Subnet Mask…: 255.255.255.0
Default Gateway…: 192.168.50.254
PC>ping 61.159.62.130
Pinging 61.159.62.130 with 32 bytes of data:
Reply from 61.159.62.130: bytes=32 time=0ms TTL=253
Reply from 61.159.62.130: bytes=32 time=0ms TTL=253
Reply from 61.159.62.130: bytes=32 time=0ms TTL=253
Reply from 61.159.62.130: bytes=32 time=0ms TTL=253
Ping statistics for 61.159.62.130:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms