Skip to content

Commit

Permalink
Readd BIRD, and upgrade to support 2.0.
Browse files Browse the repository at this point in the history
Fixes #145
  • Loading branch information
danderson committed Mar 1, 2018
1 parent 19da00a commit 5e01338
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 35 deletions.
22 changes: 2 additions & 20 deletions manifests/test-bgp-router.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ spec:
fieldPath: status.hostIP
ports:
- name: bird
containerPort: 1179
- name: quagga
containerPort: 179
- name: gobgp
containerPort: 2179
- name: quagga
containerPort: 1179
- name: http
containerPort: 7472
securityContext:
Expand Down Expand Up @@ -76,22 +74,6 @@ spec:
app: test-bgp-router
clusterIP: 10.96.0.101

---
apiVersion: v1
kind: Service
metadata:
namespace: metallb-system
name: test-bgp-router-gobgp
spec:
ports:
- name: bgp
port: 179
protocol: TCP
targetPort: gobgp
selector:
app: test-bgp-router
clusterIP: 10.96.0.102

---
apiVersion: v1
kind: Service
Expand Down
8 changes: 2 additions & 6 deletions manifests/tutorial-1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@ metadata:
data:
config: |
peers:
# Temporarily disabled due to bug #142
# - my-asn: 64512
# peer-asn: 64512
# peer-address: 10.96.0.100
- my-asn: 64512
peer-asn: 64512
peer-address: 10.96.0.101
peer-address: 10.96.0.100
- my-asn: 64512
peer-asn: 64512
peer-address: 10.96.0.102
peer-address: 10.96.0.101
address-pools:
- name: my-ip-space
protocol: bgp
Expand Down
16 changes: 10 additions & 6 deletions test-bgp-router/bird.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,36 @@ import (
"fmt"
"io/ioutil"
"net"
"os"
"os/exec"
"strings"
)

func hasBird() bool {
// Disabled pending bug #142
// _, err := os.Stat("/usr/sbin/bird")
// return err == nil
return false
_, err := os.Stat("/usr/sbin/bird")
return err == nil
}

func writeBirdConfig() error {
cfg := fmt.Sprintf(`
router id 10.96.0.100;
listen bgp port 1179;
log stderr all;
debug protocols all;
protocol device {
}
protocol static {
ipv4;
route %s/32 via "eth0";
}
protocol bgp minikube {
local 10.96.0.100 as 64512;
local as 64512;
neighbor %s as 64512;
passive;
multihop;
ipv4 {
table master4;
import all;
};
error wait time 1, 2;
}
`, nodeIP(), nodeIP())
Expand Down
4 changes: 2 additions & 2 deletions test-bgp-router/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func runTCPDump() error {
if err := os.Mkdir("/run/tcpdump", 0600); err != nil {
return err
}
c := exec.Command("/usr/sbin/tcpdump", "-i", "eth0", "-w", "/run/tcpdump/pcap", "tcp", "port", "1179")
c := exec.Command("/usr/sbin/tcpdump", "-i", "eth0", "-w", "/run/tcpdump/pcap", "tcp", "port", "179", "or", "tcp", "port", "1179")
if err := c.Start(); err != nil {
return err
}
Expand All @@ -69,7 +69,7 @@ func runTCPDump() error {
}

func installNatRule() error {
for _, port := range []int{179, 1179, 2179} {
for _, port := range []int{179, 1179} {
if err := runBlocking("/sbin/iptables", "-t", "nat", "-A", "INPUT", "-p", "tcp", "--dport", strconv.Itoa(port), "-j", "SNAT", "--to", nodeIP()); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion test-bgp-router/quagga.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func runQuagga() error {
if err := runOrCrash("/usr/sbin/zebra", "-A", "127.0.0.1", "-f", "/etc/quagga/zebra.conf"); err != nil {
return err
}
if err := runOrCrash("/usr/sbin/bgpd", "-A", "127.0.0.1", "-f", "/etc/quagga/bgpd.conf"); err != nil {
if err := runOrCrash("/usr/sbin/bgpd", "-p 1179", "-A", "127.0.0.1", "-f", "/etc/quagga/bgpd.conf"); err != nil {
return err
}
return nil
Expand Down

0 comments on commit 5e01338

Please sign in to comment.