Unable to ping on BGP route

I have configured BGP on 3 vyos virtualmachines. All those machines have the following interfaces:

BGP 1:

  • eth0 = 192.168.57.192/24
  • eth1 = 192.168.56.192/24
  • eth2 = 1.1.1.1/24

BGP 2:

  • eth0 = 4.4.4.2/24
  • eth1 = 192.168.56.222/24
  • eth2 = 2.2.2.2/24

BGP 3:

  • eth0 = 192.168.57.3/24
  • eth1 = 4.4.4.3/24
  • eth2 = 3.3.3.3/24
                                  eth2 int 3.3.3.3
                                           |
                                           | 
           eth0 192.168.57.3 -----------  BGP3  ----------- eth1 int 4.4.4.3
                 /                                                \
                /                                                  \ 
    eth0 192.168.57.192                                       eth0 int 4.4.4.2
         BGP1 -- eth1 192.168.56.192 ------ eth1 192.168.56.222 -- BGP2
           |                                                         |
           |                                                         |
     eth2 1.1.1.1                                              eth2 2.2.2.2

I would like to route all traffic from and to BGP 1 past BGP 3. I’ve already tried to configure internal BGP and just a static route to route the traffic to BGP 3.
set protocols static route 2.2.2.0/24 next-hop 192.168.57.3

Currently I’m using eBGP with the following confugiration:

BGP 1:

interfaces {
    ethernet eth0 {
        address 192.168.57.192/24
        duplex auto
        hw-id 08:00:27:54:bd:82
        smp-affinity auto
        speed auto
    }
    ethernet eth1 {
        address 192.168.56.192/24
        duplex auto
        hw-id 08:00:27:3d:87:67
        smp-affinity auto
        speed auto
    }
    ethernet eth2 {
        address 1.1.1.1/24
        duplex auto
        hw-id 08:00:27:2a:c0:ee
        smp-affinity auto
        speed auto
    }
    loopback lo {
    }
}
protocols {
    bgp 1 {
        address-family {
            ipv4-unicast {
                network 1.1.1.0/24 {
                }
            }
        }
        neighbor 192.168.56.222 {
            password BGP
            remote-as 2
        }
        neighbor 192.168.57.3 {
            password BGP
            remote-as 3
        }
    }
}
service {
    ssh {
    }
}
system {
    config-management {
        commit-revisions 100
    }
    console {
        device ttyS0 {
            speed 115200
        }
    }
    host-name BGP1
    login {
        user vyos {
            authentication {
                encrypted-password $6$QxPS.uk6mfo$9QBSo8u1FkH16gMyAVhus6fU3LOzvLR9Z9.82m3tiHFAxTtIkhaZSWssSgzt4v4dGAL8rhVQxTg0oAG9/q11h/
                plaintext-password ""
            }
            level admin
        }
    }
    ntp {
        server 0.pool.ntp.org {
        }
        server 1.pool.ntp.org {
        }
        server 2.pool.ntp.org {
        }
    }
    syslog {
        global {
            facility all {
                level info
            }
            facility protocols {
                level debug
            }
        }
    }
    time-zone UTC
}

BGP 2:

interfaces {
    ethernet eth0 {
        address 4.4.4.2/24
        duplex auto
        hw-id 08:00:27:6e:8e:66
        smp-affinity auto
        speed auto
    }
    ethernet eth1 {
        address 192.168.56.222/24
        duplex auto
        hw-id 08:00:27:c8:fe:ef
        smp-affinity auto
        speed auto
    }
    ethernet eth2 {
        address 2.2.2.2/24
        duplex auto
        hw-id 08:00:27:a9:fc:4c
        smp-affinity auto
        speed auto
    }
    loopback lo {
    }
}
protocols {
    bgp 2 {
        address-family {
            ipv4-unicast {
                network 2.2.2.0/24 {
                }
            }
        }
        neighbor 4.4.4.3 {
            password BGP
            remote-as 3
        }
        neighbor 192.168.56.192 {
            password BGP
            remote-as 1
        }
    }
}
service {
    ssh {
    }
}
system {
    config-management {
        commit-revisions 100
    }
    console {
        device ttyS0 {
            speed 115200
        }
    }
    host-name BGP2
    login {
        user vyos {
            authentication {
                encrypted-password $6$QxPS.uk6mfo$9QBSo8u1FkH16gMyAVhus6fU3LOzvLR9Z9.82m3tiHFAxTtIkhaZSWssSgzt4v4dGAL8rhVQxTg0oAG9/q11h/
                plaintext-password ""
            }
            level admin
        }
    }
    ntp {
        server 0.pool.ntp.org {
        }
        server 1.pool.ntp.org {
        }
        server 2.pool.ntp.org {
        }
    }
    syslog {
        global {
            facility all {
                level info
            }
            facility protocols {
                level debug
            }
        }
    }
    time-zone UTC
}

BGP 3:

interfaces {
    ethernet eth0 {
        address 192.168.57.3/24
        duplex auto
        hw-id 08:00:27:f1:37:ee
        smp-affinity auto
        speed auto
    }
    ethernet eth1 {
        address 4.4.4.3/24
        duplex auto
        hw-id 08:00:27:62:03:1e
        smp-affinity auto
        speed auto
    }
    ethernet eth2 {
        address 3.3.3.3/24
        duplex auto
        hw-id 08:00:27:c6:71:27
        smp-affinity auto
        speed auto
    }
    loopback lo {
    }
}
protocols {
    bgp 3 {
        address-family {
            ipv4-unicast {
                network 3.3.3.0/24 {
                }
            }
        }
        neighbor 4.4.4.2 {
            password BGP
            remote-as 2
        }
        neighbor 192.168.57.192 {
            password BGP
            remote-as 1
        }
    }
}
service {
    ssh {
    }
}
system {
    config-management {
        commit-revisions 100
    }
    console {
        device ttyS0 {
            speed 115200
        }
    }
    host-name BGP3
    login {
        user vyos {
            authentication {
                encrypted-password $6$QxPS.uk6mfo$9QBSo8u1FkH16gMyAVhus6fU3LOzvLR9Z9.82m3tiHFAxTtIkhaZSWssSgzt4v4dGAL8rhVQxTg0oAG9/q11h/
                plaintext-password ""
            }
            level admin
        }
    }
    ntp {
        server 0.pool.ntp.org {
        }
        server 1.pool.ntp.org {
        }
        server 2.pool.ntp.org {
        }
    }
    syslog {
        global {
            facility all {
                level info
            }
            facility protocols {
                level debug
            }
        }
    }
    time-zone UTC
}

All the routes are advertised and the route to BGP 3 is set with a higher weight to use this route
set protocols bgp 1 neighbor 192.168.57.3 address-family ipv4-unicast weight 40

BGP 1:

BGP table version is 5, local router ID is 192.168.57.192, vrf id 0
Default local pref 100, local AS 1
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       0.0.0.0                  0         32768 i
*> 2.2.2.0/24       192.168.57.3                          40 3 2 i
*                   192.168.56.222           0             0 2 i
*  3.3.3.0/24       192.168.56.222                         0 2 3 i
*>                  192.168.57.3             0            40 3 i

Displayed  3 routes and 5 total paths

But when I try to ping to 2.2.2.2 nothing happens and I receive no response. Ping is working with the direct interface to BGP 2 but not through BGP 3.

traceroute to 2.2.2.2 (2.2.2.2), 30 hops max, 60 byte packets
 1  192.168.57.3 (192.168.57.3)  0.505 ms  0.489 ms  0.459 ms
 2  * * *
 3  * * *
 4  * * *
....

Hi @Sam_G
Try this ping

ping 2.2.2.2 interface 1.1.1.1

Hi @Viacheslav

This ping works, I can ping with ping 2.2.2.2 interface eth1 but the ping goes directly to BGP 2 instead of passing through BGP 3.

Everything from BGP 1 should go through BGP 3 and when I ping
ping 2.2.2.2 interface eth0 (interface to BGP 3), nothing happens.

@Sam_G
It’s doesn’t work because you ping from source ip address 192.168.57.192
But R2 doesn’t know anything about this network (192.168.57.x) but know network 1.1.1.0/24

@Viacheslav That’s it! Thanks a lot!

I’ve added 192.168.57.0 as a static route on BGP 2.
set protocols static route 192.168.57.0/24 next-hop 4.4.4.3
I’m now able to ping 2.2.2.2 and traceroute to confirm that the traffic goes through BGP 3.

vyos@BGP1:~$ traceroute 2.2.2.2
traceroute to 2.2.2.2 (2.2.2.2), 30 hops max, 60 byte packets
 1  192.168.57.3 (192.168.57.3)  0.401 ms  0.381 ms  0.368 ms
 2  2.2.2.2 (2.2.2.2)  0.712 ms  0.707 ms  0.697 ms

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.