niammuddin icon

example routing bgp

niammuddin | PRO | 05/07/23 12:34:29 AM UTC (Edited) | 0 ⭐ | 1798 👁️ | Never ⏰ | []
JSON |

4.91 KB

|

None

|

0 👍

/

0 👎

interfaces {
    ethernet eth0 {
        hw-id 50:00:00:09:00:00
        vif 10 {
            address 105.10.10.2/30
            traffic-policy {
                out UPLOAD
            }
        }
        vif 20 {
            address 105.20.20.2/30
        }
    }
    ethernet eth1 {
        hw-id 50:00:00:09:00:01
    }
    ethernet eth2 {
        address 101.1.1.1/24
        hw-id 50:00:00:09:00:02
    }
    ethernet eth3 {
        address 101.1.2.1/24
        hw-id 50:00:00:09:00:03
        traffic-policy {
            out DOWNLOAD
        }
    }
    loopback lo {
    }
}
policy {
    prefix-list AS10-OUT {
        rule 10 {
            action permit
            prefix 101.1.1.0/24
        }
        rule 20 {
            action permit
            prefix 101.1.2.0/24
        }
        rule 30 {
            action deny
            prefix 0.0.0.0/0
        }
    }
    prefix-list AS20-OUT {
        rule 10 {
            action permit
            prefix 101.1.1.0/24
        }
        rule 20 {
            action permit
            prefix 101.1.2.0/24
        }
        rule 30 {
            action deny
            prefix 0.0.0.0/0
        }
    }
    route-map AS10-IN {
        rule 10 {
            action permit
            set {
                local-preference 100
            }
        }
    }
    route-map AS10-OUT {
        rule 10 {
            action permit
            match {
                ip {
                    address {
                        prefix-list AS10-OUT
                    }
                }
            }
            set {
                as-path-prepend 4
            }
        }
        rule 20 {
            action deny
        }
    }
    route-map AS20-IN {
        rule 10 {
            action permit
            set {
                local-preference 300
            }
        }
    }
    route-map AS20-OUT {
        rule 10 {
            action permit
            match {
                ip {
                    address {
                        prefix-list AS20-OUT
                    }
                }
            }
        }
        rule 20 {
            action deny
        }
    }
}
protocols {
    bgp 101 {
        address-family {
            ipv4-unicast {
                network 101.1.1.0/24 {
                }
                network 101.1.2.0/24 {
                }
            }
        }
        neighbor 105.10.10.1 {
            address-family {
                ipv4-unicast {
                    route-map {
                        export AS10-OUT
                        import AS10-IN
                    }
                }
            }
            remote-as 10
        }
        neighbor 105.20.20.1 {
            address-family {
                ipv4-unicast {
                    route-map {
                        export AS20-OUT
                        import AS20-IN
                    }
                }
            }
            remote-as 20
        }
        parameters {
            router-id 101.1.1.1
        }
    }
    static {
        route 0.0.0.0/0 {
            next-hop 105.10.10.1 {
                disable
            }
        }
    }
}
system {
    config-management {
        commit-revisions 100
    }
    conntrack {
        modules {
            ftp
            h323
            nfs
            pptp
            sip
            sqlnet
            tftp
        }
    }
    console {
        device ttyS0 {
            speed 115200
        }
    }
    host-name vyos
    login {
        user vyos {
            authentication {
                encrypted-password ****************
                plaintext-password ****************
            }
        }
    }
    ntp {
        server time1.vyos.net {
        }
        server time2.vyos.net {
        }
        server time3.vyos.net {
        }
    }
    syslog {
        global {
            facility all {
                level info
            }
            facility protocols {
                level debug
            }
        }
    }
}
traffic-policy {
    shaper DOWNLOAD {
        bandwidth 1gbit
        class 20 {
            bandwidth 10mbit
            match DESTINATION-IP {
                ip {
                    destination {
                        address 101.1.2.2/32
                    }
                }
            }
            queue-type fq-codel
        }
        default {
            bandwidth 100%
        }
    }
    shaper UPLOAD {
        bandwidth 1gbit
        class 10 {
            bandwidth 10mbit
            match SOURCE-IP {
                ip {
                    source {
                        address 101.1.2.2/32
                    }
                }
            }
            queue-type fq-codel
        }
        default {
            bandwidth 100%
        }
    }
}

Comments