实验拓扑及要求
实验思路
拓扑设计 -ip地址规划
VLAN 2 VLAM 3 分别使用地址172.16.2.0 24 和172.16.3.0 24
SW1与路由器的干路地址使用172.16.1.0 24
SW2与路由器的干路地址使用172.16.4.0 24
R1与R2干路使用12.0.0.0 24
R2 的环回地址为192.168.1.1 24
2、实施
3.环境部署一搭建拓扑一交换技术
4配置ip地址一所有节点ip
5路由----全网可达
6策略一规则优化安全
7测试
8排错
实验步骤
交换部分
Eth-trunk
SW1
interface GigabitEthernet0/0/4
eth-trunk 0
#
interface GigabitEthernet0/0/5
eth-trunk 0
#
SW2
interface GigabitEthernet0/0/4
eth-trunk 0
#
interface GigabitEthernet0/0/5
eth-trunk 0
#
创VLAN
例SW1
#
vlan batch 2 to 3 99
划分VLAN
例SW1
interface GigabitEthernet0/0/1
port link-type access
port default vlan 99
#
#
TRUNK干道
例SW1
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 3
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 3
#
SVI
SW1
#
interface Vlanif1
#
interface Vlanif2
ip address 172.16.2.1 255.255.255.0l
#
interface Vlanif3
ip address 172.16.3.1 255.255.255.0
#
interface Vlanif99
ip address 172.16.1.2 255.255.255.0
#
interface Eth-Trunk0
port link-type trunk
port trunk allow-pass vlan 2 to 3
#
SW2
#
interface Vlanif2
ip address 172.16.2.2 255.255.255.0
#
interface Vlanif3
ip address 172.16.3.2 255.255.255.0
#
interface Vlanif99
ip address 172.16.4.2 255.255.255.0
#
STP
SW1--SW2
#
stp region-configuration
region-name a
instance 1 vlan 2
instance 2 vlan 3
active region-configuration
#
stp instance 1 root primary
stp instance 2 root secondary
#
SW3--SW4
#
stp region-configuration
region-name a
instance 1 vlan 2
instance 2 vlan 3
active region-configuration
#
VRRP
SW1
interface Vlanif2
ip address 172.16.2.1 255.255.255.0
vrrp vrid 1 virtual-ip 172.16.2.254
vrrp vrid 1 priority 110
vrrp vrid 1 track interface GigabitEthernet0/0/1 reduced 15
dhcp select global
#
interface Vlanif3
ip address 172.16.3.1 255.255.255.0
vrrp vrid 2 virtual-ip 172.16.3.254
vrrp vrid 2 priority 110
vrrp vrid 2 track interface GigabitEthernet0/0/1
dhcp select global
#
SW2
interface Vlanif2
ip address 172.16.2.2 255.255.255.0
vrrp vrid 1 virtual-ip 172.16.2.254
vrrp vrid 1 track interface GigabitEthernet0/0/1
dhcp select global
#
interface Vlanif3
ip address 172.16.3.2 255.255.255.0
vrrp vrid 2 virtual-ip 172.16.3.254
vrrp vrid 2 track interface GigabitEthernet0/0/1
dhcp select global
#
DHCP
SW1
ip pool dh1
gateway-list 172.16.2.254
network 172.16.2.0 mask 255.255.255.0
dns-list 8.8.8.8
#
ip pool dhcp2
gateway-list 172.16.3.254
network 172.16.3.0 mask 255.255.255.0
dns-list 8.8.8.8
#
interface Vlanif2
dhcp select global
#
interface Vlanif3
dhcp select global
#
SW2
ip pool dh1
gateway-list 172.16.2.254
network 172.16.2.0 mask 255.255.255.0
dns-list 8.8.8.8
#
ip pool dhcp2
gateway-list 172.16.3.254
network 172.16.3.0 mask 255.255.255.0
dns-list 8.8.8.8
#
interface Vlanif2
dhcp select global
#
interface Vlanif3
dhcp select global
#
路由部分
配置IP地址
例R1
#
interface GigabitEthernet0/0/0
ip address 12.0.0.1 255.255.255.0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 192.168.1.1 255.255.255.0
#
OSPF以及静态配置
做两个区域的目的在于方便汇总
R2
#
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 172.16.1.0 0.0.0.255
network 172.16.4.0 0.0.0.255
#
ip route-static 0.0.0.0 0.0.0.0 12.0.0.1
ip route-static 172.16.2.0 255.255.255.0 NULL0
ip route-static 172.16.3.0 255.255.255.0 NULL0
#
SW1
#
ospf 1 router-id 2.2.2.2
silent-interface GigabitEthernet0/0/2
silent-interface GigabitEthernet0/0/3
silent-interface Vlanif3
area 0.0.0.0
network 172.16.1.0 0.0.0.255
area 0.0.0.1
network 172.16.2.0 0.0.0.255
network 172.16.3.0 0.0.0.255
#
ip route-static 0.0.0.0 0.0.0.0 172.16.1.1
#
SW2
#
ospf 1 router-id 3.3.3.3
silent-interface GigabitEthernet0/0/2
silent-interface GigabitEthernet0/0/3
silent-interface Vlanif3
area 0.0.0.1
network 172.16.2.0 0.0.0.255
network 172.16.3.0 0.0.0.255
#
ip route-static 0.0.0.0 0.0.0.0 172.16.4.1
#
测试
PC1pingR1的环回地址
优化
1.交换
PC与交换机连接的接口不选参与根节点的选举因此可以不用收取BPDU报文因此可以将这几个接口设置为edge-port类型
SW3
#
interface Ethernet0/0/3
port link-type access
port default vlan 2
stp edged-port enable
#
interface Ethernet0/0/4
port link-type access
port default vlan 3
stp edged-port enable
#
SW4
#
interface Ethernet0/0/3
port link-type access
port default vlan 2
stp edged-port enable
#
interface Ethernet0/0/4
port link-type access
port default vlan 3
stp edged-port enable
#
路由
由于svi接口时虚拟接口它发hello包时会每隔两秒给所有虚拟链路和trunk干道都发包,所以没用的可以做成沉默接口
SW1
#
ospf 1 router-id 2.2.2.2
silent-interface GigabitEthernet0/0/2
silent-interface GigabitEthernet0/0/3
silent-interface Vlanif3
SW2
#
ospf 1 router-id 3.3.3.3
silent-interface GigabitEthernet0/0/2
silent-interface GigabitEthernet0/0/3
silent-interface Vlanif3