我正在testingBIRD投入生产,以取代我用于路由到AWS站点的几个VPN设备。 我以前从来没有用过BIRD,所以请原谅无知/如果我把一个testingWindows机器后面的这个路由服务器我能够路由到我的亚马逊networking和我的其他networking在本地,但是我不能路由到互联网。
我可以在我的BIRD路由表中看到0.0.0.0/0的条目
bird> show route 0.0.0.0/0 via 204.244.xx on eth1 [kernel1 15:03] * (10) 172.30.0.176/28 dev eth0 [static1 15:07] ! (200) 192.168.120.0/23 via 204.244.xx on eth1 [R1 15:03 from 10.0.0.241] * (100/?) [AS7224i] 172.31.5.80/29 dev eth0 [static1 15:07] ! (200)
这是否会导致172.30.0.176/28networking中使用路由器作为默认网关的服务器路由到互联网? 如果是的话,我怎样才能改变路由,使BIRD不尝试路由互联网stream量,只有内部networking的stream量?
以下是我的configuration:
客户机:IP 172.30.0.188/28网关172.30.0.190
BIRDconfiguration:
# Configure logging log syslog all; log "/var/log/bird.log" all; log stderr all; # Override router ID #router id 10.0.0.245; function avoid_martians() prefix set martians; { martians = [ 169.254.0.0/16+, 224.0.0.0/4+, 240.0.0.0/4+, 0.0.0.0/32-, 0.0.0.0/0{25,32}, 0.0.0.0/0{0,7} ]; # Avoid RFC1918 networks if net ~ martians then return false; return true; } function avoid_crappy_prefixes() { if net.len < 8 then return false; if net.len > 24 then return false; return true; } filter bgp_out { if net = 192.168.120.0/23 then accept; else reject; } filter bgp_in { if avoid_martians() && avoid_crappy_prefixes() then accept; else reject; } # Sync bird routing table with kernel protocol kernel { learn; persist; scan time 20; export all; } # Include device route (warning, a device route is a /32) protocol device { scan time 10; } protocol static { route 172.30.0.176/28 via "eth0"; route 172.31.5.80/29 via "eth0"; } protocol bgp R1 { local as 65200; neighbor 10.0.0.241 as 65100; multihop; import filter bgp_in; export filter bgp_out; }
路由器接口configuration
# The loopback network interface auto lo iface lo inet loopback # Internal Network auto eth0 iface eth0 inet static address 172.30.0.190 netmask 255.255.255.240 # External Network auto eth1 iface eth1 inet static address 204.244.xx netmask 255.255.255.128 gateway 204.244.xy # BGP Router IP auto eth1:1 iface eth1:1 inet static address 10.0.0.245 netmask 255.255.255.252 # DAG Network IP auto eth0:1 iface eth0:1 inet static address 172.29.0.126 netmask 255.255.255.240 # Test network IP auto eth0:2 iface eth0:2 inet static address 172.31.5.81 netmask 255.255.255.248
我已经设法解决我的问题。 这里的问题是一个NAT。 路由器是通过到互联网的stream量不是在路由器的公共IP,而是作为机器的内部IP,这显然是为什么它不工作。 通过添加networking的NAT规则,我解决了这个问题。