路由交换-实训
当前进度 1.22
更好的阅读和更新地址: https://blog.dayi.ink/?p=59
更好的阅读和更新地址: https://type.dayiyi.top/index.php/archives/189/
非常感谢一些小伙伴的帮助哦
【dayi的大键盘】新的博客:https://blog.dayi.ink ,欢迎来体验新的阅读。
更新中修改的内容
2023年6月25日17:32:08 在0x30中提示 0x48 中Area2的stub模式的配置,0x22 中Core的交换机配置和截图有所偏差,已经添加正确的
2023年6月25日17:59:01 0x21 修复截图
2023年6月25日18:13:18 0x31 小修
2023年6月25日20:40:00 !!!!如果你发现配完单臂路由之后不通,请使用这个方法:在Core交换机上config模式下输入
Core(config)#vlan 10
,然后再输入
Core(config)#vlan 20
即可。估计是,在火车上,文件估计是没提交成功到服务器,现在已经修改。
原因应该是:转发VLAN的交换机必须要有全部的VLAN表,实际上可以通过交换机配置VLAN表服务器同步来解决,但是因为就3个交换机,每个都手动配,也挺简单滴。已经在0x22修复。交换机是通过Allowed VLAN List来控制是否允许某个VLAN的报文通过TRUNK端口,只有VLAN在List里,才允许通过TRUNK端口。
2023年6月25日20:58:44: 1.21 : 小修
2023年6月25日20:40:00 0x22 ver:1.20 update:
0x00 准备文件
0x01 需求
需求:
1、按图搭建实验环境,并配置IP地址
交换部分:
2、分支1内部有两个部门,ylan10是技术部,vlan20是研发部。配置相应的vlan。
3、两个vlan的网关都在路由器RO上,用单臂路由技术实现。
4、交换机之间及Core到RO之间需要配置trunk,且出于安全考虑只允许vlan10和20通过。
5、S1作为vlan10的STP的根桥,S2作为VLAN20的STP根桥。
路由部分:
6、互联网区使用OSPF协议。R1/2/3作为area0区,R2/3/4作为Area1区,R3/5作为Area2区
7、RO和R6作为企业边界设备,为了上网需要配置默认路由。
其它部分:
8、公网DNS服务器为分支1提供DNS解析服务。
9、分支2的web服务器为分支一提供web访问服务。
10、分支一需要配置端口地址转换(PNAT)实现内部主机上网。但是为了避免代码泄露,研发部门不允许上网。
11、分之二需要配置端口映射(DNAT),提供对外的web服务。域名www.自己的名字拼音.com。
0x02 打开文件
- 打开文件就可以啦PVP。
- 就是那个综合实践PKT文件。
0x10 配置IP 按图搭建实验环境,并配置IP地址
DNS 200.1.1.233/24
网关:200.1.1.1
PC0 192.168.1.233/24
网关192.168.1.1
DNS:200.1.1.233
PC1 192.168.2.233/24
网关192.168.2.1
DNS:200.1.1.233
WEB
172.16.1.233/24(255.255.255.0)网关:172.16.1.1
DNS:200.1.1.233
0x20 交换部分
交换部分:
2、分支1内部有两个部门,ylan10是技术部,vlan20是研发部。配置相应的vlan。
3、两个vlan的网关都在路由器RO上,用单臂路由技术实现。
4、交换机之间及Core到RO之间需要配置trunk,且出于安全考虑只允许vlan10和20通过。
5、S1作为vlan10的STP的根桥,S2作为VLAN20的STP根桥。
0x21 划分VLAN
分支1内部有两个部门,ylan10是技术部,vlan20是研发部。配置相应的vlan。
把两个交换机划分两个VLAN下。
交换机S1_VLAN10:192.168.1.11
交换机S1_VLAN20: 192.168.2.11
交换机S2_VLAN10: 192.168.1.12
交换机S2_VLAN20: 192.168.2.12
交换机Core_VLAN10: 192.168.1.13
交换机Core_VLAN20: 192.168.2.13
S1交换机部分
Switch>en Switch#conf t Switch(config)#vlan 10 Switch(config-vlan)#name tech_dep Switch(config-vlan)#int vlan10 Switch(config-if)#ip addr 192.168.1.11 255.255.255.0 Switch(config-if)#no shut Switch(config-if)#int f0/3 Switch(config-if)#switchport mode access Switch(config-if)#switchport access vlan 10 Switch(config-if)#hostname S1 S1(config)#vlan 20 S1(config-vlan)#name research_dep S1(config-vlan)#int vlan 20 S1(config-if)#ip addr 192.168.2.11 255.255.255.0 S1(config-if)#no shut # 才学的新命令 S1(config-if)#do show vlan brief VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Fa0/1, Fa0/2, Fa0/4, Fa0/5 Fa0/6, Fa0/7, Fa0/8, Fa0/9 Fa0/10, Fa0/11, Fa0/12, Fa0/13 Fa0/14, Fa0/15, Fa0/16, Fa0/17 Fa0/18, Fa0/19, Fa0/20, Fa0/21 Fa0/22, Fa0/23, Fa0/24, Gig0/1 Gig0/2 10 tech_dep active Fa0/3 20 research_dep active 1002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active
S2 交换机部分
Switch>en Switch#conf t Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#vlan 10 Switch(config-vlan)#name tech_dep Switch(config-vlan)#vlan 20 Switch(config-vlan)#name research_dep Switch(config-vlan)#hostname S2 S2(config)#int vlan10 S2(config-if)#ip addr 192.168.1.12 255.255.255.0 S2(config-if)#no shut S2(config-if)#int vlan20 S2(config-if)#ip addr 192.168.2.12 255.255.255.0 S2(config-if)#no shut S2(config-if)#int f0/3 S2(config-if)#switchport mode access S2(config-if)#switchport access vlan 20 S2(config)#do show vlan brief VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Fa0/4, Fa0/5, Fa0/6, Fa0/7 Fa0/8, Fa0/9, Fa0/10, Fa0/11 Fa0/12, Fa0/13, Fa0/14, Fa0/15 Fa0/16, Fa0/17, Fa0/18, Fa0/19 Fa0/20, Fa0/21, Fa0/22, Fa0/23 Fa0/24, Gig0/1, Gig0/2 10 tech_dep active 20 research_dep active Fa0/3 1002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active S2(config)#
对于
show vlan brief
看下面这个图啦,下面的图是正确的
0x22 配置Trunk
S1
S1#conf t Switch(config)#vlan 10 Switch(config-vlan)#name tech_dep Switch(config-vlan)#vlan 20 Switch(config-vlan)#name research_dep S1(config)#int f0/1 S1(config-if)#switchport mode trunk S1(config-if)#switchport trunk allowed vlan 10,20 S1(config-if)#int f0/2 S1(config-if)#switchport mode trunk S1(config-if)#switchport trunk allowed vlan 10,20 S1(config-if)#do show int trunk Port Mode Encapsulation Status Native vlan Fa0/1 on 802.1q trunking 1 Fa0/2 on 802.1q trunking 1 Port Vlans allowed on trunk Fa0/1 10,20 Fa0/2 10,20 Port Vlans allowed and active in management domain Fa0/1 10,20 Fa0/2 10,20 Port Vlans in spanning tree forwarding state and not pruned Fa0/1 10,20 Fa0/2 none Switch(config-vlan)#hostname Core
S2 同理
S2(config-if)#int f0/1 S2(config-if)#switchport mode trunk S2(config-if)#switchport trunk allowed vlan 10,20 S2(config-if)#int f0/2 S2(config-if)#switchport mode trunk S2(config-if)#switchport trunk allowed vlan 10,20 S2(config-if)#do show int trunk Port Mode Encapsulation Status Native vlan Fa0/1 on 802.1q trunking 1 Fa0/2 on 802.1q trunking 1 Port Vlans allowed on trunk Fa0/1 10,20 Fa0/2 10,20 Port Vlans allowed and active in management domain Fa0/1 10,20 Fa0/2 10,20 Port Vlans in spanning tree forwarding state and not pruned Fa0/1 10,20 Fa0/2 20
Core
no Switch>en Switch#conf t Switch(config)#int f0/1 Switch(config-if)#switchport mode trunk Command rejected: An interface whose trunk encapsulation is "Auto" can not be configured to "trunk" mode. Switch(config-if)#switchport trunk encapsulation dot1q Switch(config-if)#switchport mode trunk Switch(config-if)#switchport trunk allowed vlan 10,20 Switch(config-if)#int f0/2 Switch(config-if)#switchport trunk encapsulation dot1q Switch(config-if)#switchport mode trunk Switch(config-if)#switchport trunk allowed vlan 10,20 Switch(config-if)#int f0/3 Switch(config-if)#switchport trunk encapsulation dot1q Switch(config-if)#switchport mode trunk Switch(config-if)#switchport trunk allowed vlan 10,20 Switch(config)#int vlan10 Switch(config-if)#ip addr 192.168.1.13 255.255.255.0 Switch(config-if)#no shut Switch(config-if)#int vlan20 Switch(config-if)#ip addr 192.168.2.13 255.255.255.0 Switch(config-if)#no shut <---添加的内容---> Switch(config-if)#vlan 10 Switch(config-vlan)#vlan 20 Switch(config-vlan)#ex <---添加的内容---> Switch(config-if)#do show int trunk Core#show int trunk Port Mode Encapsulation Status Native vlan Fa0/1 on 802.1q trunking 1 Fa0/2 on 802.1q trunking 1 Fa0/3 on 802.1q trunking 1 Port Vlans allowed on trunk Fa0/1 10,20 Fa0/2 10,20 Fa0/3 10,20 Port Vlans allowed and active in management domain Fa0/1 10,20 Fa0/2 10,20 Fa0/3 10,20 Port Vlans in spanning tree forwarding state and not pruned Fa0/1 10,20 Fa0/2 10,20 Fa0/3 10,20
Core的信息,大概这样:
0x23 配置单臂路由
R0
配置如下:
Router>en
Router#conf t
Router(config)#hostname R0
R0(config-if)#int f0/0.10
# 设置为VLAN10的子接口
R0(config-subif)#encapsulation dot1Q 10
R0(config-subif)#ip address 192.168.1.1 255.255.255.0
R0(config-subif)#no shut
R0(config-subif)#int f0/0.20
# 设置为VLAN20的子接口
R0(config-subif)#encapsulation dot1Q 20
R0(config-subif)#ip addr 192.168.2.1 255.255.255.0
R0(config-subif)#no shut
#打开fa0/0
R0(config-subif)#int fa0/0
R0(config-if)#no shut
R0(config-if)#do show ip int brief
0x24 S1作为vlan10的STP的根桥,S2作为VLAN20的STP根桥
0x240 配置
S1
S1(config)#spanning-tree vlan 10 priority 0
S2
S2(config)#spanning-tree vlan 20 priority 0
0x241 检验
S1(config)#do show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.C75A.4A91
Cost 19
Port 1(FastEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 00D0.BA7B.BE88
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1 Root FWD 19 128.1 P2p
Fa0/2 Altn BLK 19 128.2 P2p
VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 10
Address 00D0.BA7B.BE88
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 10 (priority 0 sys-id-ext 10)
Address 00D0.BA7B.BE88
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1 Desg FWD 19 128.1 P2p
Fa0/2 Desg FWD 19 128.2 P2p
Fa0/3 Desg FWD 19 128.3 P2p
VLAN0020
Spanning tree enabled protocol ieee
Root ID Priority 20
Address 000A.F39C.A203
Cost 19
Port 2(FastEthernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32788 (priority 32768 sys-id-ext 20)
Address 00D0.BA7B.BE88
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1 Desg FWD 19 128.1 P2p
Fa0/2 Root FWD 19 128.2 P2p
S2(config)#do show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.C75A.4A91
Cost 19
Port 1(FastEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 000A.F39C.A203
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/3 Desg FWD 19 128.3 P2p
Fa0/2 Desg FWD 19 128.2 P2p
Fa0/1 Root FWD 19 128.1 P2p
VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 10
Address 00D0.BA7B.BE88
Cost 19
Port 2(FastEthernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32778 (priority 32768 sys-id-ext 10)
Address 000A.F39C.A203
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2 Root FWD 19 128.2 P2p
Fa0/1 Desg FWD 19 128.1 P2p
VLAN0020
Spanning tree enabled protocol ieee
Root ID Priority 20
Address 000A.F39C.A203
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 20 (priority 0 sys-id-ext 20)
Address 000A.F39C.A203
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2 Desg FWD 19 128.2 P2p
Fa0/1 Desg FWD 19 128.1 P2p
S2(config)#
0x25 检验
ping一下,通啦
0x30 路由部分
路由部分:
6、互联网区使用OSPF协议。R1/2/3作为area0区,R2/3/4作为Area1区,R3/5作为Area2区
7、RO和R6作为企业边界设备,为了上网需要配置默认路由。
0x31 配置路由IP
R0(10.1.1.254) -> R1(10.1.1.1)
R1:12.1.1.1 ->R2(12.1.1.2)
R1:13.1.1.1 -> R3(13.1.1.3)
R2:24.1.1.2-> R4(24.1.1.4)
具体滴就不叙述啦
- R4的最后一位IP都是4
- R5的最后一位IP都是5
- R5的最后一位IP都是6
这样配容易找到路由器,也不容易乱。
R0:
R0#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R0(config)#int f0/1
R0(config-if)#ip addr 10.1.1.254 255.255.255.0
R0(config-if)#no shut
R0(config-if)#do write
Building configuration...
[OK]
R0(config-if)#do show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset up up
FastEthernet0/0.10 192.168.1.1 YES manual up up
FastEthernet0/0.20 192.168.2.1 YES manual up up
FastEthernet0/1 10.1.1.254 YES manual up up
Vlan1 unassigned YES unset administratively down down
R0(config-if)#
R1:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R1
R1(config)#int e0/3/0
R1(config-if)#ip addr 10.1.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#do write
#
R1(config-if)#do show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
FastEthernet0/1 unassigned YES unset administratively down down
Ethernet0/3/0 10.1.1.1 YES manual up up
Vlan1 unassigned YES unset administratively down down
#
R1(config-if)#int f0/1
R1(config-if)#ip addr 12.1.1.1 255.255.255.0
R1(config-if)#no shut
#
R1(config-if)#int f0/0
R1(config-if)#ip addr 13.1.1.1 255.255.255.0
R1(config-if)#no shut
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
R1(config-if)#do write
R1(config-if)#do show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 13.1.1.1 YES manual up down
FastEthernet0/1 12.1.1.1 YES manual up down
Ethernet0/3/0 10.1.1.1 YES manual up up
Vlan1 unassigned YES unset administratively down down
R2:
Router>en
Router#conf t
[Enter configuration commands, one per line. End with CNTL/Z.]
Router(config)#hostname R2
R2(config)#int f0/0
R2(config-if)#ip addr 12.1.1.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
#
R2(config-if)#int f0/1
R2(config-if)#ip addr 24.1.1.2 255.255.255.0
R2(config-if)#no shut
#
R2(config-if)#do write
Building configuration...
[OK]
R2(config-if)#do show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 12.1.1.2 YES manual up up
FastEthernet0/1 24.1.1.2 YES manual up down
Vlan1 unassigned YES unset administratively down down
R2(config-if)#
R3:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R3
R3(config)#int f0/0
R3(config-if)#ip addr 13.1.1.3 255.255.255.0
R3(config-if)#no shut
R3(config-if)#int f0/1
R3(config-if)#ip addr 34.1.1.3 255.255.255.0
R3(config-if)#no shut
R3(config-if)#do write
R3(config-if)#do show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 13.1.1.3 YES manual up up
FastEthernet0/1 34.1.1.3 YES manual up down
Ethernet0/3/0 unassigned YES unset administratively down down
Vlan1 unassigned YES unset administratively down down
R4:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int f0/0
Router(config-if)#ip addr 24.1.1.4 255.255.255.0
Router(config-if)#no shut
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#hostname R4
R4(config)#int f0/1
R4(config-if)#ip addr 34.1.1.4 255.255.255.0
R4(config-if)#no shut
R4(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R4(config-if)#do write
Building configuration...
[OK]
R4(config-if)#do show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 24.1.1.4 YES manual up up
FastEthernet0/1 34.1.1.4 YES manual up up
Ethernet0/3/0 unassigned YES unset administratively down down
Vlan1 unassigned YES unset administratively down down
R3-补充
R3(config-if)#int e0/3/0
R3(config-if)#ip addr 35.1.1.4 255.255.255.0
R3(config-if)#no shut
R3(config-if)#do write
Building configuration...
[OK]
R3(config-if)#do show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 13.1.1.3 YES manual up up
FastEthernet0/1 34.1.1.3 YES manual up up
Ethernet0/3/0 35.1.1.4 YES manual up down
Vlan1 unassigned YES unset administratively down down
R5
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int f0/0
Router(config-if)#ip addr 35.1.1.5 255.255.255.0
Router(config-if)#no shut
Router(config-if)#hostname R5
R5(config)#int f0/1
R5(config-if)#ip addr 200.1.1.1 255.255.255.0
R5(config-if)#no shut
R5(config-if)#do write
Building configuration...
[OK]
R5(config-if)#do show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 35.1.1.5 YES manual up up
FastEthernet0/1 200.1.1.1 YES manual up up
Vlan1 unassigned YES unset administratively down down
R5(config-if)#
R4 补充
R4(config-if)#int e0/3/0
R4(config-if)#ip addr 100.1.1.4 255.255.255.0
R4(config-if)#no shut
R4(config-if)#do write
Building configuration...
[OK]
R4(config-if)#do show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 24.1.1.4 YES manual up up
FastEthernet0/1 34.1.1.4 YES manual up up
Ethernet0/3/0 100.1.1.4 YES manual up down
Vlan1 unassigned YES unset administratively down down
R4(config-if)#
R6
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R6
R6(config)#int f0/0
R6(config-if)#ip addr 100.1.1.6 255.255.255.0
R6(config-if)#no shut
R6(config-if)#
[%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up]
[%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up]
R6(config-if)#int fa0/1
R6(config-if)#ip addr 172.16.1.1 255.255.255.0
R6(config-if)#no shut
R6(config-if)#
[%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up]
[%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up]
R6(config-if)#do show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 100.1.1.6 YES manual up up
FastEthernet0/1 172.16.1.1 YES manual up up
Vlan1 unassigned YES unset administratively down down
R6(config-if)#do write
Building configuration...
[OK]
R6(config-if)#
0x32 配置OSPF
在OSPF中,掩码部分是指示网络部分的位,而不是主机部分。因此,使用0.0.0.255而不是255.255.255.0来表示网络命令的掩码。
在R1, R2, R3上配置Area 0
R1(config)#router ospf 1
R1(config-router)#network 10.1.1.0 0.0.0.255 area 0
R1(config-router)#network 12.1.1.0 0.0.0.255 area 0
R1(config-router)#network 13.1.1.0 0.0.0.255 area 0
R2(config)#router ospf 1
R2(config-router)#network 12.1.1.0 0.0.0.255 area 0
R2(config-router)#network 24.1.1.0 0.0.0.255 area 1
R3(config)#router ospf 1
R3(config-router)#network 13.1.1.0 0.0.0.255 area 0
R3(config-router)#network 34.1.1.0 0.0.0.255 area 1
R3(config-router)#network 35.1.1.0 0.0.0.255 area 2
在R2, R3, R4上配置Area 1
R4(config)#router ospf 1
R4(config-router)#network 24.1.1.0 0.0.0.255 area 1
R4(config-router)#network 34.1.1.0 0.0.0.255 area 1
R4(config-router)#network 100.1.1.0 0.0.0.255 area 1
在R3, R5上配置Area 2
这里注意一下,Area 2 应该是stub,但是咱们的题目要求中没有说,开始配置的时候没有配置为stub模式,修改的章节在0x48,在network 35.1.1.0 0.0.0.255 area 2
之后,用R5 R3 (config)#area 2 stub
即可,详细见0x48章节,同时,如果现在配置stub的话(是正确的),本章节中,后续的ospf database 中可能会有一小点偏差。
R5(config)#router ospf 1
R5(config-router)#network 35.1.1.0 0.0.0.255 area 2
R5(config-router)#network 200.1.1.0 0.0.0.255 area 2
在R4, R6上配置Area 1和Area 3
R6(config)#router ospf 1
R6(config-router)#network 100.1.1.0 0.0.0.255 area 3
R6(config-router)#network 172.16.1.0 0.0.0.255 area 3
为R0和R6配置默认路由
R0(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.1
R6(config)#ip route 0.0.0.0 0.0.0.0 100.1.1.4
0x33 检验OSPF
R1(config)#do 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 not set
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Ethernet0/3/0
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, FastEthernet0/1
13.0.0.0/24 is subnetted, 1 subnets
C 13.1.1.0 is directly connected, FastEthernet0/0
24.0.0.0/24 is subnetted, 1 subnets
O IA 24.1.1.0 [110/2] via 12.1.1.2, 00:07:29, FastEthernet0/1
34.0.0.0/24 is subnetted, 1 subnets
O IA 34.1.1.0 [110/2] via 13.1.1.3, 00:06:53, FastEthernet0/0
35.0.0.0/24 is subnetted, 1 subnets
O IA 35.1.1.0 [110/11] via 13.1.1.3, 00:06:53, FastEthernet0/0
100.0.0.0/24 is subnetted, 1 subnets
O IA 100.1.1.0 [110/12] via 12.1.1.2, 00:05:23, FastEthernet0/1
[110/12] via 13.1.1.3, 00:05:23, FastEthernet0/0
O IA 200.1.1.0/24 [110/12] via 13.1.1.3, 00:04:09, FastEthernet0/0
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#do 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 not set
10.0.0.0/24 is subnetted, 1 subnets
O 10.1.1.0 [110/11] via 12.1.1.1, 00:19:12, FastEthernet0/0
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, FastEthernet0/0
13.0.0.0/24 is subnetted, 1 subnets
O 13.1.1.0 [110/2] via 12.1.1.1, 00:19:12, FastEthernet0/0
24.0.0.0/24 is subnetted, 1 subnets
C 24.1.1.0 is directly connected, FastEthernet0/1
34.0.0.0/24 is subnetted, 1 subnets
O 34.1.1.0 [110/2] via 24.1.1.4, 00:16:53, FastEthernet0/1
35.0.0.0/24 is subnetted, 1 subnets
O IA 35.1.1.0 [110/12] via 12.1.1.1, 00:18:13, FastEthernet0/0
100.0.0.0/24 is subnetted, 1 subnets
O 100.1.1.0 [110/11] via 24.1.1.4, 00:16:53, FastEthernet0/1
O IA 200.1.1.0/24 [110/13] via 12.1.1.1, 00:15:34, FastEthernet0/0
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#do 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 not set
10.0.0.0/24 is subnetted, 1 subnets
O 10.1.1.0 [110/11] via 13.1.1.1, 00:18:41, FastEthernet0/0
12.0.0.0/24 is subnetted, 1 subnets
O 12.1.1.0 [110/2] via 13.1.1.1, 00:18:41, FastEthernet0/0
13.0.0.0/24 is subnetted, 1 subnets
C 13.1.1.0 is directly connected, FastEthernet0/0
24.0.0.0/24 is subnetted, 1 subnets
O 24.1.1.0 [110/2] via 34.1.1.4, 00:17:16, FastEthernet0/1
34.0.0.0/24 is subnetted, 1 subnets
C 34.1.1.0 is directly connected, FastEthernet0/1
35.0.0.0/24 is subnetted, 1 subnets
C 35.1.1.0 is directly connected, Ethernet0/3/0
100.0.0.0/24 is subnetted, 1 subnets
O 100.1.1.0 [110/11] via 34.1.1.4, 00:17:16, FastEthernet0/1
O 200.1.1.0/24 [110/11] via 35.1.1.5, 00:16:02, Ethernet0/3/0
R4#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R4(config)#do 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 not set
10.0.0.0/24 is subnetted, 1 subnets
O IA 10.1.1.0 [110/12] via 24.1.1.2, 00:17:38, FastEthernet0/0
[110/12] via 34.1.1.3, 00:17:28, FastEthernet0/1
12.0.0.0/24 is subnetted, 1 subnets
O IA 12.1.1.0 [110/2] via 24.1.1.2, 00:17:38, FastEthernet0/0
13.0.0.0/24 is subnetted, 1 subnets
O IA 13.1.1.0 [110/2] via 34.1.1.3, 00:17:28, FastEthernet0/1
24.0.0.0/24 is subnetted, 1 subnets
C 24.1.1.0 is directly connected, FastEthernet0/0
34.0.0.0/24 is subnetted, 1 subnets
C 34.1.1.0 is directly connected, FastEthernet0/1
35.0.0.0/24 is subnetted, 1 subnets
O IA 35.1.1.0 [110/11] via 34.1.1.3, 00:17:28, FastEthernet0/1
100.0.0.0/24 is subnetted, 1 subnets
C 100.1.1.0 is directly connected, Ethernet0/3/0
O IA 200.1.1.0/24 [110/12] via 34.1.1.3, 00:16:14, FastEthernet0/1
R5(config)#do 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 not set
10.0.0.0/24 is subnetted, 1 subnets
O IA 10.1.1.0 [110/12] via 35.1.1.4, 00:14:33, FastEthernet0/0
12.0.0.0/24 is subnetted, 1 subnets
O IA 12.1.1.0 [110/3] via 35.1.1.4, 00:14:33, FastEthernet0/0
13.0.0.0/24 is subnetted, 1 subnets
O IA 13.1.1.0 [110/2] via 35.1.1.4, 00:14:33, FastEthernet0/0
24.0.0.0/24 is subnetted, 1 subnets
O IA 24.1.1.0 [110/3] via 35.1.1.4, 00:14:33, FastEthernet0/0
34.0.0.0/24 is subnetted, 1 subnets
O IA 34.1.1.0 [110/2] via 35.1.1.4, 00:14:33, FastEthernet0/0
35.0.0.0/24 is subnetted, 1 subnets
C 35.1.1.0 is directly connected, FastEthernet0/0
100.0.0.0/24 is subnetted, 1 subnets
O IA 100.1.1.0 [110/12] via 35.1.1.4, 00:14:33, FastEthernet0/0
C 200.1.1.0/24 is directly connected, FastEthernet0/1
IA 是什么意思:
IA = inner area
看下配置:
R1#show ip ospf database
R1:
R1(config)#do show ip ospf database
OSPF Router with ID (13.1.1.1) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
13.1.1.1 13.1.1.1 311 0x80000006 0x005368 3
24.1.1.2 24.1.1.2 347 0x80000004 0x00ba3f 1
35.1.1.4 35.1.1.4 309 0x80000004 0x00c616 1
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
12.1.1.1 13.1.1.1 365 0x80000003 0x008c53
13.1.1.1 13.1.1.1 311 0x80000004 0x00dfbd
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
24.1.1.0 24.1.1.2 342 0x80000004 0x0049db
34.1.1.0 35.1.1.4 305 0x80000006 0x0053b8
35.1.1.0 35.1.1.4 305 0x80000007 0x009e62
34.1.1.0 24.1.1.2 227 0x80000005 0x00ce4a
100.1.1.0 24.1.1.2 217 0x80000006 0x00c903
24.1.1.0 35.1.1.4 216 0x80000008 0x00db37
100.1.1.0 35.1.1.4 216 0x80000009 0x005468
200.1.1.0 35.1.1.4 143 0x8000000a 0x00391e
R2:
R2(config)#do show ip ospf database
OSPF Router with ID (24.1.1.2) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
24.1.1.2 24.1.1.2 442 0x80000004 0x00ba3f 1
13.1.1.1 13.1.1.1 407 0x80000006 0x005368 3
35.1.1.4 35.1.1.4 405 0x80000004 0x00c616 1
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
12.1.1.1 13.1.1.1 461 0x80000003 0x008c53
13.1.1.1 13.1.1.1 407 0x80000004 0x00dfbd
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
24.1.1.0 24.1.1.2 437 0x80000004 0x0049db
34.1.1.0 24.1.1.2 322 0x80000005 0x00ce4a
100.1.1.0 24.1.1.2 312 0x80000006 0x00c903
34.1.1.0 35.1.1.4 401 0x80000006 0x0053b8
35.1.1.0 35.1.1.4 401 0x80000007 0x009e62
24.1.1.0 35.1.1.4 312 0x80000008 0x00db37
100.1.1.0 35.1.1.4 312 0x80000009 0x005468
200.1.1.0 35.1.1.4 237 0x8000000a 0x00391e
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
24.1.1.2 24.1.1.2 327 0x80000003 0x009e43 1
35.1.1.4 35.1.1.4 319 0x80000003 0x005859 1
100.1.1.4 100.1.1.4 317 0x80000006 0x00b6aa 3
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
24.1.1.2 24.1.1.2 327 0x80000002 0x003204
34.1.1.3 35.1.1.4 319 0x80000002 0x0015db
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
12.1.1.0 24.1.1.2 437 0x80000007 0x00df4e
10.1.1.0 24.1.1.2 437 0x80000008 0x005cc8
13.1.1.0 24.1.1.2 437 0x80000009 0x00d851
35.1.1.0 24.1.1.2 391 0x8000000a 0x001cec
200.1.1.0 24.1.1.2 233 0x8000000b 0x00baa6
35.1.1.0 35.1.1.4 404 0x80000007 0x009e62
13.1.1.0 35.1.1.4 399 0x80000008 0x0061bd
12.1.1.0 35.1.1.4 399 0x80000009 0x0076a7
10.1.1.0 35.1.1.4 399 0x8000000a 0x00e82d
R3:
R3(config)#do show ip ospf database
OSPF Router with ID (35.1.1.4) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
24.1.1.2 24.1.1.2 1420 0x80000003 0x00bc3e 1
35.1.1.4 35.1.1.4 1383 0x80000003 0x00c815 1
13.1.1.1 13.1.1.1 1383 0x80000005 0x005567 3
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
12.1.1.1 13.1.1.1 1437 0x80000001 0x0032ff
13.1.1.1 13.1.1.1 1383 0x80000002 0x005cc5
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
24.1.1.0 24.1.1.2 1415 0x80000001 0x004fd8
34.1.1.0 35.1.1.4 1379 0x80000001 0x005db3
35.1.1.0 35.1.1.4 1379 0x80000002 0x00a85d
34.1.1.0 24.1.1.2 1300 0x80000002 0x00d447
100.1.1.0 24.1.1.2 1290 0x80000003 0x00cfff
24.1.1.0 35.1.1.4 1290 0x80000003 0x00e532
100.1.1.0 35.1.1.4 1290 0x80000004 0x005e63
200.1.1.0 35.1.1.4 1216 0x80000005 0x004319
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
24.1.1.2 24.1.1.2 1306 0x80000002 0x00a042 1
35.1.1.4 35.1.1.4 1295 0x80000002 0x005a58 1
100.1.1.4 100.1.1.4 1295 0x80000005 0x00b8a9 3
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
24.1.1.2 24.1.1.2 1306 0x80000001 0x0072be
34.1.1.3 35.1.1.4 1295 0x80000001 0x00e328
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
35.1.1.0 35.1.1.4 1380 0x80000001 0x00aa5c
13.1.1.0 35.1.1.4 1375 0x80000002 0x006db7
12.1.1.0 35.1.1.4 1375 0x80000003 0x0082a1
10.1.1.0 35.1.1.4 1375 0x80000004 0x00f427
12.1.1.0 24.1.1.2 1416 0x80000001 0x00eb48
10.1.1.0 24.1.1.2 1416 0x80000002 0x0068c2
13.1.1.0 24.1.1.2 1416 0x80000003 0x00e44b
35.1.1.0 24.1.1.2 1370 0x80000005 0x0026e7
200.1.1.0 35.1.1.4 1216 0x80000006 0x00411a
200.1.1.0 24.1.1.2 1211 0x80000006 0x00c4a1
Router Link States (Area 2)
Link ID ADV Router Age Seq# Checksum Link count
35.1.1.4 35.1.1.4 1221 0x80000002 0x00277e 1
200.1.1.1 200.1.1.1 1221 0x80000003 0x001f6d 2
Net Link States (Area 2)
Link ID ADV Router Age Seq# Checksum
35.1.1.4 35.1.1.4 1221 0x80000001 0x007528
Summary Net Link States (Area 2)
Link ID ADV Router Age Seq# Checksum
34.1.1.0 35.1.1.4 1379 0x80000001 0x005db3
13.1.1.0 35.1.1.4 1374 0x80000002 0x006db7
12.1.1.0 35.1.1.4 1374 0x80000003 0x0082a1
10.1.1.0 35.1.1.4 1374 0x80000004 0x00f427
24.1.1.0 35.1.1.4 1290 0x80000006 0x00df35
100.1.1.0 35.1.1.4 1290 0x80000007 0x005866
R4:
R4(config)#do show ip ospf database
OSPF Router with ID (100.1.1.4) (Process ID 1)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
100.1.1.4 100.1.1.4 292 0x80000006 0x00b6aa 3
24.1.1.2 24.1.1.2 303 0x80000003 0x009e43 1
35.1.1.4 35.1.1.4 294 0x80000003 0x005859 1
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
24.1.1.2 24.1.1.2 303 0x80000002 0x003204
34.1.1.3 35.1.1.4 294 0x80000002 0x0015db
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
12.1.1.0 24.1.1.2 412 0x80000007 0x00df4e
10.1.1.0 24.1.1.2 412 0x80000008 0x005cc8
13.1.1.0 24.1.1.2 412 0x80000009 0x00d851
35.1.1.0 35.1.1.4 379 0x80000007 0x009e62
13.1.1.0 35.1.1.4 374 0x80000008 0x0061bd
12.1.1.0 35.1.1.4 374 0x80000009 0x0076a7
10.1.1.0 35.1.1.4 374 0x8000000a 0x00e82d
35.1.1.0 24.1.1.2 366 0x8000000a 0x001cec
200.1.1.0 35.1.1.4 215 0x8000000b 0x00371f
200.1.1.0 24.1.1.2 209 0x8000000b 0x00baa6
R5:
R5#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R5(config)#do show ip ospf database
OSPF Router with ID (200.1.1.1) (Process ID 1)
Router Link States (Area 2)
Link ID ADV Router Age Seq# Checksum Link count
200.1.1.1 200.1.1.1 229 0x80000004 0x001d6e 2
35.1.1.4 35.1.1.4 229 0x80000003 0x00257f 1
Net Link States (Area 2)
Link ID ADV Router Age Seq# Checksum
35.1.1.4 35.1.1.4 229 0x80000002 0x007040
Summary Net Link States (Area 2)
Link ID ADV Router Age Seq# Checksum
34.1.1.0 35.1.1.4 387 0x80000008 0x004fba
13.1.1.0 35.1.1.4 382 0x80000009 0x005fbe
12.1.1.0 35.1.1.4 382 0x8000000a 0x0074a8
10.1.1.0 35.1.1.4 382 0x8000000b 0x00e62e
24.1.1.0 35.1.1.4 298 0x8000000c 0x00d33b
100.1.1.0 35.1.1.4 298 0x8000000d 0x004c6c
- ADV Router列表示该链路状态信息的广播路由器的ID
- Age列表示从上次收到该链路状态信息以来的时间(以秒为单位)
- Seq#列表示链路状态信息的序列号,用于唯一标识该信息的版本
- Link count列表示该链路状态条目中的链路数量
0x34 尝试ping
ping
R0#ping 100.1.1.6 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 100.1.1.6, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 0/11/25 ms
在R0上ping
R0>ping % Incomplete command. R0>ping 200.1.1.233 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 200.1.1.233, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 0/2/9 ms
R5进行PING
R6 tracerouter
R6#traceroute 10.1.1.254 Type escape sequence to abort. Tracing the route to 10.1.1.254 1 100.1.1.4 0 msec 0 msec 9 msec 2 34.1.1.3 6 msec 0 msec 7 msec 3 12.1.1.1 0 msec 1 msec 0 msec 4 10.1.1.254 0 msec 19 msec 0 msec
感觉没什么问题啦
0x40 其他部分
其它部分:
8、公网DNS服务器为分支1提供DNS解析服务。
9、分支2的web服务器为分支1提供web访问服务。
10、分支一需要配置端口地址转换(PNAT)实现内部主机上网。但是为了避免代码泄露,研发部门不允许上网。
11、分之二需要配置端口映射(DNAT),提供对外的web服务。域名www.自己的名字拼音.com。
0x41 分支1上网
R0划分内网外网
R0(config)#int f0/1
R0(config-if)#ip nat outside
R0(config-if)#int f0/0.10
R0(config-subif)#ip nat inside
R0(config-subif)#int f0/0.20
R0(config-subif)#ip nat inside
# 如果需需要的话,删ACL表
R0(config)#no ip access-list standard 1
# 用扩展ACL表
R0(config)#access-list 100 deny ip 192.168.2.0 0.0.0.255 any
R0(config)#access-list 100 permit ip 192.168.1.0 0.0.0.255 any
R0(config)#do show access-lists
Extended IP access list 100
10 deny ip 192.168.2.0 0.0.0.255 any
20 permit ip 192.168.1.0 0.0.0.255 any
# 根据ACL表进行NAT
R0(config)#ip nat inside source list 100 interface f0/1 overload
测试一下:ping 100.1.1.6
可以通滴
试试PC-1,通不了
0x42 分支2 网上冲浪服务器的网上冲浪
R6#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R6(config)#int f0/0
R6(config-if)#ip nat outside
R6(config-if)#int f0/1
R6(config-if)#ip nat inside
R6(config-if)#exit
# 转发端口
R6(config)#ip nat inside source static tcp 172.16.1.233 80 100.1.1.6 80
R6#show ip nat translations
Pro Inside global Inside local Outside local Outside global
tcp 100.1.1.6:80 172.16.1.233:80 --- ---
tcp 100.1.1.6:80 172.16.1.233:80 10.1.1.254:1026 10.1.1.254:1026
tcp 100.1.1.6:80 172.16.1.233:80 10.1.1.254:1027 10.1.1.254:1027
0x43 测试是否可以网上冲浪
用PC0访问
http://100.1.1.6
页面可以打开!芜湖
0x44 (可选)加个index_dayi.html
诶嘿!(打开网页巨慢,不加速的话要20秒左右)
http://100.1.1.6/index_dayi.html
0x45 配置DNS服务器
公网DNS服务器为分支1提供DNS解析服务。
分之二需要配置端口映射(DNAT),提供对外的web服务。域名www.自己的名字拼音.com。
公网DNS服务器为分支1提供DNS解析服务。
当前PC-0 是可以直接访问DNS服务器IP的:200.1.1.233
于是,只需要配置DNS即可:
0x46 测试一下
nslookup www.dayi.ink
解析成功啦。
试一试
大体上ok,要下火车了
等下写,2023年6月23日09:37:49
2023年6月23日14:58:31,好困。
0x47 配置自己的域名
域名www.自己的名字拼音.com。
最后加一个这个就可以啦。
然后试一试就可以了。
0x48 Area2 小修
Area 2 的这里是Stub
应该进行一下修改。
R3(config)#router ospf 1
R3(config-router)#network 13.1.1.0 0.0.0.255 area 0
R3(config-router)#network 34.1.1.0 0.0.0.255 area 1
R3(config-router)#network 35.1.1.0 0.0.0.255 area 2
R3(config-router)#area 2 stub
R5(config)#router ospf 1
R5(config-router)#network 35.1.1.0 0.0.0.255 area 2
R5(config-router)#network 200.1.1.0 0.0.0.255 area 2
R5(config-router)#area 2 st
R5(config-router)#area 2 stub
R5(config-router)#ex
然后看下db
R3(config)#do show ip ospf database
可以看到Area2 的出口是35.1.1.4(R4)路由器
R3(config)#do show ip ospf database
OSPF Router with ID (35.1.1.4) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
35.1.1.4 35.1.1.4 1332 0x80000003 0x00dcfe 1
13.1.1.1 13.1.1.1 1327 0x80000006 0x00b008 3
24.1.1.2 24.1.1.2 1327 0x80000003 0x00c633 1
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
13.1.1.3 35.1.1.4 1332 0x80000001 0x00620f
12.1.1.2 24.1.1.2 1327 0x80000001 0x00b5d3
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
34.1.1.0 35.1.1.4 1327 0x80000001 0x005db3
35.1.1.0 35.1.1.4 1327 0x80000002 0x00a85d
24.1.1.0 24.1.1.2 1322 0x80000001 0x004fd8
34.1.1.0 24.1.1.2 1317 0x80000002 0x00d447
100.1.1.0 24.1.1.2 1317 0x80000003 0x00cfff
24.1.1.0 35.1.1.4 1317 0x80000004 0x00e333
100.1.1.0 35.1.1.4 1317 0x80000005 0x005c64
200.1.1.0 35.1.1.4 79 0x80000006 0x00411a
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
35.1.1.4 35.1.1.4 1327 0x80000003 0x00624e 1
100.1.1.4 100.1.1.4 1322 0x80000006 0x00e07d 3
24.1.1.2 24.1.1.2 1322 0x80000002 0x00b42c 1
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
34.1.1.4 100.1.1.4 1327 0x80000001 0x00d9e7
24.1.1.4 100.1.1.4 1327 0x80000002 0x00ff69
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
13.1.1.0 35.1.1.4 1327 0x80000001 0x006fb6
35.1.1.0 35.1.1.4 1327 0x80000002 0x00a85d
12.1.1.0 24.1.1.2 1322 0x80000001 0x00eb48
13.1.1.0 24.1.1.2 1322 0x80000002 0x00e64a
10.1.1.0 24.1.1.2 1322 0x80000003 0x0066c3
35.1.1.0 24.1.1.2 1322 0x80000005 0x0026e7
12.1.1.0 35.1.1.4 1312 0x80000004 0x0080a2
10.1.1.0 35.1.1.4 1312 0x80000005 0x00f228
200.1.1.0 35.1.1.4 79 0x80000006 0x00411a
200.1.1.0 24.1.1.2 74 0x80000007 0x00c2a2
Router Link States (Area 2)
Link ID ADV Router Age Seq# Checksum Link count
35.1.1.4 35.1.1.4 84 0x80000004 0x002d75 1
200.1.1.1 200.1.1.1 84 0x80000006 0x002365 2
Net Link States (Area 2)
Link ID ADV Router Age Seq# Checksum
35.1.1.5 200.1.1.1 1332 0x80000001 0x0047ae
Summary Net Link States (Area 2)
Link ID ADV Router Age Seq# Checksum
13.1.1.0 35.1.1.4 1327 0x80000001 0x006fb6
34.1.1.0 35.1.1.4 1327 0x80000002 0x005bb4
24.1.1.0 35.1.1.4 1317 0x80000003 0x00e532
100.1.1.0 35.1.1.4 1317 0x80000004 0x005e63
12.1.1.0 35.1.1.4 1312 0x80000005 0x007ea3
10.1.1.0 35.1.1.4 1312 0x80000006 0x00f029
0.0.0.0 35.1.1.4 346 0x80000007 0x00240b
R5#show ip ospf database
OSPF Router with ID (200.1.1.1) (Process ID 1)
Router Link States (Area 2)
Link ID ADV Router Age Seq# Checksum Link count
35.1.1.4 35.1.1.4 1372 0x80000004 0x002d75 1
200.1.1.1 200.1.1.1 1372 0x80000006 0x002365 2
Net Link States (Area 2)
Link ID ADV Router Age Seq# Checksum
35.1.1.5 200.1.1.1 818 0x80000002 0x007b0e
Summary Net Link States (Area 2)
Link ID ADV Router Age Seq# Checksum
0.0.0.0 35.1.1.4 1634 0x80000007 0x00240b
13.1.1.0 35.1.1.4 814 0x80000008 0x0061bd
34.1.1.0 35.1.1.4 814 0x80000009 0x004dbb
24.1.1.0 35.1.1.4 804 0x8000000a 0x00d739
100.1.1.0 35.1.1.4 804 0x8000000b 0x00506a
12.1.1.0 35.1.1.4 799 0x8000000c 0x0070aa
10.1.1.0 35.1.1.4 799 0x8000000d 0x00e230
R5#
重新尝试ping一下服务器,是可以通的。
PC-0 ping PC-1也是可以滴
重新打开网页试一试,正常打开。
0x49 保存所有的配置文件
S1#copy running-config startup-config
S2#copy running-config startup-config
Core#copy running-config startup-config
R0#copy running-config startup-config
R1#copy running-config startup-config
R2#copy running-config startup-config
R3#copy running-config startup-config
R4#copy running-config startup-config
R5#copy running-config startup-config
R6#copy running-config startup-config
0xFF 文件下载
- 0x10 -> 0x31.7:https://p.dabbit.net/blog/pic_bed/0x10-0x37.7_%E7%BB%BC%E5%90%88%E5%AE%9E%E9%AA%8C_94bf0dbc-2785-4e62-ad54-61568fa70.zip
- 0x10 -> 0x44 https://p.dabbit.net/blog/pic_bed/0x10-0x44_%E7%BB%BC%E5%90%88%E5%AE%9E%E9%AA%8C_70c0d130-911a-49ed-b447-46351011fd18.zip
- 0x10->0x49:https://p.dabbit.net/blog/pic_bed/0x10-0x49_%E7%BB%BC%E5%90%88%E5%AE%9E%E9%AA%8C_73af134e-7b5d-4a3f.zip