How to establish IPv6 BGP session with others.

First you should setup a new interface for binding the IPv6 of yours to it, you can write a systemd configuration like this:

/etc/systemd/system/tunnel.service
[Unit]
Description=IPv6 tunnel interface
After=network.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/ip l a dev <interface_name> type dummy
ExecStart=/usr/bin/ip l s <interface_name> up
ExecStart=/usr/bin/ip a a <IPv6 subnet> dev <interface_name>
ExecStop=/usr/bin/ip a d <IPv6 subnet> dev <interface_name>
ExecStop=/usr/bin/ip l s <interface_name> down
ExecStop=/usr/bin/ip l d dev <interface_name> type dummy

[Install]
WantedBy=multi-user.target

Next, you should setup a GRE connection with others like this,

/etc/systemd/system/tunnel-GRE.service
[Unit]
Description=IPv6 tunnel
After=network.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/ip tunnel add <tunnel_name> mode gre remote <remote_IP> local <local_IP> ttl 255
ExecStart=/usr/bin/ip l s <tunnel_name> up mtu 1476
ExecStart=/usr/bin/ip a a <IPv6 address of this side> dev <tunnel_name>
ExecStop=/usr/bin/ip l s <tunnel_name> down
ExecStop=/usr/bin/ip tunnel del <tunnel_name>

[Install]
WantedBy=multi-user.target

Now, you can setup bird6 to finish the process.

router id <IPv4-like ID>;
protocol bgp <BGP name>
{
    local as <local ASN>;
    source address <IPv6 address of your side>;
    import where net ~ [ ::/0 ];
    export where net ~ [ <IPv6 /44 subnet>::/44{44,48} ];
    graceful restart on;
    multihop;
    neighbor <IPv6 address of router side> as <router side ASN>;
    next hop self;
}

protocol static static1
{
    route <one of your IPv6 /48 subnets>::/48 via "<interface_name>";
    route <router IPv6 address>::/48 via "eth0"; 
}

protocol kernel {
        scan time 20;
        import none;
        export all;
}

protocol device {
    scan time 20;
}

protocol direct
{
    interface "<interface_name>";
    import all;
}

Do some cleaning.

systemctl enable bird6.service
systemctl enable tunnel-GRE.service
systemctl enable tunnel.service
systemctl start bird6.service
systemctl start tunnel.service
systemctl start tunnel-GRE.service
anyShare分享到:

1 条评论

昵称
  1. qianqian

    😆 yeah!A new post! prpr 😆