目录
目录
说明:
一、运用多个路由器之实现组网完成通信
实验拓扑:
二、使用路由器的子接口完成园区的通信
实验拓扑:
实验配置:
ping通测试:
二、使用SVI技术的VLAN综合实验
实验拓扑:
实验配置:
查看电脑是否获取到DHCP地址:
进行ping通实验:
由于技术的进步,从一开始的VLAN应用到多个路由器设备的组网,到使用一个路由器实现子接口的设备,最后到下述使用二三层交换机完成一个园区的通信。
一、运用多个路由器之实现组网完成通信
使用路由器组网而练成的企业网,使用物理接口进行VLAN的管理,十分的消耗成本。
二、使用路由器的子接口完成园区的通信
AR1:
sysname r1
#
ip pool a #设置IP地址池
gateway-list 192.168.1.1
network 192.168.1.0 mask 255.255.255.0
#
ip pool b
gateway-list 192.168.2.1
network 192.168.2.0 mask 255.255.255.0
#
interface GigabitEthernet0/0/0
ip address 192.168.2.1 255.255.255.0
dhcp select global
#
interface GigabitEthernet0/0/0.1
dot1q termination vid 2 #进行vlan的选择。
ip address 192.168.1.1 255.255.255.0
arp broadcast enable #arp功能开启。
dhcp select global
SW1:
#
sysname sw1
#
vlan batch 2 to 6 #创建vlan
#
interface Ethernet0/0/1
port hybrid tagged vlan 2 #只标记vlan2,让vlan2的流量走子接口
port hybrid untagged vlan 3 to 6 #其余的vlan同vlan1走物理接口,实现vlan2和其他
vlan生成两个不同的网段
#
interface Ethernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 6
#
interface Ethernet0/0/3
port link-type access
port default vlan 2
#
interface Ethernet0/0/4
port hybrid pvid vlan 3 #PVID设置为3,到达路由器时会被打上vlan3的标签。
port hybrid untagged vlan 3 to 6
SW2:
#
sysname sw2
#
vlan batch 2 to 6
#
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 6
#
interface Ethernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 6
#
interface Ethernet0/0/3
port link-type access
port default vlan 2
#
interface Ethernet0/0/4
port hybrid pvid vlan 4
port hybrid untagged vlan 3 to 6
SW4:
#
sysname sw3
#
vlan batch 2 to 6
#
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 6
#
interface Ethernet0/0/2
port hybrid pvid vlan 5
port hybrid untagged vlan 3 to 6
#
interface Ethernet0/0/3
port hybrid pvid vlan 6
port hybrid untagged vlan 3 to 4 6
PC1 ping PC2(不同网段):
PC1 ping PC3(同一网段):
二、使用SVI技术的VLAN综合实验
实验原理:由于要实现园区之间的互相通信,三层架构可以分为核心层,汇聚层,接入层。
自我理解:
AR1:
[r1]
#
sysname r1
interface GigabitEthernet0/0/0
ip address 192.168.0.10 255.255.255.252
ospf network-type p2p #ospf使用p2p类型,加快收敛
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.0
#
ospf 1 router-id 10.10.10.10
area 0.0.0.0
network 1.1.1.1 0.0.0.0 #宣告
SW1:
#
sysname sw1
#
vlan batch 10 20 30 #创建VLAN
#
interface Vlanif10
ip address 192.168.0.2 255.255.255.252 #使用SVI技术,给所属的vlan进行地址划分
ospf network-type p2p #加快收敛
#
interface Vlanif20
ip address 192.168.0.6 255.255.255.252
ospf network-type p2p
#
interface Vlanif30
ip address 192.168.0.9 255.255.255.252
ospf network-type p2p
#
interface GigabitEthernet0/0/1
port link-type access #由于该地址是连接路由器,是要进行园区外的通信
故使用access接口即可到达要求port default port default vlan 30
#
interface GigabitEthernet0/0/2
port link-type trunk #使用trunk可以有效的实现后续新增实验要求。
undo port trunk allow-pass vlan 1 #不进行该操作,可能会导致VLAN1通信成环路。
port trunk allow-pass vlan 10
#
interface GigabitEthernet0/0/3
port link-type trunk
undo port trunk allow-pass vlan 1
#
ospf 1 router-id 1.1.1.1 #进行OSPF的配置
area 0.0.0.0
network 192.168.0.8 0.0.0.3
area 0.0.0.1
network 192.168.0.0 0.0.0.3
stub no-summary #将区域设置为末梢区域和完全末梢区域,减少拓
扑更新量。
area 0.0.0.2
network 192.168.0.4 0.0.0.3
stub no-summary
SW2:
#
sysname sw2
#
vlan batch 10 200 300 400
#
interface Vlanif10
ip address 192.168.0.1 255.255.255.252
ospf network-type p2p #使用DHCP的接口模式进行dhcp分配地址
#
interface Vlanif200
ip address 192.168.20.1 255.255.255.0
dhcp select interface
#
interface Vlanif300
ip address 192.168.30.1 255.255.255.0
dhcp select interface
#
interface Vlanif400
ip address 192.168.40.1 255.255.255.0
dhcp select interface
#
interface GigabitEthernet0/0/1
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 10
#
interface GigabitEthernet0/0/2
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 200
#
interface GigabitEthernet0/0/3
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 300 400
#
ospf 1 router-id 2.2.2.2
area 0.0.0.1
network 192.168.20.0 0.0.0.255
network 192.168.30.0 0.0.0.255
network 192.168.40.0 0.0.0.255
network 192.168.0.0 0.0.0.3
stub
SW3:
SW3:
#
sysname sw3
#
vlan batch 20 500 600 700
#
interface Vlanif20
ip address 192.168.0.5 255.255.255.252
ospf network-type p2p
#
interface Vlanif500
ip address 192.168.50.1 255.255.255.0
dhcp select interface
#
interface Vlanif600
ip address 192.168.60.1 255.255.255.0
dhcp select interface
#
interface Vlanif700
ip address 192.168.70.1 255.255.255.0
dhcp select interface
#
interface GigabitEthernet0/0/1
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 20
#
interface GigabitEthernet0/0/2
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 500 600
#
interface GigabitEthernet0/0/3
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 700
#
ospf 1 router-id 3.3.3.3
area 0.0.0.2
network 192.168.50.0 0.0.0.255
network 192.168.60.0 0.0.0.255
network 192.168.70.0 0.0.0.255
network 192.168.0.4 0.0.0.3
stub
SW4:
sysname sw4
#
vlan batch 200
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 200
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 200
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 200
SW5:
#
sysname sw5
#
vlan batch 300 400
#
interface GigabitEthernet0/0/1
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 300 400
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 300
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 400
SW6:
#
sysname sw6
#
vlan batch 500 600
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 500 600
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 500
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 600
SW7:
#
sysname sw7
#
vlan batch 700
#
interface GigabitEthernet0/0/1
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 700
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 700
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 700
PC1:
PC5:
1、ping PC7 ,实现汇聚层之间的通信。
2、ping PC1,实现园区之间的通信。
3、ping AR1的环回:,实现园区外的通信。
至此,通过二三层交换机完成企业内网的实验已结束。