Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flannel IPIP Mode #7

Open
BurlyLuo opened this issue Mar 3, 2025 · 1 comment
Open

flannel IPIP Mode #7

BurlyLuo opened this issue Mar 3, 2025 · 1 comment

Comments

@BurlyLuo
Copy link
Owner

BurlyLuo commented Mar 3, 2025

---
kind: ConfigMap
apiVersion: v1
metadata:
  name: kube-flannel-cfg
  namespace: kube-system
  labels:
    tier: node
    app: flannel
data:
  cni-conf.json: |
    {
      "name": "cbr0",
      "cniVersion": "0.3.1",
      "plugins": [
        {
          "type": "flannel",
          "delegate": {
            "hairpinMode": true,
            "isDefaultGateway": true
          }
        },
        {
          "type": "portmap",
          "capabilities": {
            "portMappings": true
          }
        }
      ]
    }
  net-conf.json: |
    {
      "Network": "10.244.0.0/16",
      "Backend": {
        "Type": "ipip"
      }
    }
---
@BurlyLuo
Copy link
Owner Author

  1. setup ipip with clab
#!/bin/bash
set -v
cat <<EOF>clab.yaml | clab deploy -t clab.yaml -
name: ipip
topology:
  nodes:
    gwx:
      kind: linux
      image: 192.168.2.100:5000/nettool
      exec:
      - ip a a 10.1.5.1/24 dev net1
      - ip a a 10.1.8.1/24 dev net2
      - ip a a 10.1.9.1/24 dev net3

    ipip1:
      kind: linux
      image: 192.168.2.100:5000/nettool
      exec:
      # add [node-gw] interface:eth1,eth2
      - ip a a 10.244.1.1/24 dev eth1
      - ip addr add 10.1.5.10/24 dev eth2
      # add ipip tunnel[lcoal 10.1.5.10 remote any.]
      - ip l a ipip0 type ipip local 10.1.5.10 dev eth2
      - ip a a 10.244.1.0/32 dev ipip0
      - ip l s ipip0 up
      # replace [node-gw] default gateway
      - ip route replace default via 10.1.5.1 dev eth2 
      # add dst_routing table
      - ip r a 10.244.2.0/24 via 10.1.8.10 dev ipip0 onlink
      - ip r a 10.244.3.0/24 via 10.1.9.10 dev ipip0 onlink

    ipip2:
      kind: linux
      image: 192.168.2.100:5000/nettool
      exec:
      - ip a a 10.244.2.1/24 dev eth1
      - ip addr add 10.1.8.10/24 dev eth2

      - ip l a ipip0 type ipip local 10.1.8.10 dev eth2
      - ip a a 10.244.2.0/32 dev ipip0
      - ip l s ipip0 up

      - ip route replace default via 10.1.8.1 dev eth2

      - ip r a 10.244.1.0/24 via 10.1.5.10 dev ipip0 onlink
      - ip r a 10.244.3.0/24 via 10.1.9.10 dev ipip0 onlink

    ipip3:
      kind: linux
      image: 192.168.2.100:5000/nettool
      exec:
      - ip a a 10.244.3.1/24 dev eth1
      - ip addr add 10.1.9.10/24 dev eth2

      - ip l a ipip0 type ipip local 10.1.9.10 dev eth2
      - ip a a 10.244.3.0/32 dev ipip0
      - ip l s ipip0 up

      - ip route replace default via 10.1.9.1 dev eth2

      - ip r a 10.244.1.0/24 via 10.1.5.10 dev ipip0 onlink
      - ip r a 10.244.2.0/24 via 10.1.8.10 dev ipip0 onlink

    server1:
      kind: linux
      image: 192.168.2.100:5000/nettool
      exec:
      - ip addr add 10.244.1.10/24 dev net0
      - ip route replace default via 10.244.1.1

    server2:
      kind: linux
      image: 192.168.2.100:5000/nettool
      exec:
      - ip addr add 10.244.2.10/24 dev net0
      - ip route replace default via 10.244.2.1

    server3:
      kind: linux
      image: 192.168.2.100:5000/nettool
      exec:
      - ip addr add 10.244.3.10/24 dev net0
      - ip route replace default via 10.244.3.1

  links:
    - endpoints: ["ipip1:eth1", "server1:net0"]
    - endpoints: ["ipip2:eth1", "server2:net0"]
    - endpoints: ["ipip3:eth1", "server3:net0"]
    - endpoints: ["ipip1:eth2", "gwx:net1"]
    - endpoints: ["ipip2:eth2", "gwx:net2"]
    - endpoints: ["ipip3:eth2", "gwx:net3"]
    
EOF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant