vlan batch 10 20
interface Eth-Trunk 1
trunkport GigabitEthernet 0/0/3 to 0/0/4
port link-type trunk
port trunk allow-pass vlan 10 20
# 要在vlan视图里面配置
inter vlan 10
ip add 192.168.10.254 24
inter vlan 20
ip add 192.168.20.254 24
# 配置连接PC接口
vlan batch 30 40
int e 0/0/1
port link-type access
port de vlan 30
....
# 配置连接路由器接口
interface g 0/0/1
port link-type trunk
port trunk allow-pass vlan 30 40
# 配置子接口,目的是没有解vlan标签和物理接口不够用,交换机接口为access和hybrid不需要
interface g 0/0/2.30
ip add 192.168.30.254 24
dot1q termination vid 30
arp broadcast enable
# 逻辑口g 0/0/2.40同理
1. 配置SW1
interface eth-trunk 2
mode lacp
max active-linknumber 2
least active-linknumber 2
trunkport gigabitethernet 0/0/1 to 0/0/3
port link-type trunk
lacp priority 30000
2. 配置SW2
interface eth-trunk 2
mode lacp
max active-linknumber 2
trunkport gigabitethernet 0/0/1 to 0/0/3
port link-type trunk
[Huawei]router id 1.1.1.1
[Huawei]ospf 1
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.3
[Huawei-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.3
PE1:
mpls lsr-id 1.1.1.1
mpls
quit
mpls ldp
quit
interface GigabitEthernet 0/0/1
mpls
mpls ldp
quit
# 查看命令
dis osfp ldp lsp
dis ip router
P
# 与PE1相同,注意每个接口都要配置
可以加上:
mpls
lsp-trigger none
PE2
# 与PE1相同
PE1:(PE2类似)
bgp 100
router-id 1.1.1.1
peer 3.3.3.3 as-number 100
peer 3.3.3.3 connect-interface LoopBack 0
ipv4-family v4
peer 3.3.3.3 en
# 查看
dis bgp v4 all peer
# 配置RT、RD参数:
ip -instance VPNA
route-distinguisher 100:1
-target 100:100
# 配置接口绑定VPN实例(CE1侧)
int e 0/0/1
ip binding -instance VPNA
ip add 10.1.1.1 30
# 配置与R1路由交互
bpg 100
pe 10.1.1.2 as-n 200
ipv4-family -instance VPNA
peer 10.1.1.2 as-number 200
int e 0/0/1
ip add 10.1.1.2 30
int loo 0
ip add 11.11.11.11 32
bgp 200
peer 10.1.1.1 as-number 100
# looback0根据题目来
net 11.11.11.11 32
network 192.168.2.0 24
dis bgp v4 -instance VPNA peer
dis bgp v4 -instance VPNA routing-table
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-mBcKTuH4-1664381561279)(./vrrp.png)]
# 配置路由器接口地址
ip add ...
# 配置vrrp
[R1-Ethernet0/0/1]vrrp vrid 1 virtual-ip 192.168.1.254
[R1-Ethernet0/0/1]vrrp vrid 1 priority 120
# 修改R1的vrrp优先级为主路由器(master)默认优先级为100,越大越优
[R2-Ethernet0/0/1]vrrp vrid 1 virtual-ip 192.168.1.254
# 查看vrrp信息
dis vrrp
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-cMT5Zwo6-1664381561281)(C:\Users\Renle\Desktop\运行培训\笔记\网络\static.png)]
# 首先配置好pc和路由器各端口ip,然后配置静态路由
# 在路由器R1上:
[Huawei]ip route-static 10.1.3.0 24 g0/0/0 12.1.1.2
在R1上“去”的有了,那么在R2上“回”的也得有:
[Huawei]ip route-static 10.1.1.0 24 e0/0/1 12.1.1.1
# 配置全局模式
[huawei]sysname DHCP
[DHCP]int g 0/0/0
[DHCP-GigabitEthernet0/0/0]ip address 10.20.20.254 24
[DHCP-GigabitEthernet0/0/0]q
[DHCP]dhcp enable
[DHCP]ip pool v11
[DHCP-ip-pool-v11]network 10.11.11.0 mask 24
[DHCP-ip-pool-v11]gateway-list 10.11.11.254
[DHCP-ip-pool-v11]dns-list 119.6.6.6
[DHCP-ip-pool-v11]lease day 0 hour 1 minute 30
[DHCP-ip-pool-v11]domain-name www.dianwang.com
[DHCP-ip-pool-v11]q
[DHCP]int g 0/0/1
[DHCP-GigabitEthernet0/0/0]dhcp select global
[DHCP-GigabitEthernet0/0/0]q
# 配置接口模式
dhcp en
int e 0/0/1
ip add 192.168.1.1 24
dhcp select inte
dhcp server lease day 1
dhcp server dns-list 100.1.1.1
dhcp server domain-name www.dianwang.com
# 排除部分ip
dhcp server excluded-ip-address 192.168.1.100 192.168.1.254
# 此部分为单vlan,单生成树
# 1. 查看端口mac地址
dis int Ethernet 0/0/1
# 2. 查看stp状态
dis stp
# 3. 配置LSW1 stp优先级,4096倍数,小的为根桥
stp priority 4096
-----------将SW1、SW2分别做vlan10、vlan20的根网桥----------
[SW1]stp mode mstp
[SW1]stp region-configuration ###进入MSTP域视图MSTP配置模式
[SW1-mst-region]region-name 1 ###配置MSTP域的域名为huawei1,缺省为交换设备主控板上管理网口的MAC地址。
[SW1-mst-region]revision-level 1 ###配置MST域的MSTP修订级别为1,缺省情况下MSTP域的MSTP修订级别为0,需要将各设备的MSTP修订级别修改为一致,选做
####一个实例可以对应多个vlan(instance 1 vlan 2 to 10)
[SW1-mst-region]instance 10 vlan 10
[SW1-mst-region]instance 20 vlan 20
[SW1-mst-region]active region-configuration ###激活MSTP域的配置(必须配置)
[SW1-mst-region]check region-configuration ###查看MSTP域配置参数
[SW1-mst-region]quit ###退出配置模式
[SW1]stp instance 10 root primary ###配置此交换机为实例1的主根桥
[SW1]stp instance 20 root secondary ###配置此交换机为实例2的备份根桥
------------------------------
[SW2]stp mode mstp
[SW2]stp region-configuration
[SW2-mst-region]region-name 1
[SW2-mst-region]revision-level 1
[SW2-mst-region]instance 1 vlan 10
[SW2-mst-region]instance 2 vlan 20
[SW2-mst-region]active region-configuration
[SW2-mst-region]quit
[SW2]stp instance 1 root secondary ###配置SW1交换机为实例1的备份根桥
[SW2]stp instance 2 root primary ###配置SW2交换机为实例2的主根桥
-----------------------------------
[SW3]stp mode mstp
[SW3]stp region-configuration
[SW3-mst-region]region-name 1
[SW3-mst-region]revision-level 1
[SW3-mst-region]instance 1 vlan 10
[SW3-mst-region]instance 2 vlan 20
[SW3-mst-region]active region-configuration
[ACC-1]int e 0/0/1
[ACC-1-Ethernet0/0/1]stp edged-port enable
[SW1]stp enable ###在所有交换机上启用MSTP
[SW2]stp enable
[SW3]stp enable
[SW3]dis stp brief ###查看STP接口角色及状态信息
# 也可以使用优先级设置主备,如下
# S1:
[S1]stp instance 11 priority 4096
[S1]stp instance 12 priority 8192
# S2:
[S2]stp instance 11 priority 8192
[S2]stp instance 12 priority 4096
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-O2ngORNR-1664381561283)(C:\Users\Renle\Desktop\运行培训\笔记\网络\IP-Prefix.png)]
# 首先配置ospf互通
# R1配置,R2相同
[Huawei]ospf 1 router-id 1.1.1.1
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]net 1.1.1.1 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]net 12.1.1.0 0.0.0.3
[Huawei-ospf-1-area-0.0.0.0]q
# 配置静态路由,并引入OSPF
[Huawei]ip route-static 100.1.1.1 32 NULL 0
[Huawei]ip route-static 100.2.2.2 32 NULL 0
[Huawei-ospf-1]import-route static
# 配置ip-prefix策略,并关联到route-policy,然后关联ospf
[Huawei]ip ip-prefix 123 permit 100.1.1.1 32 greater-equal 32 less-equal 32
[Huawei]route-policy 1 permit node 10
[Huawei-route-policy]if-match ip-prefix 123
[Huawei-route-policy]q
[Huawei]ospf 1
[Huawei-ospf-1]import-route static route-policy 1
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-1VRskrhi-1664381561284)(C:\Users\Renle\Desktop\运行培训\笔记\网络\filter-policy.png)]
# 本实验验证filter-policy对LSA没有过滤功能,也就是R3路由表没有影响,但是import方向会对R2路由表有影响,export方向都没有影响,filter-policy会对静态路由有影响
# 首先配置ospf互通,省略
# 配置ip-prefix
[R2]ip ip-prefix 1 index 10 deny 1.1.1.1 32
[R2]ip ip-prefix 1 index 20 permit 0.0.0.0 0
# 在ospf export方向引入
[R2]ospf 1
[R2-ospf-1]filter-policy ip-prefix 1 export
# 在ospf import方向引入
[R2-ospf-1]un filter-policy ip-prefix 1 export
[R2-ospf-1]filter-policy ip-prefix 1 import
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ksv5CGze-1664381561287)(%E6%8B%93%E6%89%91.png)]
PE1:
int loo 0
ip add
int g 0/0/1
ip add
ospf 1 router-id 1.1.1.1
area 0
network 1.1.1.1 0.0.0.0
network .....
# 宣告所有地址,其他路由器类似
PE1:
mpls lsr-id 1.1.1.1
mpls
quit
mpls ldp
quit
interface GigabitEthernet 0/0/1
mpls
mpls ldp
quit
# 查看命令
dis osfp ldp lsp
dis ip router
P
与PE1相同,注意每个接口都要配置
可以加上:
mpls
lsp-trigger none
PE2
与PE1相同
PE1:(PE2类似)
bgp 100
router-id 1.1.1.1
peer 3.3.3.3 as-number 100
peer 3.3.3.3 connect-interface LoopBack 0
ipv4-family v4
peer 3.3.3.3 en
dis bgp v4 all peer
# 1. 配置主机接口access
vlan 10
inter e 0/0/22
port link-type access
port de vlan 10
# 2. 配置交换机互联端口trunk
inter e 0/0/13
port link-type
port trunk allow-pass vlan 10
# 3. 配置LSW3、LSW1模式链路聚合
interface eth-trunk 1
mode lacp
max active-linknumber 2 #可不加
trunkport e 0/0/1 to 0/0/3
port link-type trunk
port trunk allow-pass vlan 10
q
lacp priority 30000
dis int Eth-Trunk 1
# 1. 配置模式链路聚合
vlan 10
interface eth-trunk 1
mode lacp
max active-linknumber 2
trunkport e 0/0/1 to 0/0/3
port link-type trunk
port trunk allow-pass vlan 10
# 2. 配置交换机互联接口trunk
# 配置交换机互联接口trunk,与上同
# 此部分为单vlan,单生成树
# 1. 查看端口mac地址
dis int Ethernet 0/0/1
# 2. 查看stp状态
dis stp
# 3. 配置LSW1 stp优先级,4096倍数,小的为根桥
stp priority 4096
-----------将SW1、SW2分别做vlan10、vlan20的根网桥----------
[SW1]stp mode mstp
[SW1]stp region-configuration ###进入MSTP域视图MSTP配置模式
[SW1-mst-region]region-name 1 ###配置MSTP域的域名为huawei1,缺省为交换设备主控板上管理网口的MAC地址。
[SW1-mst-region]revision-level 1 ###配置MST域的MSTP修订级别为1,缺省情况下MSTP域的MSTP修订级别为0,需要将各设备的MSTP修订级别修改为一致,选做
####一个实例可以对应多个vlan(instance 1 vlan 2 to 10)
[SW1-mst-region]instance 10 vlan 10
[SW1-mst-region]instance 20 vlan 20
[SW1-mst-region]active region-configuration ###激活MSTP域的配置(必须配置)
[SW1-mst-region]check region-configuration ###查看MSTP域配置参数
[SW1-mst-region]quit ###退出配置模式
[SW1]stp instance 10 root primary ###配置此交换机为实例1的主根桥
[SW1]stp instance 20 root secondary ###配置此交换机为实例2的备份根桥
------------------------------
[SW2]stp mode mstp
[SW2]stp region-configuration
[SW2-mst-region]region-name 1
[SW2-mst-region]revision-level 1
[SW2-mst-region]instance 1 vlan 10
[SW2-mst-region]instance 2 vlan 20
[SW2-mst-region]active region-configuration
[SW2-mst-region]quit
[SW2]stp instance 1 root secondary ###配置SW1交换机为实例1的备份根桥
[SW2]stp instance 2 root primary ###配置SW2交换机为实例2的主根桥
-----------------------------------
[SW3]stp mode mstp
[SW3]stp region-configuration
[SW3-mst-region]region-name 1
[SW3-mst-region]revision-level 1
[SW3-mst-region]instance 1 vlan 10
[SW3-mst-region]instance 2 vlan 20
[SW3-mst-region]active region-configuration
[ACC-1]int e 0/0/1
[ACC-1-Ethernet0/0/1]stp edged-port enable
[SW1]stp enable ###在所有交换机上启用MSTP
[SW2]stp enable
[SW3]stp enable
[SW3]dis stp brief ###查看STP接口角色及状态信息
# 也可以使用优先级设置主备,如下
# S1:
[S1]stp instance 11 priority 4096
[S1]stp instance 12 priority 8192
# S2:
[S2]stp instance 11 priority 8192
[S2]stp instance 12 priority 4096
# 1. 配置CE1单臂路由
dot1q termination vid 10
arp broadcast enable
ip add 192.168.1.1 24
# 2. 配置LSW1与路由器互联接口
int g 0/0/1
port link-type trun
port trunk allow-pass vlan 10
# 3. 配置LSW1 stp优先级,4096倍数,小的为根桥
stp priority 4096
# 1. 配置网关
int g 0/0/1
ip add 192.168.2.1 24
# 2. 配置DHCP
dhcp en
ip pool DHCP
network 192.168.2.0 mask 24
lease day 1
gateway-list 192.168.2.1
dns-list 100.1.1.1
domain-name www.dianwang.com
int g 0/0/1
dhcp select global
PE2创建实例
# 1. 配置RT、RD参数:
ip -instance VPNA
route-distinguisher 100:1
-target 100:1 both
# 2. 配置接口绑定VPN实例(CE1侧)
int e 0/0/1
ip binding -instance VPNA
ip add 10.1.1.1 30
# 3. 配置与R1路由交互
bpg 100
pe 200.1.1.2 as-n 300
ipv4-family -instance VPNA
peer 200.1.1.2 as-number 300
CE2配置与PE2路由交互:
int e 0/0/1
ip add 200.1.1.2 30
router id 200.1.1.2
bgp 300
peer 200.1.1.1 as-number 100
network 192.168.2.0 24
dis bgp peer
PE1与PE2相同
查看命令
dis bgp v4 -instance VPNA peer
dis bgp v4 -instance VPNA routing-table