迷失在IT路上 2024-08-27 17:19 采纳率: 0%
浏览 3
已结题

ZeroTier和bird

腾讯云vpc1(10.255.1.0/24):
服务器A(centos7.9) vpc网卡eth0 10.255.1.5 ZeroTier网卡 ztadhvb6qh 10.200.201.60
服务器B eth0 10.255.1.6

阿里云vpc2(10.2.1.0/24)
服务器C(centos7.9) vpc网卡eth0 10.2.1.48 ZeroTier网卡 ztadhvb6qh 10.200.201.231
服务器D eth0 10.2.1.43

只有服务器A和服务器C 安装ZeroTier,ZeroTier 网段10.200.201.0/24, 服务器A 和 服务器C 已经 可以实现使用ZeroTier网卡IP互PING
服务器B和D不安装ZeroTier和bird, 怎么在只有服务器A和服务器C 配置bird(2+版本)后
实现服务器B 10.255.1.6和服务器D 10.2.1.43 内网IP通信

想实现这么一个场景, 我这边最终还是没有实现服务器B 10.255.1.6和服务器D 10.2.1.43 内网IP通信
只实现了 我这边最终还是没有实现服务器A 10.255.1.5 和服务器C 10.255.1.6 内网IP通信

bird.conf如下



```bash
log "/var/log/bird.log" { debug, trace, info, remote, warning, error, auth, fatal, bug };

router id 10.255.1.5;  # 设置Router ID为A的VPC网卡IP

protocol device {
  scan time 10;
}

protocol direct {
  ipv4;
  ipv6;
}

protocol kernel {
 ipv4 {   # Connect protocol to IPv4 table by channel
       table master4; # Default IPv4 table is master4
       import all; # Import to table, default is import all
       export all;
 };
 learn;   # Learn alien routes from the kernel
 scan time 2;
 graceful restart;
 merge paths on;
}

protocol kernel {
 ipv6 { export all; };
 merge paths on;
}

protocol bgp TX {
  description "Connection to BGP peer";
  local as 65001;  # A的AS编号
  neighbor 10.200.201.231 as 65002;  # C的ZeroTier IP和AS编号
  multihop;
  graceful restart;  # See comment in kernel section about graceful restart.
  connect delay time 2;
  connect retry time 5;
  error wait time 5,30;
  ipv4 {
     next hop self;
     gateway recursive; # This should be the default, but just in case.
     import filter {
    accept;
     };
     export all;
  };
}

```

  • 写回答

1条回答 默认 最新

  • 吃不了席 2024-08-27 17:20
    关注

    以下回复参考:皆我百晓生券券喵儿等免费微信小程序作答:

    要实现服务器B(10.255.1.6)和服务器D(10.2.1.43)之间的内网IP通信,需要在服务器A和服务器C上配置bird路由协议。以下是配置步骤:

    1. 在服务器A和服务器C上安装bird路由软件。

    2. 修改bird配置文件(例如:/etc/bird/bird.conf),添加以下内容:

    log "/var/log/bird.log" { debug, trace, info, remote, warning, error, auth, fatal, bug };
    
    router id 10.255.1.5;  # 设置Router ID为A的VPC网卡IP
    protocol device {
      scan time 10;
    }
    
    protocol direct {
      ipv4;
      ipv6;
    }
    
    protocol kernel {
     ipv4 {   # Connect protocol to IPv4 table by channel
           table master4; # Default IPv4 table is master4
           import all; # Import to table, default is import all
           export all;
     };
     learn;   # Learn alien routes from the kernel
     scan time 2;
     graceful restart;
     merge paths on;
    }
    
    protocol kernel {
     ipv6 { export all; };
     merge paths on;
    }
    
    protocol bgp TX {
      description "Connection to BGP peer";
      local as 65001;  # A的AS编号
      neighbor 10.200.201.231 as 65002;  # C的ZeroTier IP和AS编号
      multihop;
      graceful restart;  # See comment in kernel section about graceful restart.
      connect delay time 2;
      connect retry time 5;
      error wait time 5,30;
      ipv4 {
         next hop self;
         gateway recursive; # This should be the default, but just in case.
         import filter {
        accept;
         };
         export all;
      };
    }
    
    1. 保存配置文件并重启bird服务。

    2. 在服务器A和服务器C上执行以下命令,添加路由规则:

    birdc -d add route <目标网络> via <下一跳IP>
    

    例如,在服务器A上添加如下路由规则:

    birdc -d add route 10.2.1.0/24 via 10.200.201.231
    

    在服务器C上添加如下路由规则:

    birdc -d add route 10.255.1.0/24 via 10.200.201.60
    
    1. 确保服务器A和服务器C之间的ZeroTier连接正常,然后尝试从服务器B和服务器D之间进行ping测试,看是否能够实现内网IP通信。
    评论

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 8月27日
  • 创建了问题 8月27日