实战企业网络搭建:拓扑设计与设备配置完全攻略
创作时间:
2025-01-22 03:59:38
作者:
@小白创作中心
实战企业网络搭建:拓扑设计与设备配置完全攻略
企业网络的搭建是一个复杂但至关重要的过程,涉及到交换、路由和访问控制等多个方面的配置。本文将通过一个具体的实验案例,详细讲解企业网络从零到一的搭建过程,包括拓扑设计、设备配置和功能实现等关键步骤。无论是网络工程领域的从业者还是学习者,都能从中学到实用的网络配置知识。
实验拓扑
拓扑需求
交换部分:
- 将SW1-SW2间的e0/0/5、e0/0/6配置为手工方式的eth-trunk,链路编号为eth-trunk 12
- 将SW1、SW2、SW3、SW4间的所有链路配置为trunk
- 在SW1、SW2、SW3、SW4上创建vlan10、vlan20、vlan11、vlan12
- 在SW1、SW2、SW3、SW4上开启STP协议
- 将SW1设置为所有VLAN的根交换机,将SW2设置为所有VLAN的备份根交换机
- 将PC3、PC4划入vlan10、将PC7、PC8划入vlan20
路由部分:
- IP地址规划如下:
- vlan10 ----------- 10.1.10.0/24
- vlan20 ----------- 10.1.20.0/24
- vlan11 ----------- 10.1.11.0/24
- vlan12 ----------- 10.1.12.0/24
- R1-R2 ------------ 12.1.1.0/24
- R2-Client2 ------------ 20.1.1.0/24
- 将SW1设置为vlan10、vlan20的网关,IP地址为vlan对应网段的最后一个可用IP
- 将SW2设置为vlan10、vlan20的备份网关,IP地址为vlan对应网段的倒数第二个可用IP
- 将SW1的e0/0/1接口划入vlan11,并为vlan11配置对应网段的第一个可用IP
- 将SW2的e0/0/1接口划入vlan12,并为vlan12配置对应网段的第一个可用IP
- 将R1的g0/0/0接口IP配置为10.1.11.0/24网段的最后一个可用IP
- 将R1的g0/0/1接口IP配置为10.1.12.0/24网段的最后一个可用IP
- 配置R1-R2相连接口的IP地址,R1配置网段第一个可用IP,R2配置网段第二个可用IP
- 配置R2-Client2相连接口的IP地址,Client2配置网段第一个可用IP,R2配置网段最后一个可用IP
- 在SW1、SW2、R1间运行OSPF 100,将vlan10、vlan20、vlan11、vlan12对应网段宣告进area0
- 在R1上添加缺省静态路由,将下一跳指向R2
- 在R1上将缺省静态路由发布进OSPF 100
- 在R1-R2间运行OSPF 200,将R1-R2间网段以及R2-Client2间网段宣告进area0
访问控制部分:
- 在R1上配置PAT,让vlan10、vlan20内的所有主机共用12.1.1.10/24这个IP访问Client2
- 要求vlan10内的主机可以访问Client2的web服务,但不能访问Client2的ftp服务;vlan20内的主机可以访问Client2的ftp服务,但不能访问Client2的web服务;其余流量不做限制
操作步骤
SW1配置
vlan batch 10 to 12 20
stp mode stp
stp instance 0 priority 0
interface Vlanif10
ip address 10.1.10.254 255.255.255.0
#
interface Vlanif11
ip address 10.1.11.1 255.255.255.0
#
interface Vlanif20
ip address 10.1.20.254 255.255.255.0
interface Eth-Trunk12
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/1
port link-type access
port default vlan 11
interface Ethernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/4
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/5
eth-trunk 12
#
interface Ethernet0/0/6
eth-trunk 12
ospf 100 router-id 1.1.1.1
area 0.0.0.0
network 10.1.10.0 0.0.0.255
network 10.1.20.0 0.0.0.255
network 10.1.11.0 0.0.0.255
#
SW2配置
vlan batch 10 to 12 20stp mode stp
stp instance 0 priority 4096
interface Vlanif10
ip address 10.1.10.253 255.255.255.0
#
interface Vlanif12
ip address 10.1.12.1 255.255.255.0
#
interface Vlanif20
ip address 10.1.20.253 255.255.255.0
interface Eth-Trunk12
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/1
port link-type access
port default vlan 12
interface Ethernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/4
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/5
eth-trunk 12
#
interface Ethernet0/0/6
eth-trunk 12
ospf 100 router-id 2.2.2.2
area 0.0.0.0
network 10.1.10.0 0.0.0.255
network 10.1.20.0 0.0.0.255
network 10.1.12.0 0.0.0.255
SW3配置
vlan batch 10 to 12 20
stp mode stp
interface Ethernet0/0/1
port link-type access
port default vlan 10
interface Ethernet0/0/2
port link-type access
port default vlan 20
interface Ethernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
interface Ethernet0/0/4
port link-type trunk port
trunk allow-pass vlan 2 to 4094
SW4配置
vlan batch 10 to 12 20
stp mode stp
interface Ethernet0/0/1
port link-type access
port default vlan 10
interface Ethernet0/0/2
port link-type access
port default vlan 20
interface Ethernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
interface Ethernet0/0/4
port link-type trunk
port trunk allow-pass vlan 2 to 4094
AR1配置
acl number 2000
rule 5 permit source 10.1.10.0 0.0.0.255
rule 10 permit source 10.1.20.0 0.0.0.255
#
acl number 3000
rule 5 permit tcp source 10.1.10.0 0.0.0.255 destination 20.1.1.1 0 destination
-port eq www
rule 10 deny tcp source 10.1.10.0 0.0.0.255 destination 20.1.1.1 0 destination-
port eq ftp
rule 15 permit tcp source 10.1.20.0 0.0.0.255 destination 20.1.1.1 0 destinatio
n-port eq ftp
rule 20 deny tcp source 10.1.20.0 0.0.0.255 destination 20.1.1.1 0 destination-
port eq www
nat address-group 0 12.1.1.10 12.1.1.10
#
interface GigabitEthernet0/0/0
ip address 10.1.11.254 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.12.254 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 12.1.1.1 255.255.255.0
traffic-filter outbound acl 3000
nat outbound 2000 address-group 0
ospf 100 router-id 3.3.3.3
default-route-advertise
area 0.0.0.0
network 10.1.11.0 0.0.0.255
network 10.1.12.0 0.0.0.255
#
ospf 200 router-id 3.3.3.3
area 0.0.0.0
network 12.1.1.0 0.0.0.255
#
ip route-static 0.0.0.0 0.0.0.0 12.1.1.2
AR2配置
interface GigabitEthernet0/0/0
ip address 20.1.1.254 255.255.255.0
interface GigabitEthernet0/0/2
ip address 12.1.1.2 255.255.255.0
ospf 200 router-id 5.5.5.5
area 0.0.0.0
network 12.1.1.0 0.0.0.255
network 20.1.1.0 0.0.0.255
热门推荐
许三多的成长之路:从“孬兵”到《士兵突击》中的“兵王”
世卫组织:手机辐射与脑癌风险无关联
Windows 10下Miracast无线投屏使用教程及异常解决方案
从枸杞到鲑鱼:5种护眼食物及食用注意事项
干眼症治疗有讲究:脉冲光快速缓解,热脉动直击根源
2024“爱眼日”:从生活习惯到饮食,全方位护眼指南
红龙鱼灯色温攻略:从幼鱼到成鱼的最佳选择
红龙鱼灯光大战:暖黄光 vs 白光
5000至6500K色温:养鱼人的秘密武器
从淬体到天人合一:古武修炼的十二级进阶之路
古武修炼十二阶:从入门到武道巅峰的完整体系
从天文历法到中医理论:阴阳五行说的演变历程
三国演义中的权谋较量:谁是真正的幕后高手?
《水浒传》的叙事艺术:章回体结构与人物塑造的巅峰之作
《红楼梦》与《西游记》:两部经典中的哲学智慧
有情调的恋爱:用仪式感和细节打动心上人
AI邂逅首饰设计创新,大咖共探珠宝新篇章
打造专属咖啡时光:从选豆到社交的全方位指南
楠溪江:狮子戏球、百米飞瀑、金色梯田,浙南山水画卷
浙江楠溪江:晒秋活动带动乡村旅游发展
温州楠溪江必打卡三景:悬崖栈道、神秘洞穴与原始森林
南通至张家界袁家界团体旅游路线指南
现代简约风格:打造高颜值家居
安藤忠雄&王澍:现代建筑的极简之美
白色+胡桃木:打造现代简约客厅的完美配色方案
现代简约风vs北欧风格:卧室装修如何选择?
白色与胡桃木色:打造简约大气家居的新选择
紫草油:治疗烧烫伤的中药良方,兼具六效功能
复方紫草油功效全解析:从清热解毒到伤口愈合
新样本量计算方法问世,可减少38.2%临床研究资源浪费