Problem solved. I find it Kernel protocol with learn may generate these routes, but there is an exception for device routes in sysdep/linux/netlink/netlink.c:848 :
/* * In Linux IPv6, 'native' device routes have proto * RTPROT_BOOT and not RTPROT_KERNEL (which they have in * IPv4 and which is expected). We cannot distinguish * 'native' and user defined device routes, so we ignore all * such device routes and for consistency, we have the same * behavior in IPv4. Anyway, users should use RTPROT_STATIC * for their 'alien' routes. */ if (i->rtm_protocol == RTPROT_BOOT) src = KRT_SRC_KERNEL; If you remove these two lines and recompile BIRD, you could probably be able to import device routes. Vladislav Grishin After I restart bird proxmox-host1:/var/log# tail /var/log/debug Feb 22 14:59:09 proxmox-host1 bird: kernel1: Pruning inherited routes Feb 22 14:59:11 proxmox-host1 bird: device1: Scanning interfaces Feb 22 14:59:11 proxmox-host1 bird: kernel1: Scanning routing table Feb 22 14:59:11 proxmox-host1 bird: kernel1: 10.18.1.25/32: ignored <------ Feb 22 14:59:11 proxmox-host1 bird: kernel1: 10.18.1.26/32: ignored <------ Feb 22 14:59:11 proxmox-host1 bird: kernel1: 0.0.0.0/0: [alien] seen Feb 22 14:59:11 proxmox-host1 bird: kernel1: Pruning table master Feb 22 14:59:11 proxmox-host1 bird: kernel1: 10.16.1.0/24: reinstalling Feb 22 14:59:11 proxmox-host1 bird: kernel1: 10.17.1.0/24: reinstalling Feb 22 14:59:11 proxmox-host1 bird: kernel1: Pruning inherited routes proxmox-host1:/var/log# Vladislav Grishin -----Original Message----- From: owner-bird-us...@atrey.karlin.mff.cuni.cz [mailto:owner-bird-us...@atrey.karlin.mff.cuni.cz] On Behalf Of Владислав Гришин Sent: Wednesday, February 22, 2012 1:23 PM To: bird-us...@trubka.network.cz Subject: How redistribute routes from kernel table to OSPF protocol? 1. Routes into kernel routing table proxmox-host1:/# ip ro list 10.18.1.25 dev venet0 scope link 10.18.1.26 dev venet0 scope link 10.16.1.0/24 dev vmbr0 proto kernel scope link src 10.16.1.27 10.17.1.0/24 dev eth1 proto kernel scope link src 10.17.1.27 default via 10.16.1.1 dev vmbr0 proxmox-host1:/# 2. Bird Config file filter export_OSPF { # redistribute connected if ( source = RTS_DEVICE ) then { print "net accepted:", net; ospf_metric2 = 20; accept; } # redistribute static if ( source = RTS_STATIC_DEVICE ) then { print "net accepted:", net; ospf_metric2 = 20; accept; } if ( source = RTS_STATIC ) then { print "net accepted:", net; ospf_metric2 = 20; accept; } reject; } filter import_OSPF { if ( source = RTS_OSPF_EXT2 && net != 0.0.0.0/0 ) then { print "net accepted:", net; accept; } reject; } protocol direct { interface "eth1"; interface "venet0"; } protocol kernel { # table main; learn; # Learn all alien routes from the kernel device routes; # persist off; # Don't remove routes on bird shutdown # scan time 20; # Scan kernel routing table every 20 seconds scan time 2; # Scan kernel routing table every 60 seconds import all; # Default is import all export all; # Default is export none # kernel table 5; # Kernel table to synchronize with (default: main) } protocol ospf myospf { router id 10.17.1.27; debug all; export filter export_OSPF; import filter import_OSPF; area 0.0.0.0 { interface "eth1" { hello 10; retransmit 5; cost 10; transmit delay 1; dead count 4; wait 40; type broadcast; priority 0; authentication cryptographic; password "ХХХХХХХХХХ"; }; }; } 3. Output bird console bird> show route all 0.0.0.0/0 via 10.16.1.1 on vmbr0 [kernel1 2012-02-22 12:47:54] * (10) Type: inherit unicast univ 10.16.1.0/24 via 10.17.1.28 on eth1 [myospf 2012-02-22 12:48:04] * E2 (150/10/20) [10.17.1.28] Type: OSPF-boundary unicast univ OSPF.metric1: 10 OSPF.metric2: 20 OSPF.tag: 0x00000000 OSPF.router_id: 10.17.1.28 10.17.1.0/24 dev eth1 [direct1 2012-02-22 12:47:54] * (240) Type: device unicast univ bird> But I don't see these routes in a bird 10.18.1.25 dev venet0 scope link 10.18.1.26 dev venet0 scope link (Only default route present from kernel.) It is necessary to declare these routes to OSPF neighbors. Vladislav Grishin