春风十里不如你 —— Taozi - ping 2023-09-19T12:30:45+08:00 Typecho https://www.xiongan.host/index.php/feed/atom/tag/ping/ <![CDATA[【华为数通】MPLS的基础配置]]> https://www.xiongan.host/index.php/archives/221/ 2023-09-19T12:30:45+08:00 2023-09-19T12:30:45+08:00 admin https://www.xiongan.host MPLS的基础配置

整体拓扑

image-20230919102958463

首先配置各个路由器及接口ip地址

配置OSPF

R1:
[R1-ospf-1]dis this
[V200R003C00]
#
ospf 1 router-id 1.1.1.1 
 area 0.0.0.0 
  network 10.1.1.1 0.0.0.0 
  network 10.123.12.1 0.0.0.0 
#
return
R2:
[R2-ospf-1]dis this
[V200R003C00]
#
ospf 1 router-id 2.2.2.2 
 area 0.0.0.0 
  network 10.123.12.2 0.0.0.0 
  network 10.123.23.2 0.0.0.0 
  network 20.1.1.1 0.0.0.0 
#
return
R3:
[R3-ospf-1]dis this
[V200R003C00]
#
ospf 1 router-id 3.3.3.3 
 area 0.0.0.0 
  network 10.123.23.3 0.0.0.0 
  network 10.123.34.3 0.0.0.0 
  network 30.1.1.1 0.0.0.0 
#
return
R4:
[R4-ospf-1]dis this
[V200R003C00]
#
ospf 1 router-id 4.4.4.4 
 area 0.0.0.0 
  network 10.123.34.4 0.0.0.0 
  network 10.123.45.4 0.0.0.0 
  network 40.1.1.1 0.0.0.0 
#
return
R5:
[R5-ospf-1]dis this
[V200R003C00]
#
ospf 1 router-id 5.5.5.5 
 area 0.0.0.0 
  network 10.123.45.5 0.0.0.0 
#
return

在R9上检查路由表

image-20230919105035307

配置MPLS

在R1上配置MPLS

image-20230919110025677

在R2上配置MPLS

image-20230919110212764

在R3上配置MPLS

image-20230919110314888

在R4上配置MPLS

image-20230919110424501

配置MPLS 静态LSP

在R1上配置静态LSP

R1作为ingress设备在去往40.1.1.1/32和 10.123.45.0/24网络时打上标签,同时作为egress设备,当收到标签为201或者205时弹出标签进行路由转发。

[R1]static-lsp ingress 1to4 destination 40.1.1.1 32 nexthop 10.123.12.2 out-labe
l 104
[R1]static-lsp ingress 1to45 destination 10.123.45.0 24 nexthop 10.123.12.2 out-
label 105
[R1]static-lsp egress 4to1 incoming-interface g0/0/0 in-label 201
[R1]static-lsp egress 45to1 incoming-interface g0/0/0 in-label 205

在R2上配置静态LSP

R2作为Transit设备进行标签的交换。

[R2]static-lsp transit 1to4 incoming-interface GigabitEthernet 0/0/0 in-label 10
4 nexthop 10.123.23.3 out-label 204
[R2]static-lsp transit 1to45 incoming-interface GigabitEthernet 0/0/0 in-label 1
05 nexthop 10.123.23.3 out-label 205
[R2]static-lsp transit 4to1 incoming-interface GigabitEthernet0/0/1 in-label 301
 nexthop 10.123.12.1 out-label 201
[R2]static-lsp transit 45to1 incoming-interface GigabitEthernet0/0/1 in-label 30
5  nexthop 10.123.12.1 out-label 205

在R3上配置静态LSP

R3作为Transit设备进行标签交换。

[R3]static-lsp transit 1to4 incoming-interface GigabitEthernet 0/0/0 in-label 20
4 nexthop 10.123.34.4 out-label 304
[R3]static-lsp transit 4to1 incoming-interface GigabitEthernet0/0/1 in-label 401
 nexthop 10.123.23.2 out-label 301
[R3]static-lsp transit 1to45 incoming-interface GigabitEthernet 0/0/0 in-label 2
05 nexthop 10.123.23.3 out-label 305
[R3]static-lsp transit 45to1 incoming-interface GigabitEthernet0/0/1 in-label 40
5 nexthop 10.123.23.2 out-label 305

在R4上配置静态LSP

R4与R1类似,同样既作为ingress设备又作为egress设备。作为ingress设备在去往40.1.1.1/32和 10.123.45.0/24网络时打上标签,同时作为egress设备,当收到标签为201或者205时弹出标签进行路由转发。

[R4]static-lsp egress 1to4 incoming-interface g0/0/0 in-label 304
[R4]static-lsp egress 1to45 incoming-interface g0/0/0 in-label 305
[R4]static-lsp ingress 4to1 destination 10.1.1.1 32 nexthop 10.123.34.3 out-labe
l 401

在R1上查看标签交换路径:

标签路径中有In/Out Label,在mpls中,Out Label为空时,表示该FEC是由本路由器向上游发布标签,该路由器一般是该FEC的egress设备。In Label是指本路由器为某个FEC分配给对端的Out Label标签,当In Label为空时,表示本路由器是该LSP的最上游路由器,一般是ingress设备。

image-20230919113901613

在R2上查看

image-20230919114005814

在R3上查看

image-20230919114040102

在R4上查看

image-20230919114103033

在R1上Ping测试

image-20230919114154599

右键点击R1设备,选择数据抓包中的G0/0/0接口进行抓包。在R1上带环回口ping测试R4的环回口地址。

进入抓包界面,点击源为10.1.1.1,目的地址为40.1.1.1的数据包查看。我们可以观察到,在数据包中存在MPLS的头部,由此,判断出10.1.1.1访问40.1.1.1走的是MPLS的路径。

image-20230919114844462

]]>
<![CDATA[【docker】完成跨主机通信]]> https://www.xiongan.host/index.php/archives/176/ 2022-11-16T10:58:00+08:00 2022-11-16T10:58:00+08:00 admin https://www.xiongan.host 实验要求

掌握利用Docker实现跨主机容器互连的方法。

前置准备

要求实验主机能够连接外网,已经正确安装Docker,并关闭防火墙和selinux,各主机配置信息如表1-1所示。

表1-1 主机配置信息表

主机名IP地址/子网掩码容器名
node1192.168.123.88/24Centos
node2192.168.123.99/24Centos

实验步骤

步骤1:创建跨主机的容器,测试连通性。

1

步骤2:设置域名解析。

2

2

步骤3:安装etcd和flannel服务。

node01需要安装两个服务(etcd、flannel),node02需要安装一个服务(flannel)

3

3

两台节点都需要配置

步骤4:编辑etcd配置文件并启动etcd服务。

node01节点

4

注:1.ETCD_DATA_DIR为etcd数据存放路径 2.ETCD_LISTEN_CLIENT_URLS为监听客户端地址 3.ETCD_NAME为节点名称 4.ETCD_ADVERTISE_CLIENT_URLS为通知etcd服务器

4

步骤5:测试etcd服务。

node01节点:

5

步骤6:设置网络网段。

node01节点:

6

注:查看容器ip

docker inspect 容器名/id | grep IPAddress

步骤7:配置并重启flannel服务。

7

7

步骤8:配置flannel0与docker0之间的网络。(两个节点)

8

8

步骤9:设置防火墙。(两个节点)

两台节点都需要设置防火墙

步骤10:启动容器,测试连通性。(两个节点)

10

10

]]>