Let me give you some background.
1. There are 2 hosts connected by wire (so that they are L2 reachable), one with IPv4 10.22.12.88, and another is 10.22.12.44. Here's one the arp record from "ip neigh sh":
10.22.12.88 dev bond0 lladdr f8:6e:ee:8b:cf:90 REACHABLE
2. Both 2 hosts have some KVM virtual machines, with corresponding routes from host to vm, here's one of the routes from "ip r":
10.233.25.178 dev yap35caa1e88854 scope link src 10.22.12.44
The 10.233.25.178 is the address of a VM, and the dev yap35caa1e88854 is a tap device connecting eth0 inside the VM.
What I want to do is to build routes between these 2 hosts, in order to let VMs on host A be able to connect VMs on host B.
Hope I make myself clear.
So I'm using BIRD 2.0.3 on Ubuntu 16.04, with the config file as follows:
log syslog all;
router id 10.22.12.44;
protocol device {
debug { states };
scan time 2;
}
protocol kernel {
learn;
persist;
scan time 10;
ipv4 {
import all;
export all;
};
}
protocol bgp {
debug { states };
local as 65000;
neighbor 10.22.12.88 as 65000;
source address 10.22.12.44;
multihop;
ipv4 {
export filter {
if ( net ~ 10.233.0.0/16 ) then {
accept;
}
reject;
};
import all;
next hop self on;
gateway recursive;
add paths on;
};
}
But this doesn't work well, the peer BIRD show the info as follows:
bird> show route protocol bgp1
Table master4:
10.233.25.178/32 unicast [bgp1 18:47:32.910 from 10.22.12.44] * (100/?) [i]
via 10.22.12.1 on enp2s0f0 onlink
bird> show route export kernel1
Table master4:
10.233.25.178/32 unicast [bgp1 18:47:32.910 from 10.22.12.44] * (100/?) [i]
via 10.22.12.1 on enp2s0f0 onlink
The problem happened on the gateway, I was hoping the routes should have "via 10.22.12.44" instead of "via 10.22.12.1";
10.22.12.1 came from the host default gateway:
default via 10.22.12.1 dev bond0 onlink
But I have no idea how to prevent BIRD from using it.
The other information may be helpful is included below:
bird> show protocols all bgp1
Name Proto Table State Since Info
bgp1 BGP --- up 18:28:46.888 Established
BGP state: Established
Neighbor address: 10.22.12.88
Neighbor AS: 65000
Neighbor ID: 10.22.12.88
Local capabilities
Multiprotocol
AF announced: ipv4
Route refresh
Graceful restart
4-octet AS numbers
ADD-PATH
RX: ipv4
TX: ipv4
Enhanced refresh
Long-lived graceful restart
Neighbor capabilities
Multiprotocol
AF announced: ipv4
Route refresh
Graceful restart
4-octet AS numbers
Enhanced refresh
Long-lived graceful restart
Session: internal multihop AS4
Source address: 10.22.12.44
Hold timer: 117.086/240
Keepalive timer: 52.520/80
Channel ipv4
State: UP
Table: master4
Preference: 100
Input filter: ACCEPT
Output filter: (unnamed)
Routes: 2 imported, 20 exported
Route change stats: received rejected filtered ignored accepted
Import updates: 2 0 0 0 2
Import withdraws: 0 0 --- 0 0
Export updates: 49 6 23 --- 20
Export withdraws: 0 --- --- --- 4
BGP Next hop: 10.22.12.44
IGP IPv4 table: master4
bird> show route export bgp1
Table master4:
10.233.25.178/32 unicast [kernel1 18:04:09.483] (10)
dev yap35caa1e88854
Please enlighten me with some advice, and I'll appreciate that very much.
Thank you!