Linux-PE-RR
os:ubuntu-17.10
zebra的ospfd用于Lo(5.5.5.5)和其他PE的Lo可达
gobgp用于Lo和其他PE的Lo建立MP-IBGP邻居
root@ubuntu:~# cat /etc/apt/sources.list
deb http://mirrors.163.com/ubuntu/ artful main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ artful-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ artful-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ artful-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ artful-backports main restricted universe multiverse
root@ubuntu:~# apt update
root@ubuntu:~# apt install gobgpd -y
root@ubuntu:~# apt install quagga -y
root@ubuntu:~# touch /etc/quagga/ospfd.conf
root@ubuntu:~# touch /etc/quagga/zebra.conf
root@ubuntu:~# chown quagga.quagga /etc/quagga/*.conf
root@ubuntu:~# cat /etc/quagga/ospfd.conf
router ospf
ospf router-id 5.5.5.5
network 5.5.5.5/32 area 0.0.0.0
network 10.0.5.0/24 area 0.0.0.0
root@ubuntu:~# ip add li ens4 | grep inet
inet 10.0.5.1/24 scope global ens4
root@ubuntu:~# ip add li lo | grep inet
inet 127.0.0.1/8 scope host lo
inet 5.5.5.5/32 scope global lo
编辑gobgpd.conf配置文件
root@ubuntu:~# cat /etc/gobgp/gobgpd.conf
[global]
[global.config]
as = 65000
router-id = "5.5.5.5"
[[neighbors]]
[neighbors.config]
neighbor-address = "1.1.1.1"
peer-as = 65000
[neighbors.route-reflector.config]
route-reflector-client = true
route-reflector-cluster-id = "5.5.5.5"
[[neighbors.afi-safis]]
[neighbors.afi-safis.config]
afi-safi-name = "l3vpn-ipv4-unicast"
[[neighbors]]
[neighbors.config]
neighbor-address = "2.2.2.2"
peer-as = 65000
[neighbors.route-reflector.config]
route-reflector-client = true
route-reflector-cluster-id = "5.5.5.5"
[[neighbors.afi-safis]]
[neighbors.afi-safis.config]
afi-safi-name = "l3vpn-ipv4-unicast"
[[neighbors]]
[neighbors.config]
neighbor-address = "3.3.3.3"
peer-as = 65000
[neighbors.route-reflector.config]
route-reflector-client = true
route-reflector-cluster-id = "5.5.5.5"
[[neighbors.afi-safis]]
[neighbors.afi-safis.config]
afi-safi-name = "l3vpn-ipv4-unicast"
[[neighbors]]
[neighbors.config]
neighbor-address = "4.4.4.4"
peer-as = 65000
[neighbors.route-reflector.config]
route-reflector-client = true
route-reflector-cluster-id = "5.5.5.5"
[[neighbors.afi-safis]]
[neighbors.afi-safis.config]
afi-safi-name = "l3vpn-ipv4-unicast"
启动ospfd和gobgpd
root@ubuntu:~# gobgpd -f /etc/gobgp/gobgpd.conf &
root@ubuntu:~# systemctl start ospfd
root@ubuntu:~# systemctl start zebra
#########VMX-P的配置###############
set version 14.1R4.8
set system root-authentication encrypted-password "$1$gQsE5emV$YKl79HDHgraX5dofhGZj8."
set system syslog user * any emergency
set system syslog file messages any notice
set system syslog file messages authorization info
set system syslog file interactive-commands interactive-commands any
set interfaces ge-0/0/0 unit 0 family inet address 10.0.1.254/24
set interfaces ge-0/0/0 unit 0 family mpls
set interfaces ge-0/0/1 unit 0 family inet address 10.0.2.254/24
set interfaces ge-0/0/1 unit 0 family mpls
set interfaces ge-0/0/2 unit 0 family inet address 10.0.3.254/24
set interfaces ge-0/0/2 unit 0 family mpls
set interfaces ge-0/0/3 unit 0 family inet address 10.0.4.254/24
set interfaces ge-0/0/3 unit 0 family mpls
set interfaces ge-0/0/4 unit 0 family inet address 10.0.5.254/24
set interfaces ge-0/0/4 unit 0 family mpls
set interfaces lo0 unit 0 family inet address 10.10.10.10/32
set routing-options router-id 10.10.10.10
set protocols mpls interface ge-0/0/0.0
set protocols mpls interface ge-0/0/1.0
set protocols mpls interface ge-0/0/2.0
set protocols mpls interface ge-0/0/3.0
set protocols mpls interface ge-0/0/4.0
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0
set protocols ospf area 0.0.0.0 interface ge-0/0/2.0
set protocols ospf area 0.0.0.0 interface ge-0/0/3.0
set protocols ospf area 0.0.0.0 interface ge-0/0/4.0
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols ldp interface ge-0/0/0.0
set protocols ldp interface ge-0/0/1.0
set protocols ldp interface ge-0/0/2.0
set protocols ldp interface ge-0/0/3.0
set protocols ldp interface ge-0/0/4.0
#######VMX-PE1的配置######################
set version 14.1R4.8
set system host-name VMX-PE1
set system root-authentication encrypted-password "$1$PDALzLQM$7sa4xnKY/CG9Z4gGDRooI0"
set system syslog user * any emergency
set system syslog file messages any notice
set system syslog file messages authorization info
set system syslog file interactive-commands interactive-commands any
set interfaces ge-0/0/0 unit 0 family inet address 10.0.1.1/24
set interfaces ge-0/0/0 unit 0 family mpls
set interfaces ge-0/0/1 unit 0 family inet address 192.168.1.254/24
set interfaces lo0 unit 0 family inet address 1.1.1.1/32
set routing-options router-id 1.1.1.1
set routing-options autonomous-system 65000
set protocols mpls interface ge-0/0/0.0
set protocols bgp group PE-PE type internal
set protocols bgp group PE-PE local-address 1.1.1.1
set protocols bgp group PE-PE family inet-vpn unicast
set protocols bgp group PE-PE neighbor 5.5.5.5
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols ldp interface ge-0/0/0.0
set routing-instances VRF1 instance-type vrf
set routing-instances VRF1 interface ge-0/0/1.0
set routing-instances VRF1 route-distinguisher 1.1.1.1:1
set routing-instances VRF1 vrf-target target:65000:1
set routing-instances VRF1 protocols bgp group PE-CE type external
set routing-instances VRF1 protocols bgp group PE-CE local-address 192.168.1.254
set routing-instances VRF1 protocols bgp group PE-CE neighbor 192.168.1.1 peer-as 65001
########VMX-PE2的配置#####################
set version 14.1R4.8
set system host-name VMX-PE2
set system root-authentication encrypted-password "$1$CT8eKT4/$6KoQkGBVblWjaXduDGCTO0"
set system syslog user * any emergency
set system syslog file messages any notice
set system syslog file messages authorization info
set system syslog file interactive-commands interactive-commands any
set interfaces ge-0/0/0 unit 0 family inet address 10.0.2.1/24
set interfaces ge-0/0/0 unit 0 family mpls
set interfaces ge-0/0/1 unit 0 family inet address 192.168.2.254/24
set interfaces lo0 unit 0 family inet address 2.2.2.2/32
set routing-options router-id 2.2.2.2
set routing-options autonomous-system 65000
set protocols mpls interface ge-0/0/0.0
set protocols bgp group PE-PE type internal
set protocols bgp group PE-PE local-address 2.2.2.2
set protocols bgp group PE-PE family inet-vpn unicast
set protocols bgp group PE-PE neighbor 5.5.5.5
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols ldp interface ge-0/0/0.0
set routing-instances VRF1 instance-type vrf
set routing-instances VRF1 interface ge-0/0/1.0
set routing-instances VRF1 route-distinguisher 2.2.2.2:1
set routing-instances VRF1 vrf-target target:65000:1
set routing-instances VRF1 protocols bgp group PE-CE type external
set routing-instances VRF1 protocols bgp group PE-CE local-address 192.168.2.254
set routing-instances VRF1 protocols bgp group PE-CE neighbor 192.168.2.1 peer-as 65002
##############VMX-PE3的配置################
set version 14.1R4.8
set system host-name VMX-PE3
set system root-authentication encrypted-password "$1$ci.Wd2VV$Mi.R0/P7Sa3JcJkrm2Vuv0"
set system syslog user * any emergency
set system syslog file messages any notice
set system syslog file messages authorization info
set system syslog file interactive-commands interactive-commands any
set interfaces ge-0/0/0 unit 0 family inet address 10.0.3.1/24
set interfaces ge-0/0/0 unit 0 family mpls
set interfaces ge-0/0/1 unit 0 family inet address 192.168.3.254/24
set interfaces lo0 unit 0 family inet address 3.3.3.3/32
set routing-options router-id 3.3.3.3
set routing-options autonomous-system 65000
set protocols mpls interface ge-0/0/0.0
set protocols bgp group PE-PE type internal
set protocols bgp group PE-PE local-address 3.3.3.3
set protocols bgp group PE-PE family inet-vpn unicast
set protocols bgp group PE-PE neighbor 5.5.5.5
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols ldp interface ge-0/0/0.0
set routing-instances VRF1 instance-type vrf
set routing-instances VRF1 interface ge-0/0/1.0
set routing-instances VRF1 route-distinguisher 3.3.3.3:1
set routing-instances VRF1 vrf-target target:65000:1
set routing-instances VRF1 protocols bgp group PE-CE type external
set routing-instances VRF1 protocols bgp group PE-CE local-address 192.168.3.254
set routing-instances VRF1 protocols bgp group PE-CE neighbor 192.168.3.1 peer-as 65003
#############VMX-PE4的配置#################
set version 14.1R4.8
set system host-name VMX-PE4
set system root-authentication encrypted-password "$1$TuNrotp/$/3NLB7HAPp2qTksnJAHTy0"
set system syslog user * any emergency
set system syslog file messages any notice
set system syslog file messages authorization info
set system syslog file interactive-commands interactive-commands any
set interfaces ge-0/0/0 unit 0 family inet address 10.0.4.1/24
set interfaces ge-0/0/0 unit 0 family mpls
set interfaces ge-0/0/1 unit 0 family inet address 192.168.4.254/24
set interfaces lo0 unit 0 family inet address 4.4.4.4/32
set routing-options router-id 4.4.4.4
set routing-options autonomous-system 65000
set protocols mpls interface ge-0/0/0.0
set protocols bgp group PE-PE type internal
set protocols bgp group PE-PE local-address 4.4.4.4
set protocols bgp group PE-PE family inet-vpn unicast
set protocols bgp group PE-PE neighbor 5.5.5.5
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols ldp interface ge-0/0/0.0
set routing-instances VRF1 instance-type vrf
set routing-instances VRF1 interface ge-0/0/1.0
set routing-instances VRF1 route-distinguisher 4.4.4.4:1
set routing-instances VRF1 vrf-target target:65000:1
set routing-instances VRF1 protocols bgp group PE-CE type external
set routing-instances VRF1 protocols bgp group PE-CE local-address 192.168.4.254
set routing-instances VRF1 protocols bgp group PE-CE neighbor 192.168.4.1 peer-as 65004
###########VMX-CE1####################
set version 14.1R4.8
set system host-name VMX-CE1
set system root-authentication encrypted-password "$1$1006jy5.$8/66Q0JBoXlGtAktmGNka1"
set system syslog user * any emergency
set system syslog file messages any notice
set system syslog file messages authorization info
set system syslog file interactive-commands interactive-commands any
set interfaces ge-0/0/1 unit 0 family inet address 192.168.1.1/24
set interfaces lo0 unit 0 family inet address 11.11.11.11/32
set routing-options router-id 11.11.11.11
set routing-options autonomous-system 65001
set protocols bgp group CE-PE type external
set protocols bgp group CE-PE local-address 192.168.1.1
set protocols bgp group CE-PE export POLICY_EXPORT_LO0
set protocols bgp group CE-PE neighbor 192.168.1.254 peer-as 65000
set policy-options policy-statement POLICY_EXPORT_LO0 from family inet
set policy-options policy-statement POLICY_EXPORT_LO0 from protocol direct
set policy-options policy-statement POLICY_EXPORT_LO0 from route-filter 0.0.0.0/0 prefix-length-range /32-/32
set policy-options policy-statement POLICY_EXPORT_LO0 then accept
##########VMX-CE2###########################
set version 14.1R4.8
set system host-name VMX-CE2
set system root-authentication encrypted-password "$1$0qSqG.Fl$qU3qxR7eosVTyj65jNxVV1"
set system syslog user * any emergency
set system syslog file messages any notice
set system syslog file messages authorization info
set system syslog file interactive-commands interactive-commands any
set interfaces ge-0/0/1 unit 0 family inet address 192.168.2.1/24
set interfaces lo0 unit 0 family inet address 22.22.22.22/32
set routing-options router-id 22.22.22.22
set routing-options autonomous-system 65002
set protocols bgp group CE-PE type external
set protocols bgp group CE-PE local-address 192.168.2.1
set protocols bgp group CE-PE export POLICY_EXPORT_LO0
set protocols bgp group CE-PE neighbor 192.168.2.254 peer-as 65000
set policy-options policy-statement POLICY_EXPORT_LO0 from family inet
set policy-options policy-statement POLICY_EXPORT_LO0 from protocol direct
set policy-options policy-statement POLICY_EXPORT_LO0 from route-filter 0.0.0.0/0 prefix-length-range /32-/32
set policy-options policy-statement POLICY_EXPORT_LO0 then accept
###########VMX-CE3#################
set version 14.1R4.8
set system host-name VMX-CE3
set system root-authentication encrypted-password "$1$X1Ybl/Jd$eC4M5uKC6Num6F2vb/EP1."
set system syslog user * any emergency
set system syslog file messages any notice
set system syslog file messages authorization info
set system syslog file interactive-commands interactive-commands any
set interfaces ge-0/0/1 unit 0 family inet address 192.168.3.1/24
set interfaces lo0 unit 0 family inet address 33.33.33.33/32
set routing-options router-id 33.33.33.33
set routing-options autonomous-system 65003
set protocols bgp group CE-PE type external
set protocols bgp group CE-PE local-address 192.168.3.1
set protocols bgp group CE-PE export POLICY_EXPORT_LO0
set protocols bgp group CE-PE neighbor 192.168.3.254 peer-as 65000
set policy-options policy-statement POLICY_EXPORT_LO0 from family inet
set policy-options policy-statement POLICY_EXPORT_LO0 from protocol direct
set policy-options policy-statement POLICY_EXPORT_LO0 from route-filter 0.0.0.0/0 prefix-length-range /32-/32
set policy-options policy-statement POLICY_EXPORT_LO0 then accept
################VMX-CE4############################
set version 14.1R4.8
set system host-name VMX-CE4
set system root-authentication encrypted-password "$1$l/p/KeA6$CQ6qWqkWaM7P2MbUGN4RI0"
set system syslog user * any emergency
set system syslog file messages any notice
set system syslog file messages authorization info
set system syslog file interactive-commands interactive-commands any
set interfaces ge-0/0/1 unit 0 family inet address 192.168.4.1/24
set interfaces lo0 unit 0 family inet address 44.44.44.44/32
set routing-options router-id 44.44.44.44
set routing-options autonomous-system 65004
set protocols bgp group CE-PE type external
set protocols bgp group CE-PE local-address 192.168.4.1
set protocols bgp group CE-PE export POLICY_EXPORT_LO0
set protocols bgp group CE-PE neighbor 192.168.4.254 peer-as 65000
set policy-options policy-statement POLICY_EXPORT_LO0 from family inet
set policy-options policy-statement POLICY_EXPORT_LO0 from protocol direct
set policy-options policy-statement POLICY_EXPORT_LO0 from route-filter 0.0.0.0/0 prefix-length-range /32-/32
set policy-options policy-statement POLICY_EXPORT_LO0 then accept
验证
root@VMX-CE1> show bgp neighbor 192.168.1.254 | match State
Type: External State: Established Flags:
Last State: OpenConfirm Last Event: RecvKeepAlive
RIB State: BGP restart is complete
Send state: in sync
学习到了22.22.22.22,33.33.33.33,44.44.44.44路由
root@VMX-CE1> show route protocol bgp
inet.0: 9 destinations, 9 routes (9 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
22.22.22.22/32 *[BGP/170] 00:20:12, localpref 100
AS path: 65000 65002 I, validation-state: unverified
> to 192.168.1.254 via ge-0/0/1.0
33.33.33.33/32 *[BGP/170] 00:23:56, localpref 100
AS path: 65000 65003 I, validation-state: unverified
> to 192.168.1.254 via ge-0/0/1.0
44.44.44.44/32 *[BGP/170] 00:23:43, localpref 100
AS path: 65000 65004 I, validation-state: unverified
> to 192.168.1.254 via ge-0/0/1.0
192.168.2.0/24 *[BGP/170] 00:20:12, localpref 100
AS path: 65000 I, validation-state: unverified
> to 192.168.1.254 via ge-0/0/1.0
192.168.3.0/24 *[BGP/170] 00:23:56, localpref 100
AS path: 65000 I, validation-state: unverified
> to 192.168.1.254 via ge-0/0/1.0
192.168.4.0/24 *[BGP/170] 00:23:43, localpref 100
AS path: 65000 I, validation-state: unverified
> to 192.168.1.254 via ge-0/0/1.0
root@ubuntu:~# gobgp nei
Peer AS Up/Down State |#Received Accepted
1.1.1.1 65000 00:26:29 Establ | 2 2
2.2.2.2 65000 00:22:45 Establ | 2 2
3.3.3.3 65000 00:26:54 Establ | 2 2
4.4.4.4 65000 00:26:15 Establ | 2 2
root@VMX-CE1> ping source 11.11.11.11 22.22.22.22
PING 22.22.22.22 (22.22.22.22): 56 data bytes
64 bytes from 22.22.22.22: icmp_seq=0 ttl=61 time=7.720 ms
64 bytes from 22.22.22.22: icmp_seq=1 ttl=61 time=5.759 ms
64 bytes from 22.22.22.22: icmp_seq=2 ttl=61 time=8.294 ms
双层标签截获的包
VPNV4的基础学习请参考
网友评论