centos8 vxlan结合l2tp配置

客户端配置:

#!/bin/bash

# 创建 vxlan11 接口
ip link add vxlan11 type vxlan id 11 dstport 4789 remote 10.0.200.1 local 10.0.200.4 dev ppp0

# 创建 vrf11 虚拟路由转发表
ip link add vrf11 type vrf table 11

# 设置 vrf11 接口为 up 状态
ip link set vrf11 up

# 将 vxlan11 接口加入到 vrf11 虚拟路由转发表中
ip link set vxlan11 master vrf11

# 为 vxlan11 接口添加 IP 地址
ip addr add 172.18.1.3/24 dev vxlan11

# 设置 vxlan11 接口为 up 状态
ip link set vxlan11 up

# 使用vrf11 虚拟路由转发表ping 测试 172.18.1.3
ping 172.18.1.3 -I vrf11

服务端配置:

#!/bin/bash

# 创建 vxlan 接口
ip link add vxlan11 type vxlan id 11 dstport 4789 remote 10.0.200.4 local 10.0.200.1 dev ppp1

# 设置 vxlan 接口为 up 状态
ip link set vxlan11 up

# 创建 vrf11 虚拟路由转发表
ip link add vrf11 type vrf table 11

# 设置 vrf11 接口为 up 状态
ip link set vrf11 up

# 将 vxlan 接口加入到 vrf11 虚拟路由转发表中
ip link set vxlan11 master vrf11

# 为 vxlan 接口添加 IP 地址
ip addr add 172.18.1.2/24 dev vxlan11

# 设置 vxlan 接口为 up 状态
ip link set vxlan11 up

# 显示 vxlan 接口信息
ip -d link show vxlan11

posted @ 2025-03-04 21:58  KuangZhuMing2  阅读(30)  评论(0)    收藏  举报