Topologia
equipamento | interface | endereço de IP | Máscara de sub-rede | Gateway padrão |
---|---|---|---|---|
R1 | G0 / 0/0 | 10.0.12.1 | 255.255.255.0 | N / D |
Olha 0 | 10.0.1.1 | 255.255.255.255 | N / D | |
R2 | G0 / 0/0 | 10.0.12.2 | 255.255.255.0 | |
G0 / 0/1 | 10.0.23.2 | 255.255.255.0 | N / D | |
Olha 0 | 10.0.1.1 | 255.255.255.255 | N / D | |
R3 | G0 / 0/0 | 10.0.23.3 | 255.255.255.0 | N / D |
Veja | 10.0.3.3 | 255.255.255.255 | N / D |
1. Configuração básica
R1:
sys
sysname R1
int loop 0
ip add 10.0.1.1 32
int g0/0/0
ip add 10.0.12.1 24
q
R2:
sys
sysname R2
int loop 0
ip add 10.0.2.2 32
int g0/0/0
ip add 10.0.12.2 24
int g0/0/1
ip add 10.0.23.2 24
q
R3:
sys
sysname R3
int loop 0
ip add 10.0.3.3 32
int g0/0/1
ip add 10.0.23.3 24
q
2. Configure o protocolo de roteamento OSPF
R1
ospf router-id 10.0.1.1 //用look的ip地址作id名
area 0 //区域0
network 10.0.12.0 0.0.0.255 //宣告进OSPF
network 10.0.1.1 0.0.0.0 //0.0.0.0表示全匹配,0.0.0.255表示匹配后八位
R2
ospf router-id 10.0.2.2
area 0
network 10.0.12.0 0.0.0.255
network 10.0.2.2 0.0.0.0
network 10.0.23.0 0.0.0.255
R3
ospf router-id 10.0.3.3
area 0
network 10.0.23.0 0.0.0.255
network 10.0.3.3 0.0.0.0
3. Configure o protocolo MPLS
[R1]mpls lsr-id 10.0.1.1 //配置LSR ID
[R1]mpls //全局中启动MPLS
Info: Mpls starting, please wait... OK!
[R1-mpls]int g0/0/0
[R1-GigabitEthernet0/0/0]mpls //在要转发MPLS报文的接口上启动MPLS
R2
mpls lsr-id 10.0.2.2
mpls
int g0/0/0
mpls
int g0/0/1
mpls
R3
mpls lsr-id 10.0.3.3
mpls
int g0/0/1
mpls
4. Configure LSP estático,
configure R1 a R3 LSP
[R1]static-lsp ingress R1toR3 destination 10.0.3.3 32 nexthop 10.0.12.2 out-label 102
//配置R1到R3的静态LSP的Ingress,分配标签
[R2]mpls lsr-id 10.0.2.2
[R2]mpls
Info: Mpls starting, please wait... OK!
[R2-mpls]int g0/0/0
[R2-GigabitEthernet0/0/0]mpls
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]mpls
[R2]static-lsp transit R1toR3 incoming-interface GigabitEthernet 0/0/0 in-label 102 nexthop 10.0.23.3 out-label 203
//配置R1到R3的静态LSP的Transit,分配标签
[R3]mpls lsr-id 10.0.2.2
[R3]mpls
[R3-mpls]int g0/0/1
[R3-GigabitEthernet0/0/1]mpls
[R3]static-lsp egress R1toR3 incoming-interface GigabitEthernet 0/0/1 in-label 203
//配置R1到R3的静态LSP的Egress,分配标签
Verificação Verifica se
o
LSP do caminho que os pacotes MPLS para 10.0.3.32 percorrem é unidirecional
Configure R3 para ir para o LSP de R1
[R3]static-lsp ingress R3toR1 destination 10.0.1.1 32 nexthop 10.0.23.2 out-label 101
[R2]static-lsp transit R3toR1 incoming-interface GigabitEthernet 0/0/1 in-label 101 nexthop 10.0.12.1 out-label 201
[R1]static-lsp egress R3toR1 incoming-interface GigabitEthernet 0/0/0 in-label 201
Verificação
5. Use LDP para distribuir rótulos dinamicamente e estabelecer LSP
[R1]undo static-lsp ingress R1toR3 //删除之前的静态LSP
[R1]undo static-lsp egress R3toR1
[R2]undo static-lsp transit R1toR3
[R2]undo static-lsp transit R3toR1
[R3]undo static-lsp egress R1toR3
[R3]undo static-lsp ingress R3toR1
[R1]mpls ldp //全局启动LDP
[R1-mpls-ldp]int g0/0/0
[R1-GigabitEthernet0/0/0]mpls ldp //接口上启动LDP
[R2]mpls ldp //全局启动LDP
[R2-mpls-ldp]int g0/0/0
[R2-GigabitEthernet0/0/0]mpls ldp //接口上启动LDP
[R2-mpls-ldp]int g0/0/1
[R2-GigabitEthernet0/0/1]mpls ldp //接口上启动LDP
[R3]mpls ldp //全局启动LDP
[R3-mpls-ldp]int g0/0/1
[R3-GigabitEthernet0/0/1]mpls ldp //接口上启动LDP
//要先配置MPLS才可以配置LDP
Verificação
Verifique se a interface LDP
g0 / 0/0 interface habilitou LDP, e o modo de distribuição de rótulo é o modo DU
Ver informações da sessão LDP
Ver informações LSP
Verifique o caminho percorrido pelo pacote MPLS para 10.0.3.3/32 em R1. O
rótulo é 1025 quando o pacote é iniciado e é substituído por 3 após R2.
Fim do experimento