交换机实验

这篇配置描述了一个网络环境,其中路由器R1和R2使用OSPF进行路由,并通过VRRP在SW1和SW2上实现冗余。SW1和SW2配置了VLAN、STP和DHCP服务器,为PC设备提供IP地址。SW3和SW4作为接入交换机连接PC,确保网络连通性。PC1能ping通PC3和PC4,但未提及PC4之间的通信情况。
摘要由CSDN通过智能技术生成

1.要求

(1)内网IP地址172.16.0.0/16合理分配                                                                                       (2)SW1/2之间互为备份                                                                                                                  (3)VRRP/STP/VLAN/TRUNK均使用                                                                                            (4)所有pc通过DHCP获取IP地址                                                                                              

2.拓扑图

 

3.配置:

R1

acl number 2000  

 rule 1 permit source 172.16.0.0 0.0.255.255

interface GigabitEthernet0/0/0

 ip address 172.16.0.2 255.255.255.252

interface GigabitEthernet0/0/1

 ip address 172.16.0.6 255.255.255.252

interface GigabitEthernet0/0/2

 ip address 12.1.1.1 255.255.255.0

 nat outbound 2000

ospf 1 router-id 1.1.1.1

 default-route-advertise always

 area 0.0.0.0

  network 172.16.0.0 0.0.255.255                                         

ip route-static 0.0.0.0 0.0.0.0 12.1.1.2

R2

interface GigabitEthernet0/0/0

 ip address 12.1.1.2 255.255.255.0

interface LoopBack0

 ip address 2.2.2.2 255.255.255.0

SW1

sysname sw1

vlan batch 2 100

stp instance 1 root primary

stp instance 2 root secondary

cluster enable

ntdp enable

ndp enable

stp region-configuration

 region-name a

 instance 1 vlan 1

 instance 2 vlan 2

 active region-configuration              

ip pool vlan1

 gateway-list 172.16.1.126

 network 172.16.1.0 mask 255.255.255.128

 dns-list 114.114.114.114 8.8.8.8

ip pool vlan2

 gateway-list 172.16.1.254

 network 172.16.1.128 mask 255.255.255.128

 dns-list 114.114.114.114 8.8.8.8

interface Vlanif1

 ip address 172.16.1.1 255.255.255.128    

 vrrp vrid 1 virtual-ip 172.16.1.126

 vrrp vrid 1 priority 101

 vrrp vrid 1 track interface GigabitEthernet0/0/1 reduced 2

 dhcp select global

interface Vlanif2

 ip address 172.16.1.129 255.255.255.128

 vrrp vrid 1 virtual-ip 172.16.1.254

 dhcp select global

interface Vlanif100

 ip address 172.16.0.1 255.255.255.252

interface MEth0/0/1

interface Eth-Trunk0

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

interface GigabitEthernet0/0/1

 port link-type access

 port default vlan 100

 stp edged-port enable                                        

interface GigabitEthernet0/0/2

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

interface GigabitEthernet0/0/3

 eth-trunk 0

interface GigabitEthernet0/0/4

 eth-trunk 0

interface GigabitEthernet0/0/5

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

ospf 1 router-id 2.2.2.2

 silent-interface all

 undo silent-interface GigabitEthernet0/0/1

 undo silent-interface Vlanif100

 undo silent-interface Vlanif1

 undo silent-interface Eth-Trunk0

 area 0.0.0.0

  network 172.16.0.1 0.0.0.0

 area 0.0.0.1

  abr-summary 172.16.1.0 255.255.255.0

  network 172.16.1.0 0.0.0.255

SW2

vlan batch 2 100

stp instance 1 root secondary

stp instance 2 root primary

cluster enable

ntdp enable

ndp enable

ip pool vlan1

 gateway-list 172.16.1.126

 network 172.16.1.0 mask 255.255.255.128

 dns-list 114.114.114.114 8.8.8.8

ip pool vlan2

 gateway-list 172.16.1.254

 network 172.16.1.128 mask 255.255.255.128

 dns-list 114.114.114.114 8.8.8.8

interface Vlanif1

 ip address 172.16.1.2 255.255.255.128    

 vrrp vrid 1 virtual-ip 172.16.1.126

 dhcp select global

interface Vlanif2

 ip address 172.16.1.130 255.255.255.128

 vrrp vrid 1 virtual-ip 172.16.1.254

 vrrp vrid 1 priority 101

 vrrp vrid 1 track interface GigabitEthernet0/0/1 reduced 2

 dhcp select global

interface Vlanif100

 ip address 172.16.0.5 255.255.255.252

interface Eth-Trunk0

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

interface GigabitEthernet0/0/1

 port link-type access

 port default vlan 100

 stp edged-port enable                                      

interface GigabitEthernet0/0/2

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

interface GigabitEthernet0/0/3

 eth-trunk 0

interface GigabitEthernet0/0/4

 eth-trunk 0

interface GigabitEthernet0/0/5

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

ospf 1 router-id 3.3.3.3

 silent-interface all

 undo silent-interface GigabitEthernet0/0/1

 undo silent-interface Vlanif100

 undo silent-interface Eth-Trunk0

 undo silent-interface Vlanif1

 area 0.0.0.0

  network 172.16.0.5 0.0.0.0

 area 0.0.0.1

  abr-summary 172.16.1.0 255.255.255.0

  network 172.16.1.0 0.0.0.255

user-interface con 0

user-interface vty 0 4

SW3

drop illegal-mac alarm

stp region-configuration

 region-name a

 instance 1 vlan 1

 instance 2 vlan 2

 active region-configuration

interface Vlanif1

interface Ethernet0/0/3

 stp edged-port enable

interface Ethernet0/0/4

 port link-type access

 port default vlan 2

 stp edged-port enable

interface GigabitEthernet0/0/1

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

interface GigabitEthernet0/0/2

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

SW4

vlan batch 2

stp region-configuration

 region-name a

 instance 1 vlan 1

 instance 2 vlan 2

 active region-configuration

interface Vlanif1

interface Ethernet0/0/3

 stp edged-port enable

interface Ethernet0/0/4

 port link-type access

 port default vlan 2

 stp edged-port enable

interface GigabitEthernet0/0/1

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

interface GigabitEthernet0/0/2

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

 

 

pc1 ping pc3和pc4的结果

 pc4 ping pc4的结果

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

殇ベ生

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值