1
← 返回社区================================================================
全部设备 · 完整配置(到 OSPF 为止)
地址全部取自《网络构建试题-II卷》附录2 地址规划表
范围:任务一(主机名/SSH/SNMP)+ 接口地址 + OSPF
不含:BGP、MPLS、VRF、NAT、VRRP、隧道、无线 —— 按要求到 OSPF 截止
全程不 write —— 关机自动清空
================================================================
【端口名替换提醒】先对号入座,别照抄
----------------------------------------------------------------
本文按赛场标准机型写:GigabitEthernet 0/24 / 0/1 / 0/2 …
你手上两台 S3760E-24 是百兆口(只有 Gi0/25、Gi0/26 两个千兆口):
GigabitEthernet 0/24 → FastEthernet 0/24
GigabitEthernet 0/21 → FastEthernet 0/21
GigabitEthernet 0/22 → FastEthernet 0/22
只有当真机上 `interface GigabitEthernet 0/24` 报 ^ 才需要换。
不确定就先敲:show ip interface brief 看本机有哪些口。
【通用段】每台设备都要敲,只改 hostname 那一行
----------------------------------------------------------------
enable
configure terminal
no ip domain-lookup
hostname XXX ← S1 / S3 / R2 / GW1 …
ip routing ← 交换机要敲,路由器不用
!
enable service ssh-server
enable password Test@123456
username admin password 0 Test@123456
line vty 0 4
transport input ssh
login local
exec-timeout 10 0
exit
!
snmp-server community Test@123 rw
snmp-server host 192.1.100.100 traps version 2c Test@123
snmp-server enable traps
end
! SSH 密钥单独敲(会问长度,填 2048):
! configure terminal
! crypto key generate rsa
验证:show running-config | include username
show running-config | include snmp
================================================================
■ S1(北京 · PE)
================================================================
configure terminal
hostname S1
ip routing
!
vlan 11
name SC1-Connect
vlan 12
name BG1-Connect
vlan 13
name GL1-Connect
vlan 14
name IPv6-Connect
exit
!
interface F 0/24
description Connect_To_R2
no switchport
ip address 10.1.0.1 255.255.255.252
ipv6 address 2001:10:1::1/64
no shutdown
exit
!
interface VLAN 11
ip address 10.1.1.1 255.255.255.252
exit
interface VLAN 12
ip address 10.1.2.1 255.255.255.252
exit
interface VLAN 13
ip address 10.1.3.1 255.255.255.252
exit
interface VLAN 14
ipv6 address 2001:10:1:4::1/64
exit
!
interface Loopback 0
ip address 10.0.0.1 255.255.255.255
exit
interface Loopback 11
ip address 10.1.4.1 255.255.255.255
exit
interface Loopback 12
ip address 10.1.4.2 255.255.255.255
exit
interface Loopback 13
ip address 10.1.4.3 255.255.255.255
exit
!
router ospf 10
router-id 10.0.0.1
network 10.0.0.1 0.0.0.0 area 0
network 10.1.0.0 0.0.0.3 area 0
exit
end
show ip ospf neighbor
! ⏸ OSPF 11/12/13 是 router ospf 11 vrf SC 形式,依赖 VRF,本轮不做
================================================================
■ S2(北京 · PE)
================================================================
configure terminal
hostname S2
ip routing
!
vlan 11
name SC2-Connect
vlan 12
name BG2-Connect
vlan 13
name GL2-Connect
vlan 14
name IPv6-Connect
exit
!
interface F 0/24
description Connect_To_R2
no switchport
ip address 10.2.0.1 255.255.255.252
ipv6 address 2001:10:2::1/64
no shutdown
exit
!
interface VLAN 11
ip address 10.2.1.1 255.255.255.252
exit
interface VLAN 12
ip address 10.2.2.1 255.255.255.252
exit
interface VLAN 13
ip address 10.2.3.1 255.255.255.252
exit
interface VLAN 14
ipv6 address 2001:10:2:4::1/64
exit
!
interface Loopback 0
ip address 10.0.0.2 255.255.255.255
exit
interface Loopback 11
ip address 10.2.4.1 255.255.255.255
exit
interface Loopback 12
ip address 10.2.4.2 255.255.255.255
exit
interface Loopback 13
ip address 10.2.4.3 255.255.255.255
exit
!
router ospf 10
router-id 10.0.0.2
network 10.0.0.2 0.0.0.0 area 0
network 10.2.0.0 0.0.0.3 area 0
exit
end
show ip ospf neighbor
================================================================
■ S3(北京 · 接入)
================================================================
configure terminal
hostname S3
ip routing
!
vlan 10
name SC1-Terminal
vlan 11
name SC1-Connect
vlan 12
name BG1-Connect
vlan 13
name GL1-Connect
vlan 14
name IPv6-Connect
vlan 20
name BG1-Terminal
vlan 30
name GL1-Terminal
vlan 40
name IPv6-Terminal
exit
!
interface VLAN 11
ip address 10.1.1.2 255.255.255.252
exit
interface VLAN 12
ip address 10.1.2.2 255.255.255.252
exit
interface VLAN 13
ip address 10.1.3.2 255.255.255.252
exit
interface VLAN 14
ipv6 address 2001:10:1:4::2/64
exit
interface VLAN 10
ip address 10.1.10.254 255.255.255.0
exit
interface VLAN 20
ip address 10.1.20.254 255.255.255.0
exit
interface VLAN 30
ip address 10.1.30.254 255.255.255.0
exit
interface VLAN 40
ipv6 address 2001:10:1:40::254/64
no ipv6 nd suppress-ra
exit
!
interface Loopback 11
ip address 10.1.4.4 255.255.255.255
exit
interface Loopback 12
ip address 10.1.4.5 255.255.255.255
exit
interface Loopback 13
ip address 10.1.4.6 255.255.255.255
exit
interface Loopback 14
ip address 10.1.4.7 255.255.255.255
exit
end
show ip interface brief
! ⏸ S3 的 OSPF 11/12/13 全是 vrf 形式,依赖 VRF,本轮不做
================================================================
■ S4(北京 · 接入)
================================================================
configure terminal
hostname S4
ip routing
!
vlan 10
name SC2-Terminal
vlan 11
name SC2-Connect
vlan 12
name BG2-Connect
vlan 13
name GL2-Connect
vlan 14
name IPv6-Connect
vlan 20
name BG2-Terminal
vlan 30
name GL2-Terminal
vlan 40
name IPv6-Terminal
exit
!
interface VLAN 11
ip address 10.2.1.2 255.255.255.252
exit
interface VLAN 12
ip address 10.2.2.2 255.255.255.252
exit
interface VLAN 13
ip address 10.2.3.2 255.255.255.252
exit
interface VLAN 14
ipv6 address 2001:10:2:4::2/64
exit
interface VLAN 10
ip address 10.2.10.254 255.255.255.0
exit
interface VLAN 20
ip address 10.2.20.254 255.255.255.0
exit
interface VLAN 30
ip address 10.2.30.254 255.255.255.0
exit
interface VLAN 40
ipv6 address 2001:10:2:40::254/64
no ipv6 nd suppress-ra
exit
!
interface Loopback 11
ip address 10.2.4.4 255.255.255.255
exit
interface Loopback 12
ip address 10.2.4.5 255.255.255.255
exit
interface Loopback 13
ip address 10.2.4.6 255.255.255.255
exit
interface Loopback 14
ip address 10.2.4.7 255.255.255.255
exit
end
show ip interface brief
================================================================
■ S5(上海管理中心)
================================================================
configure terminal
hostname S5
ip routing
!
interface GigabitEthernet 0/24
description Connect_To_R3
no switchport
ip address 10.3.0.2 255.255.255.252
no shutdown
exit
!
! 聚合口 AG1(G0/1+G0/2)—— LACP 属任务二第 4 条,
! 你这台 port-group 不认,先探 aggregateport ? 再配;这里只给地址
interface AggregatePort 1
description Connect_To_VAC
no switchport
ip address 10.3.0.10 255.255.255.252
exit
!
interface Loopback 0
ip address 10.3.1.5 255.255.255.255
exit
!
interface GigabitEthernet 0/21
description Connect_To_IOM
no switchport
ip address 192.1.100.254 255.255.255.0
no shutdown
exit
interface GigabitEthernet 0/22
description Connect_To_AAA
no switchport
ip address 194.1.100.254 255.255.255.0
no shutdown
exit
!
router ospf 20
router-id 10.3.1.5
network 10.3.0.0 0.0.0.3 area 0
network 10.3.0.8 0.0.0.3 area 0
network 10.3.1.5 0.0.0.0 area 0
exit
end
show ip ospf neighbor
================================================================
■ S6(广州 · SDN)
================================================================
configure terminal
hostname S6
!
vlan 10
name SC1-Terminal
vlan 11
name SC2-Terminal
vlan 20
name AP-Manage
vlan 30
name Net-Manage
exit
!
interface VLAN 30
ip address 10.4.30.1 255.255.255.0
exit
!
interface GigabitEthernet 0/21
description Connect_To_SDN
no switchport
ip address 192.168.1.6 255.255.255.0
no shutdown
exit
end
show ip interface brief
! S6 不跑 OSPF(由 SDN 控制器下发流表)
================================================================
■ S7(HUB / 测试运维)
================================================================
configure terminal
hostname S7
interface VLAN 1
ip address 17.1.1.4 255.255.255.248
no shutdown
exit
end
show ip interface brief
================================================================
■ R1(模拟互联网 / 运营商)
================================================================
configure terminal
hostname R1
!
interface GigabitEthernet 0/1
description Connect_To_R2
ip address 12.1.1.1 255.255.255.248
no shutdown
exit
interface GigabitEthernet 0/1.21
description Connect_To_R2_Internet
encapsulation dot1Q 21
ip address 21.1.1.1 255.255.255.248
exit
!
interface GigabitEthernet 0/2
description Connect_To_R3
ip address 13.1.1.1 255.255.255.248
no shutdown
exit
interface GigabitEthernet 0/0
description Connect_To_S7
ip address 17.1.1.1 255.255.255.248
no shutdown
exit
!
interface Loopback 20
description IPv4-Internet-Resource
ip address 20.0.0.1 255.255.255.255
exit
interface Loopback 30
description NAT-PT-Target
ip address 30.0.0.1 255.255.255.255
exit
end
show ip interface brief
! R1 不跑 OSPF(模拟公网)
================================================================
■ R2(北京出口 + RR)
================================================================
configure terminal
hostname R2
!
interface GigabitEthernet 0/1
description Connect_To_S1
ip address 10.1.0.2 255.255.255.252
ipv6 address 2001:10:1::2/64
no shutdown
exit
interface GigabitEthernet 0/2
description Connect_To_S2
ip address 10.2.0.2 255.255.255.252
ipv6 address 2001:10:2::2/64
no shutdown
exit
interface GigabitEthernet 0/0
description Connect_To_R1
ip address 12.1.1.2 255.255.255.248
no shutdown
exit
interface GigabitEthernet 0/0.21
description Connect_To_Internet
encapsulation dot1Q 21
ip address 21.1.1.2 255.255.255.248
exit
!
interface Loopback 0
ip address 10.0.0.22 255.255.255.255
exit
interface Loopback 1
description L2TP-Tunnel
ip address 172.16.0.2 255.255.255.0
exit
interface Loopback 13
description Net-Manage
ip address 10.1.4.22 255.255.255.255
exit
!
router ospf 10
router-id 10.0.0.22
network 10.0.0.22 0.0.0.0 area 0
network 10.1.0.0 0.0.0.3 area 0
network 10.2.0.0 0.0.0.3 area 0
network 10.1.4.22 0.0.0.0 area 0
exit
!
ip route 0.0.0.0 0.0.0.0 21.1.1.1
end
show ip ospf neighbor
show ip route
================================================================
■ R3(上海管理中心出口)
================================================================
configure terminal
hostname R3
!
interface GigabitEthernet 0/1
description Connect_To_R1
ip address 13.1.1.2 255.255.255.248
no shutdown
exit
interface GigabitEthernet 0/2
description Connect_To_S5
ip address 10.3.0.1 255.255.255.252
no shutdown
exit
interface Loopback 0
ip address 10.3.1.3 255.255.255.255
exit
!
router ospf 20
router-id 10.3.1.3
network 10.3.0.0 0.0.0.3 area 0
network 10.3.1.3 0.0.0.0 area 0
exit
!
ip route 0.0.0.0 0.0.0.0 13.1.1.1
end
show ip ospf neighbor
================================================================
■ GW1(广州出口网关 · 主)
================================================================
configure terminal
hostname GW1
!
interface GigabitEthernet 0/0
description Connect_To_R1
ip address 17.1.1.2 255.255.255.248
no shutdown
exit
!
interface GigabitEthernet 0/1.10
description SC1-Terminal
encapsulation dot1Q 10
ip address 10.4.10.254 255.255.255.0
exit
interface GigabitEthernet 0/1.11
description SC2-Terminal
encapsulation dot1Q 11
ip address 10.4.11.254 255.255.255.0
exit
interface GigabitEthernet 0/1.20
description AP-Manage
encapsulation dot1Q 20
ip address 10.4.20.254 255.255.255.0
exit
interface GigabitEthernet 0/1.30
description Net-Manage
encapsulation dot1Q 30
ip address 10.4.30.254 255.255.255.0
exit
!
interface Loopback 0
ip address 10.4.1.1 255.255.255.255
exit
end
show ip interface brief
! ⏸ VRRP 属任务四第 4 条,本轮不做
================================================================
■ GW2(广州出口网关 · 备)
================================================================
configure terminal
hostname GW2
!
interface GigabitEthernet 0/0
description Connect_To_R1
ip address 17.1.1.3 255.255.255.248
no shutdown
exit
!
interface GigabitEthernet 0/1.10
description SC1-Terminal
encapsulation dot1Q 10
ip address 10.4.10.253 255.255.255.0
exit
interface GigabitEthernet 0/1.11
description SC2-Terminal
encapsulation dot1Q 11
ip address 10.4.11.253 255.255.255.0
exit
interface GigabitEthernet 0/1.20
description AP-Manage
encapsulation dot1Q 20
ip address 10.4.20.253 255.255.255.0
exit
interface GigabitEthernet 0/1.30
description Net-Manage
encapsulation dot1Q 30
ip address 10.4.30.253 255.255.255.0
exit
!
interface Loopback 0
ip address 10.4.1.2 255.255.255.255
exit
end
show ip interface brief
================================================================
■ VAC(AC1+AC2 虚拟化)—— 无线,本轮不做,仅列地址备查
================================================================
VAC LoopBack 0 = 10.3.1.12/32 ← 和 S3/S4 DHCP 的 option 138 对应
VAC AG1 = 10.3.0.9/30 ← 连 S5 的 10.3.0.10/30
================================================================
■ 每台做完都要验的三条
================================================================
show ip interface brief ← 地址对、状态 up
show ip ospf neighbor ← 跑 OSPF 的要有 FULL
show ip route ← 直连 C + 学到的 O
跑 OSPF 的设备:S1、S2、R2(进程 10)、S5、R3(进程 20)
不跑 OSPF 的:S3、S4(只跑 vrf 版,本轮跳过)、S6、S7、R1、GW1、GW2
全部回复(0)
还没有人回复,你可以抢先回答。
我要回复
登录后才能回复
去登录