2.
設備 | 接口或VLAN | VLAN名稱 | 二層或三層規劃 | 說明 |
S1 | VLAN10 | CAIWU | Gi0/1至Gi0/4 | 財務部 |
VLAN20 | XIAOSHOU | Gi0/5至Gi0/8 | 銷售部 | |
VLAN30 | YANFA | Gi0/9至Gi0/12 | 研發部 | |
VLAN40 | SHICHANG | Gi0/13至Gi0/16 | 市場部 | |
VLAN50 | AP | Gi0/20至Gi0/21 | 無線AP管理 | |
VLAN100 | Manage | 192.1.100.1/24 | 設備管理VLAN | |
S3 | VLAN10 | CAIWU | 192.1.10.252/24 | 財務部 |
VLAN20 | XIAOSHOU | 192.1.20.252/24 | 銷售部 | |
VLAN30 | YANFA | 192.1.30.252/24 | 研發部 | |
VLAN40 | SHICHANG | 192.1.40.252/24 | 市場部 | |
VLAN50 | AP | 192.1.50.252/24 | AP | |
VLAN60 | Wireless | 192.1.60.252/24 | 無線用戶 | |
VLAN100 | Manage | 192.1.100.252/24 | 設備管理VLAN | |
Gi0/24 | ? | 10.1.0.1/30 | ? | |
LoopBack 0 | ? | 11.1.0.33/32 | ? | |
S4 | VLAN10 | CAIWU | 192.1.10.253/24 | 財務部 |
VLAN20 | XIAOSHOU | 192.1.20.253/24 | 銷售部 | |
VLAN30 | YANFA | 192.1.30.253/24 | 研發部 | |
VLAN40 | SHICHANG | 192.1.40.253/24 | 市場部 | |
VLAN50 | AP | 192.1.50.253/24 | AP | |
VLAN60 | Wireless | 192.1.60.253/24 | 無線用戶 | |
VLAN100 | Manage | 192.1.100.253/24 | 設備管理VLAN | |
Gi0/24 | ? | 10.1.0.5/30 | ? | |
LoopBack 0 | ? | 11.1.0.34/32 | ? | |
AC1 | LoopBack 0 | ? | 11.1.0.204/32 | ? |
Vlan100 | Manage | 194.1.100.2/24 | 管理與互聯VLAN | |
AC2 | LoopBack 0 | ? | 11.1.0.205/32 | ? |
Vlan100 | Manage | 194.1.100.3/24 | 管理與互聯VLAN | |
S5 | Gi0/24 | ? | 40.1.0.1/30 | ? |
VLAN100 | Manage | 194.1.100.254/24 | 管理與互聯VLAN | |
LoopBack 0 | ? | 11.1.0.5/32 | ? | |
EG1 | GI0/0 | ? | 10.1.0.2/30 | ? |
GI0/1 | ? | 10.1.0.6/30 | ? | |
GI0/4 | ? | 20.1.0.1/30 | ? | |
LoopBack 0 | ? | 11.1.0.11/32 | ? | |
EG2 | GI0/0 | ? | 10.1.0.14/30 | ? |
GI0/1 | ? | 10.1.0.18/30 | ? | |
GI0/4 | ? | 30.1.0.1/30 | ? | |
LoopBack 0 | ? | 11.1.0.12/32 | ? | |
R1 | Gi0/0 | ? | 20.1.0.2/30 | ? |
Gi0/1 | ? | 12.1.0.1/28 | ? | |
Gi0/2 | ? | 13.1.0.1/28 | ? | |
LoopBack 0 | ? | 11.1.0.1/32 | ? | |
R2 | Gi0/0 | ? | 30.1.0.2/30 | ? |
Gi0/1 | ? | 12.1.0.2/28 | ? | |
Gi0/2 | ? | 23.1.0.2/28 | ? | |
LoopBack 0 | ? | 11.1.0.2/32 | ? | |
R3 | Gi0/0 | ? | 40.1.0.2/30 | ? |
Gi0/1 | ? | 13.1.0.3/28 | ? | |
Gi0/2 | ? | 23.1.0.3/28 | ? | |
LoopBack 0 | ? | 11.1.0.3/32 | ? | |
S2 | VLAN10 | CAIWU | ? | 財務部 |
VLAN20 | XIAOSHOU | ? | 銷售部 | |
VLAN50 | AP | Gi0/1至Gi0/20 | 無線AP管理 | |
VLAN100 | Manage | 193.1.100.2/24 | 設備管理VLAN | |
S7 | VLAN10 | CAIWU | 193.1.10.254/24 | 財務部 |
VLAN20 | XIAOSHOU | 193.1.20.254/24 | 銷售部 | |
VLAN50 | AP | 193.1.50.254/24 | 無線AP管理 | |
VLAN60 | Wireless | 193.1.60.254/24 | 無線用戶 | |
VLAN100 | Manage | 193.1.100.254/24 | 設備管理VLAN | |
Gi0/24 | ? | 10.1.0.17/30 | ? | |
LoopBack 0 | ? | 11.1.0.67/32 | ? | |
S8 | VLAN10 | CAIWU | Gi0/1至Gi0/4 | 財務部 |
VLAN20 | XIAOSHOU | Gi0/5至Gi0/8 | 銷售部 | |
Gi0/23 | SDN-Manage | 192.168.1.3 | SDN管理網段 | |
S9 | VLAN10 | CAIWU | Gi0/1至Gi0/4 | 財務部 |
VLAN20 | XIAOSHOU | Gi0/5至Gi0/8 | 銷售部 | |
Gi0/23 | SDN-Manage | 192.168.1.4 | SDN管理網段 |
1.根據附錄1、附錄2,配置設備接口信息。encont fhostname sw1! 創建 VLAN 10 并命名為 CAIWU(財務)vlan 10name CAIWU! 創建 VLAN 20 并命名為 XIAOSHOU(銷售)vlan 20name XIAOSHOU! 創建 VLAN 30 并命名為 YANFA(研發)vlan 30name YANFA! 創建 VLAN 40 并命名為 SHICHANG(市場)vlan 40name SHICHANG! 創建 VLAN 50 并命名為 AP(無線接入點)vlan 50name AP! 創建 VLAN 100 并命名為 Manage(管理)vlan 100name Manage! 創建 VLAN 1 和 60vlan range 1,60....! 配置VLAN 100接口IP地址,用于設備管理interface VLAN 100ip address 192.1.100.1 255.255.255.0enableconfigure terminal! 配置 VLAN 接口 IP 地址interface vlan 10ip address 192.1.10.252 255.255.255.0exitinterface vlan 20ip address 192.1.20.252 255.255.255.0exitinterface vlan 30ip address 192.1.30.252 255.255.255.0exitinterface vlan 40ip address 192.1.40.252 255.255.255.0exitinterface vlan 50ip address 192.1.50.252 255.255.255.0exitinterface vlan 60ip address 192.1.60.252 255.255.255.0exitinterface vlan 100ip address 192.1.100.252 255.255.255.0exit! 配置物理接口 IP 地址interface GigabitEthernet 0/24ip address 10.1.0.1 255.255.255.252exit! 配置 Loopback 0 接口interface Loopback 0ip address 11.1.0.33 255.255.255.255exit2.所有交換機和無線控制器開啟SSH服務,用戶名密碼分別為admin、admin1234;密碼為明文類型,特權密碼為admin。! 配置域名,用于 SSH 認證ip domain-name yourdomain.com! 生成 RSA 密鑰對,用于 SSH 加密通信crypto key generate rsa modulus 1024! 創建本地用戶,用戶名 admin,密碼 admin1234,明文類型username admin password 0 admin1234! 設置特權密碼為 adminenable password admin! 配置 VTY 線路,允許 SSH 登錄line vty 0 15transport input sshlogin localendwrite memory 3.交換機配置SNMP功能,向主機172.16.0.254發送Trap消息版本采用V2C,讀寫的Community為“Test”,只讀的Community為“public”,開啟Trap消息。en conf tsnmp-server community Test RW(! 配置讀寫社區)snmp-server community public RO(! 配置只讀社區)! 指定Trap消息接收主機,使用SNMPv2c版本snmp-server host 172.16.0.254 traps version 2c publicsnmp-server host 172.16.0.254 traps version 2c Test! 開啟Trap消息功能snmp-server enable trapsendwrite memory 4.在全網Trunk鏈路上做VLAN修剪。! 進入全局配置模式enableconfigure terminal! 啟用 VTP(VLAN 中繼協議)修剪功能(前提是交換機 VTP 模式為服務器或透明模式)vtp pruning! 假設存在多個 Trunk 接口,如 GigabitEthernet 0/1、GigabitEthernet 0/2 等interface range GigabitEthernet 0/1 - 0/2! 設置接口為 Trunk 模式switchport mode trunk! 配置允許通過的 VLAN 列表,這里以 VLAN 10、20、30 為例,可根據實際情況修改switchport trunk allowed vlan 10,20,30! 開啟 VLAN 修剪,只允許列表中的 VLAN 通過 Trunk 鏈路switchport trunk pruning vlan add 10,20,30exit! 保存配置endwrite memory 5.為隔離部分終端用戶間的二層互訪,在交換機S1的Gi0/1-Gi0/10端口啟用端口保護。enableconfigure terminal! 批量配置 Gi0/1 - Gi0/10 端口interface range GigabitEthernet 0/1 - 0/10! 啟用端口保護功能switchport protectedendwrite memory 6.為規避網絡末端接入設備上出現環路影響全網,要求在總部接入設備S1進行防環處理。具體要求如下:終端接口開啟BPDU防護不能接收BPDU報文;終端接口下開啟環路檢測功能,檢測到環路后處理方式為關閉端口;連接PC終端的所有端口配置為邊緣端口;如果端口被BPDU防護檢測進入禁用狀態,再過300秒后會自動恢復,重新檢測是否有環路。enableconfigure terminal! 批量配置連接 PC 終端的端口(假設為 Gi0/1 - Gi0/16)interface range GigabitEthernet 0/1 - 0/16! 設置接口錯誤禁用恢復間隔為 300 秒errdisable recovery interval 300! 開啟端口保護功能switchport protected! 配置端口為接入模式,這里假設都接入 VLAN 10,你可按需修改switchport access vlan 10! 開啟 BPDU 防護,防止接收 BPDU 報文spanning-tree bpduguard enable! 開啟環路檢測功能,檢測到環路關閉端口rldp port loop-detect shutdown-port! 配置端口為邊緣端口spanning-tree portfastexit! 保存配置endwrite memory 7.在交換機S3、S4上配置DHCP中繼,對VLAN10內的用戶進行中繼,使得總部PC1用戶使用DHCP Relay方式獲取IP地址。# 配置交換機 S3enableconfigure terminal# 進入 VLAN 10 接口配置模式interface vlan 10# 配置 DHCP 中繼,將 DHCP 請求轉發到 DHCP 服務器ip helper-address 192.168.1.100exit# 保存配置endwrite memory# 配置交換機 S4enableconfigure terminal# 進入 VLAN 10 接口配置模式interface vlan 10# 配置 DHCP 中繼,將 DHCP 請求轉發到 DHCP 服務器ip helper-address 192.168.1.100exit# 保存配置endwrite memory 8.DHCP服務器搭建于EG1上,地址池命名為Pool_VLAN10,DHCP對外服務使用loopback 0地址。# 進入特權模式enable# 進入全局配置模式configure terminal# 開啟 DHCP 服務service dhcp# 創建名為 Pool_VLAN10 的 DHCP 地址池ip dhcp pool Pool_VLAN10# 配置該地址池分配的 IP 地址段network 192.1.10.0 255.255.255.0# 配置默認網關地址default-router 192.1.10.254 # 配置 DNS 服務器地址(可選,這里假設使用 114.114.114.114)dns-server 114.114.114.114# 配置租期為 8 天(可選,可按需修改)lease 8# 退出地址池配置模式exit# 進入 Loopback 0 接口配置模式interface Loopback 0# 配置 Loopback 0 接口的 IP 地址ip address 11.1.0.11 255.255.255.255# 退出接口配置模式exit# 指定 DHCP 服務器使用 Loopback 0 接口的 IP 地址對外提供服務ip dhcp-server source-interface Loopback 0# 保存配置endwrite memory 9.為了防御動態環境局域網偽DHCP服務欺騙,在S1交換機部署DHCP Snooping功能。en conf tip dhcp snooping//# 全局開啟 DHCP Snooping 功能# 配置信任端口,連接合法 DHCP 服務器的端口需要設置為信任端口# 假設連接 DHCP 服務器的端口為 GigabitEthernet 0/1interface GigabitEthernet 0/1ip dhcp snooping trustexit# 配置非信任端口,連接客戶端的端口為非信任端口# 假設連接客戶端的端口范圍是 GigabitEthernet 0/2 - 0/24interface range GigabitEthernet 0/2 - 0/24# 開啟 DHCP Snooping 綁定表記錄功能ip dhcp snooping bind# 開啟 DHCP Snooping 監聽功能ip dhcp snooping limit rate 10exit# 配置 DHCP Snooping 綁定表老化時間,假設設置為 24 小時ip dhcp snooping binding aging-time 24# 保存配置endwrite memory 10.在總部交換機S1、S3、S4上配置MSTP防止二層環路;要求VLAN10、VLAN20、VLAN50、VLAN60、VLAN100數據流經過S3轉發,S3失效時經過S4轉發;VLAN30、VLAN40數據流經過S4轉發,S4失效時經過S3轉發。所配置的參數要求如下:region-name為test;revision版本為1;S3作為實例1的主根、實例2的從根,S4作為實例2的主根、實例2的從根;生成樹優先級可設置為4096、8192或保持默認值;在S3和S4上配置VRRP,實現主機的網關冗余,所配置的參數要求如下表;S3、S4各VRRP組中高優先級設置為150,低優先級設置為120。配置說明1.MSTP 配置部分:通過進入 spanning-tree mst configuration 模式,定義 MSTP 區域名稱、修訂版本,并將不同 VLAN 映射到不同實例。在 S3 和 S4 上設置不同實例的優先級,來控制數據流走向。2.VRRP 配置部分:在每個 VLAN 接口下配置 IP 地址,然后根據 VRRP 備份組號和虛擬 IP 要求,配置相應的 VRRP 組,并設置優先級,以實現網關冗余。/*交換機S1配置*/enableconfigure terminal!進入 MSTP 配置模式spanning-tree mst configuration!設置 MSTP 區域名稱為 testname test!設置 MSTP 修訂版本為 1revision 1!將 VLAN10、VLAN20、VLAN50、VLAN60、VLAN100 映射到實例 1instance 1 vlan 10,20,50,60,100!將 VLAN30、VLAN40 映射到實例 2instance 2 vlan 30,40exit!全局啟用 MSTPspanning-tree mode mstpendwrite memory/*交換機 S3 的配置*/enableconfigure terminal!進入 MSTP 配置模式spanning-tree mst configuration!設置 MSTP 區域名稱為 testname test!設置 MSTP 修訂版本為 1revision 1!將 VLAN10、VLAN20、VLAN50、VLAN60、VLAN100 映射到實例 1instance 1 vlan 10,20,50,60,100!將 VLAN30、VLAN40 映射到實例 2instance 2 vlan 30,40exit!設置實例 1 的優先級為 4096,使其成為實例 1 的主根spanning-tree mst 1 priority 4096!設置實例 2 的優先級為 8192,使其成為實例 2 的從根spanning-tree mst 2 priority 8192!全局啟用 MSTPspanning-tree mode mstp!配置 VRRP 相關內容interface vlan 10ip address 192.1.10.252 255.255.255.0!配置 VRRP 備份組 10 及虛擬 IPvrrp 10 ip 192.1.10.254!設置 VRRP 備份組 10 的優先級為 150vrrp 10 priority 150exitinterface vlan 20ip address 192.1.20.252 255.255.255.0vrrp 20 ip 192.1.20.254vrrp 20 priority 150exitinterface vlan 30ip address 192.1.30.252 255.255.255.0vrrp 30 ip 192.1.30.254vrrp 30 priority 120exitinterface vlan 40ip address 192.1.40.252 255.255.255.0vrrp 40 ip 192.1.40.254vrrp 40 priority 120exitinterface vlan 50ip address 192.1.50.252 255.255.255.0vrrp 50 ip 192.1.50.254vrrp 50 priority 150exitinterface vlan 60ip address 192.1.60.252 255.255.255.0vrrp 60 ip 192.1.60.254vrrp 60 priority 150exitinterface vlan 100ip address 192.1.100.252 255.255.255.0vrrp 100 ip 192.1.100.254vrrp 100 priority 150exitendwrite memory/*交換機 S4 的配置*/enableconfigure terminal# 配置 MSTP 區域spanning-tree mst configurationname test //設置MSTP區域的名稱為testrevision 1 //修訂版本為1instance 1 vlan 10,20,50,60,100// !將 VLAN10、VLAN20、VLAN50、VLAN60、VLAN100 映射到實例 1instance 2 vlan 30,40 //!將 VLAN30、VLAN40 映射到實例 2exit# 設置實例 1 的優先級為從根spanning-tree mst 1 priority 8192# 設置實例 2 的優先級為主根spanning-tree mst 2 priority 4096!全局啟用 MSTPspanning-treespanning-tree mode mstp //啟用生成樹協議!配置 VRRP 相關內容interface vlan 10ip address 192.1.10.253 255.255.255.0vrrp 10 ip 192.1.10.254vrrp 10 priority 120exitinterface vlan 20ip address 192.1.20.253 255.255.255.0vrrp 20 ip 192.1.20.254vrrp 20 priority 120exitinterface vlan 30ip address 192.1.30.253 255.255.255.0vrrp 30 ip 192.1.30.254vrrp 30 priority 150exitinterface vlan 40ip address 192.1.40.253 255.255.255.0vrrp 40 ip 192.1.40.254vrrp 40 priority 150exitinterface vlan 50ip address 192.1.50.253 255.255.255.0vrrp 50 ip 192.1.50.254vrrp 50 priority 120exitinterface vlan 60ip address 192.1.60.253 255.255.255.0vrrp 60 ip 192.1.60.254vrrp 60 priority 120exitinterface vlan 100ip address 192.1.100.253 255.255.255.0vrrp 100 ip 192.1.100.254vrrp 100 priority 120exitendwrite memory //每個交換機上保存配置11.總部與分部內網均使用OSPF協議組網,總部、分部與互聯網間使用靜態路由協議。具體要求如下:總部S3、S4、EG1間運行OSPF,進程號為10,規劃單區域0;分部S7、EG2間運行OSPF,進程號為20,規劃單區域0;服務器區使用靜態路由組網;重發布路由進OSPF中使用類型1。/*交換機S3配置*/enableconfigure terminalrouter ospf 10 //! 啟用 OSPF 進程 10,宣告直連網段到區域 0network 192.1.10.0 0.0.0.255 area 0 // network 連接 S4 接口的 IP 地址 對應的反掩碼 area 0network 192.1.20.0 0.0.0.255 area 0network 192.1.30.0 0.0.0.255 area 0network 192.1.40.0 0.0.0.255 area 0network 192.1.50.0 0.0.0.255 area 0network 192.1.60.0 0.0.0.255 area 0network 192.1.100.0 0.0.0.255 area 0network 10.1.0.0 0.0.0.3 area 0 // network 連接 EG1 接口的 IP 地址 對應的反掩碼 area 0network 11.1.0.33 0.0.0.0 area 0exitendwrite memory/*交換機S4配置*/enableconfigure terminal! 創建 VLANvlan 10,20,30,40,50,60,100exit! 配置 VLAN 接口 IP 地址interface vlan 10ip address 192.1.10.253 255.255.255.0exitinterface vlan 20ip address 192.1.20.253 255.255.255.0exitinterface vlan 30ip address 192.1.30.253 255.255.255.0exitinterface vlan 40ip address 192.1.40.253 255.255.255.0exitinterface vlan 50ip address 192.1.50.253 255.255.255.0exitinterface vlan 60ip address 192.1.60.253 255.255.255.0exitinterface vlan 100ip address 192.1.100.253 255.255.255.0exit! 配置物理接口 IP 地址interface GigabitEthernet 0/24ip address 10.1.0.5 255.255.255.252exit! 配置 Loopback 0 接口interface Loopback 0ip address 11.1.0.34 255.255.255.255exit! 啟用 OSPF 進程 10,宣告直連網段到區域 0router ospf 10network 192.1.10.0 0.0.0.255 area 0network 192.1.20.0 0.0.0.255 area 0network 192.1.30.0 0.0.0.255 area 0network 192.1.40.0 0.0.0.255 area 0network 192.1.50.0 0.0.0.255 area 0network 192.1.60.0 0.0.0.255 area 0network 192.1.100.0 0.0.0.255 area 0network 10.1.0.4 0.0.0.3 area 0network 11.1.0.34 0.0.0.0 area 0exitendwrite memory/*交換機EG1配置*/enableconfigure terminal! 配置物理接口 IP 地址interface GigabitEthernet 0/0ip address 10.1.0.2 255.255.255.252exitinterface GigabitEthernet 0/1ip address 10.1.0.6 255.255.255.252exitinterface GigabitEthernet 0/4ip address 20.1.0.1 255.255.255.252exit! 配置 Loopback 0 接口interface Loopback 0ip address 11.1.0.11 255.255.255.255exit! 啟用 OSPF 進程 10,宣告直連網段到區域 0router ospf 10network 10.1.0.0 0.0.0.3 area 0network 10.1.0.4 0.0.0.3 area 0network 20.1.0.0 0.0.0.3 area 0network 11.1.0.11 0.0.0.0 area 0! 重分布靜態路由進 OSPF,類型 1redistribute static subnets metric-type 1exit! 配置到互聯網的靜態路由ip route 0.0.0.0 0.0.0.0 假設的互聯網出口下一跳 IPendwrite memory/*交換機S7配置*/enableconfigure terminal! 創建 VLANvlan 10,20,50,60,100exit! 配置 VLAN 接口 IP 地址interface vlan 10ip address 193.1.10.254 255.255.255.0exitinterface vlan 20ip address 193.1.20.254 255.255.255.0exitinterface vlan 50ip address 193.1.50.254 255.255.255.0exitinterface vlan 60ip address 193.1.60.254 255.255.255.0exitinterface vlan 100ip address 193.1.100.254 255.255.255.0exit! 配置物理接口 IP 地址interface GigabitEthernet 0/24ip address 10.1.0.17 255.255.255.252exit! 配置 Loopback 0 接口interface Loopback 0ip address 11.1.0.67 255.255.255.255exit! 啟用 OSPF 進程 20,宣告直連網段到區域 0router ospf 20network 193.1.10.0 0.0.0.255 area 0network 193.1.20.0 0.0.0.255 area 0network 193.1.50.0 0.0.0.255 area 0network 193.1.60.0 0.0.0.255 area 0network 193.1.100.0 0.0.0.255 area 0network 10.1.0.16 0.0.0.3 area 0network 11.1.0.67 0.0.0.0 area 0exitendwrite memory/*交換機EG2配置*/enableconfigure terminal! 配置物理接口 IP 地址interface GigabitEthernet 0/0ip address 10.1.0.14 255.255.255.252exitinterface GigabitEthernet 0/1ip address 10.1.0.18 255.255.255.252exitinterface GigabitEthernet 0/4ip address 30.1.0.1 255.255.255.252exit! 配置 Loopback 0 接口interface Loopback 0ip address 11.1.0.12 255.255.255.255exit! 啟用 OSPF 進程 20,宣告直連網段到區域 0router ospf 20network 10.1.0.12 0.0.0.3 area 0network 10.1.0.16 0.0.0.3 area 0network 30.1.0.0 0.0.0.3 area 0network 11.1.0.12 0.0.0.0 area 0! 重分布靜態路由進 OSPF,類型 1redistribute static subnets metric-type 1exit! 配置到互聯網的靜態路由ip route 0.0.0.0 0.0.0.0 假設的互聯網出口下一跳 IPendwrite memoryenableconfigure terminal! 創建 VLAN 100vlan 100exit! 配置 VLAN 100 接口 IP 地址interface vlan 100ip address 194.1.100.254 255.255.255.0exit! 配置物理接口 IP 地址interface GigabitEthernet 0/24ip address 40.1.0.1 255.255.255.252exit! 配置 Loopback 0 接口interface Loopback 0ip address 11.1.0.5 255.255.255.255exit! 配置到總部網絡的靜態路由ip route 192.1.0.0 255.255.0.0 指向總部網絡的下一跳 IP 地址! 這里假設下一跳是與總部相連的接口 IP,比如通過 R3 連接到總部網絡,假設 R3 的 Gi0/0 連接 S5,R3 的 Gi0/0 地址為 40.1.0.2! 那么這里的下一跳 IP 就是 40.1.0.2/*ip route 192.1.0.0 255.255.0.0 40.1.0.2*/! 配置到分部網絡的靜態路由ip route 193.1.0.0 255.255.0.0 指向分部網絡的下一跳 IP 地址! 假設通過某種方式連接到分部網絡,比如通過 R3 再轉接,根據實際拓撲確定下一跳 IP! 配置默認路由(如果需要訪問互聯網)ip route 0.0.0.0 0.0.0.0 互聯網網關的 IP 地址! 假設互聯網網關地址可以通過 R3 出去,根據實際情況填寫endwrite memory12.總部與分部部署IPv6網絡實現總分機構內網IPv6終端可通過無狀態自動從網關處獲取地址。/*交換機S3配置*/enableconfigure terminal! 啟用 IPv6 單播路由ipv6 unicast-routing! 配置各個 VLAN 并為其接口分配 IPv6 地址interface vlan 10ipv6 address 2001:192:10::252/64ipv6 nd ra - defaultexitinterface vlan 20ipv6 address 2001:192:20::252/64ipv6 nd ra - defaultexitinterface vlan 30ipv6 address 2001:192:30::252/64ipv6 nd ra - defaultexitinterface vlan 40ipv6 address 2001:192:40::252/64ipv6 nd ra - defaultexitinterface vlan 60ipv6 address 2001:192:60::252/64ipv6 nd ra - defaultexitinterface vlan 100ipv6 address 2001:192:100::252/64ipv6 nd ra - defaultexit! 配置 VRRP 組interface vlan 10ipv6 vrrp 10 address 2001:192:10::254/64ipv6 vrrp 10 priority 150exitinterface vlan 20ipv6 vrrp 20 address 2001:192:20::254/64ipv6 vrrp 20 priority 150exitinterface vlan 30ipv6 vrrp 30 address 2001:192:30::254/64ipv6 vrrp 30 priority 120exitinterface vlan 40ipv6 vrrp 40 address 2001:192:40::254/64ipv6 vrrp 40 priority 120exitinterface vlan 60ipv6 vrrp 60 address 2001:192:60::254/64ipv6 vrrp 60 priority 150exitinterface vlan 100ipv6 vrrp 100 address 2001:192:100::254/64ipv6 vrrp 100 priority 150exitendwrite memory/*交換機S4配置*/enableconfigure terminal! 啟用 IPv6 單播路由ipv6 unicast-routing! 配置各個 VLAN 并為其接口分配 IPv6 地址interface vlan 10ipv6 address 2001:192:10::253/64ipv6 nd ra - defaultexitinterface vlan 20ipv6 address 2001:192:20::253/64ipv6 nd ra - defaultexitinterface vlan 30ipv6 address 2001:192:30::253/64ipv6 nd ra - defaultexitinterface vlan 40ipv6 address 2001:192:40::253/64ipv6 nd ra - defaultexitinterface vlan 60ipv6 address 2001:192:60::253/64ipv6 nd ra - defaultexitinterface vlan 100ipv6 address 2001:192:100::253/64ipv6 nd ra - defaultexit! 配置 VRRP 組interface vlan 10ipv6 vrrp 10 address 2001:192:10::254/64ipv6 vrrp 10 priority 120exitinterface vlan 20ipv6 vrrp 20 address 2001:192:20::254/64ipv6 vrrp 20 priority 120exitinterface vlan 30ipv6 vrrp 30 address 2001:192:30::254/64ipv6 vrrp 30 priority 150exitinterface vlan 40ipv6 vrrp 40 address 2001:192:40::254/64ipv6 vrrp 40 priority 150exitinterface vlan 60ipv6 vrrp 60 address 2001:192:60::254/64ipv6 vrrp 60 priority 120exitinterface vlan 100ipv6 vrrp 100 address 2001:192:100::254/64ipv6 vrrp 100 priority 120exitendwrite memory/*交換機S7配置命令*/enableconfigure terminal! 啟用 IPv6 單播路由ipv6 unicast-routing! 配置各個 VLAN 并為其接口分配 IPv6 地址interface vlan 10ipv6 address 2001:193:10::254/64ipv6 nd ra - defaultexitinterface vlan 20ipv6 address 2001:193:20::254/64ipv6 nd ra - defaultexitinterface vlan 60ipv6 address 2001:193:60::254/64ipv6 nd ra - defaultexitendwrite memory13.在S3和S4上配置VRRP for IPv6,實現主機的IPv6網關冗余;在S3和S4上VRRP與MSTP的主備狀態與IPV4網絡一致。配置說明配置解釋ipv6 enable:在 VLAN 接口上啟用 IPv6 功能。ipv6 address:為 VLAN 接口配置 IPv6 地址。vrrp6 vrid [VRID] address [虛擬 IPv6 地址]:創建 VRRPv6 虛擬路由器,指定 VRID 和虛擬 IPv6 地址。vrrp6 vrid [VRID] priority [優先級數值]:設置 VRRPv6 虛擬路由器的優先級,數值越大優先級越高。vrrp6 vrid [VRID] advertisement - interval [時間間隔]:配置 VRRPv6 通告報文的發送間隔。/*S3交換機配置*/# 進入系統視圖enableconfigure terminal# 配置 VLAN10 的 VRRP for IPv6interface vlan 10# 開啟 IPv6 功能ipv6 enable# 配置接口的 IPv6 地址ipv6 address 2001:192:10::252/64# 創建 VRRPv6 虛擬路由器,VRID 為 10,虛擬 IPv6 地址為 2001:192:10::254vrrp6 vrid 10 address 2001:192:10::254# 由于 S3 在 VLAN10 為主設備,設置較高優先級vrrp6 vrid 10 priority 150# 設置 VRRPv6 通告間隔為 1 秒(可選)vrrp6 vrid 10 advertisement-interval 1exit# 配置 VLAN20 的 VRRP for IPv6interface vlan 20ipv6 enableipv6 address 2001:192:20::252/64vrrp6 vrid 20 address 2001:192:20::254vrrp6 vrid 20 priority 150vrrp6 vrid 20 advertisement-interval 1exit# 配置 VLAN30 的 VRRP for IPv6interface vlan 30ipv6 enableipv6 address 2001:192:30::252/64vrrp6 vrid 30 address 2001:192:30::254# S3 在 VLAN30 為備設備,設置較低優先級vrrp6 vrid 30 priority 120vrrp6 vrid 30 advertisement-interval 1exit# 配置 VLAN40 的 VRRP for IPv6interface vlan 40ipv6 enableipv6 address 2001:192:40::252/64vrrp6 vrid 40 address 2001:192:40::254vrrp6 vrid 40 priority 120vrrp6 vrid 40 advertisement-interval 1exit# 配置 VLAN60 的 VRRP for IPv6interface vlan 60ipv6 enableipv6 address 2001:192:60::252/64vrrp6 vrid 60 address 2001:192:60::254vrrp6 vrid 60 priority 150vrrp6 vrid 60 advertisement-interval 1exit# 配置 VLAN100 的 VRRP for IPv6interface vlan 100ipv6 enableipv6 address 2001:192:100::252/64vrrp6 vrid 100 address 2001:192:100::254vrrp6 vrid 100 priority 150vrrp6 vrid 100 advertisement-interval 1exit# 保存配置write memory/*交換機S4配置命令*/# 進入系統視圖enableconfigure terminal# 配置 VLAN10 的 VRRP for IPv6interface vlan 10ipv6 enableipv6 address 2001:192:10::253/64vrrp6 vrid 10 address 2001:192:10::254# S4 在 VLAN10 為備設備,設置較低優先級vrrp6 vrid 10 priority 120vrrp6 vrid 10 advertisement-interval 1exit# 配置 VLAN20 的 VRRP for IPv6interface vlan 20ipv6 enableipv6 address 2001:192:20::253/64vrrp6 vrid 20 address 2001:192:20::254vrrp6 vrid 20 priority 120vrrp6 vrid 20 advertisement-interval 1exit# 配置 VLAN30 的 VRRP for IPv6interface vlan 30ipv6 enableipv6 address 2001:192:30::253/64vrrp6 vrid 30 address 2001:192:30::254# S4 在 VLAN30 為主設備,設置較高優先級vrrp6 vrid 30 priority 150vrrp6 vrid 30 advertisement-interval 1exit# 配置 VLAN40 的 VRRP for IPv6interface vlan 40ipv6 enableipv6 address 2001:192:40::253/64vrrp6 vrid 40 address 2001:192:40::254vrrp6 vrid 40 priority 150vrrp6 vrid 40 advertisement-interval 1exit# 配置 VLAN60 的 VRRP for IPv6interface vlan 60ipv6 enableipv6 address 2001:192:60::253/64vrrp6 vrid 60 address 2001:192:60::254vrrp6 vrid 60 priority 120vrrp6 vrid 60 advertisement-interval 1exit# 配置 VLAN100 的 VRRP for IPv6interface vlan 100ipv6 enableipv6 address 2001:192:100::253/64vrrp6 vrid 100 address 2001:192:100::254vrrp6 vrid 100 priority 120vrrp6 vrid 100 advertisement-interval 1exit# 保存配置write memory14.在 R1、R2、R3 上部署 IGP 中的 OSPF 動態路由實現直連網段互聯互通。(需要先為各設備接口配置 IP 地址,再啟用 OSPF 進程,宣告直連網段。配置時要依據網絡拓撲和地址規劃,確保各設備能正確識別和交換路由信息)R1路由器enableconfigure terminal! 配置 GigabitEthernet 0/1 接口interface GigabitEthernet 0/1no shutdownip address 192.168.1.1 255.255.255.0exit! 配置 GigabitEthernet 0/2 接口interface GigabitEthernet 0/2no shutdownip address 10.0.0.1 255.255.255.252exit! 開啟 OSPF 進程 1router ospf 1! 宣告直連網段到 OSPF 區域 0network 192.168.1.0 0.0.0.255 area 0network 10.0.0.0 0.0.0.3 area 0exit! 保存配置write memoryR2路由器enableconfigure terminal! 配置 GigabitEthernet 0/1 接口interface GigabitEthernet 0/1no shutdownip address 10.0.0.2 255.255.255.252exit! 配置 GigabitEthernet 0/2 接口interface GigabitEthernet 0/2no shutdownip address 10.0.1.1 255.255.255.252exit! 開啟 OSPF 進程 1router ospf 1! 宣告直連網段到 OSPF 區域 0network 10.0.0.0 0.0.0.3 area 0network 10.0.1.0 0.0.0.3 area 0exit! 保存配置write memoryR3路由器enableconfigure terminal! 配置 GigabitEthernet 0/1 接口interface GigabitEthernet 0/1no shutdownip address 10.0.1.2 255.255.255.252exit! 配置 GigabitEthernet 0/2 接口interface GigabitEthernet 0/2no shutdownip address 192.168.2.1 255.255.255.0exit! 開啟 OSPF 進程 1router ospf 1! 宣告直連網段到 OSPF 區域 0network 10.0.1.0 0.0.0.3 area 0network 192.168.2.0 0.0.0.255 area 0exit! 保存配置write memory15.R1、R2、R3間部署IBGP,AS號為100,使用Loopback接口建立Peer。R1配置enableconfigure terminal! 創建并配置 Loopback 0 接口interface Loopback 0ip address 11.1.0.1 255.255.255.255exit! 開啟 BGP 進程,AS 號為 100router bgp 100! 設置路由器 ID 為 Loopback 0 接口的 IP 地址router-id 11.1.0.1! 配置 R2 為 BGP 鄰居neighbor 11.1.0.2 remote-as 100neighbor 11.1.0.2 update-source Loopback 0! 配置 R3 為 BGP 鄰居neighbor 11.1.0.3 remote-as 100neighbor 11.1.0.3 update-source Loopback 0exit! 保存配置write memoryR2配置enableconfigure terminal! 創建并配置 Loopback 0 接口interface Loopback 0ip address loopback ip 255.255.255.255exit! 開啟 BGP 進程,AS 號為 100router bgp 100! 設置路由器 ID 為 Loopback 0 接口的 IP 地址router-id loopback ip! 配置 R1 為 BGP 鄰居neighbor loopback ip remote-as 100neighbor loopback ip update-source Loopback 0! 配置 R3 為 BGP 鄰居neighbor loopback ip remote-as 100neighbor loopback ip update-source Loopback 0exit! 保存配置write memory/R3配置命令/enableconfigure terminal! 創建并配置 Loopback 0 接口interface Loopback 0ip address 11.1.0.3 255.255.255.255exit! 開啟 BGP 進程,AS 號為 100router bgp 100! 設置路由器 ID 為 Loopback 0 接口的 IP 地址router-id Loopback 0的ip! 配置 R1 為 BGP 鄰居neighbor ip remote-as 100neighbor ip update-source Loopback 0! 配置 R2 為 BGP 鄰居neighbor ip remote-as 100neighbor ip update-source Loopback 0exit! 保存配置write memory配置解釋Loopback 接口配置:interface Loopback 0:進入 Loopback 0 接口的配置模式。ip address [IP 地址] [子網掩碼]:為 Loopback 0 接口配置 IP 地址和子網掩碼,這里使用 32 位子網掩碼,確保地址的唯一性。BGP 進程配置:router bgp 100:開啟 BGP 進程,指定自治系統號為 100。router-id [IP 地址]:設置 BGP 路由器 ID,使用 Loopback 接口的 IP 地址能保證路由器 ID 的穩定性和唯一性。BGP 鄰居配置:neighbor [對端 IP 地址] remote-as 100:將對端路由器的 Loopback 接口 IP 地址配置為 BGP 鄰居,指定其所在的自治系統號為 100。neighbor [對端 IP 地址] update-source Loopback 0:指定使用本地的 Loopback 0 接口作為 BGP 更新消息的源地址,保證 BGP 連接的穩定性。保存配置:write memory:將當前配置保存到設備的非易失性存儲器中,防止設備重啟后配置丟失。使用show ip bgp summary命令查看BGP鄰居關系是否建立14.運營商通告EG1、EG2專線至服務器區,R1、R2均以匯總B段靜態路由的方式進行發布。服務器區通過R3將AC1、AC2通告到BGP中。enableconfigure terminal! 配置連接 EG1 的接口interface GigabitEthernet 0/0no shutdownip address 255.255.255.252exit! 配置連接 R3 的接口interface s3/0no shutdownip address 255.255.255.252exit! 配置匯總 B 段靜態路由ip route 172.16.0.0 255.240.0.0 192.168.1.2! 配置 BGProuter bgp 65000neighbor 100.1.1.1 remote-as 65100neighbor 192.168.1.2 remote-as 65000address-family ipv4 unicastnetwork 172.16.0.0 mask 255.240.0.0neighbor 100.1.1.1 activateneighbor 192.168.1.2 activateexit-address-familyexit! 保存配置write memory
?