IP List:
- Pod IP: 10.244.1.6
- Gateway IP: 10.240.0.6
- Pod's Node IP: 10.240.0.4
# arp_responder running on the gateway node | |
# sudo apt install -y python3-scapy | |
from __future__ import print_function | |
from scapy.all import * | |
iface = "vxlan42" | |
vxlan_mac = get_if_hwaddr(iface) | |
def handle_packet(packet): | |
if packet[ARP].op == ARP.who_has: | |
print(packet.summary()) | |
reply = ARP(op=ARP.is_at, hwsrc=vxlan_mac, hwdst=packet.src, psrc=packet.pdst, pdst=packet.psrc) | |
go = Ether(dst=packet.src, src=vxlan_mac) / reply | |
sendp(go, iface=iface) | |
return | |
sniff(iface=iface, filter="arp",prn=handle_packet) |
IP List:
ip link add vxlan42 type vxlan id 42 remote 10.240.0.4 dstport 4789 dev eth0 | |
ip link set dev vxlan42 up | |
ip addr add 10.252.0.5/24 dev vxlan42 | |
ip route add default dev vxlan42 src 10.252.0.5 table 42 | |
# Pod rule | |
ip rule add from all to 10.244.1.6 lookup 42 |
ip link add vxlan42 type vxlan id 42 remote 10.240.0.6 dstport 4789 dev eth0 | |
ip link set dev vxlan42 up | |
ip addr add 10.252.0.6/24 dev vxlan42 | |
ip route add default dev vxlan42 src 10.252.0.6 table 42 | |
# Pod rule | |
ip rule add from 10.244.1.6 to all lookup 42 | |
# Pod/Service CIDRs | |
ip route add 10.244.1.0/24 dev cbr0 proto kernel scope link src 10.244.1.1 table 42 | |
ip route add 10.244.0.0/16 via 10.240.0.1 dev eth0 src 10.240.0.4 table 42 |