# Laboratorio de la semana 3, paso 4: dos switches unidos por un trunk y un router
# colgado del segundo. Los hosts ya tienen dirección y gateway; las VLANs, los trunks y
# las subinterfaces del router se configuran durante el laboratorio (vlan/).
name: w03-campus
mgmt:
  network: redes-w03-campus
  ipv4-subnet: 172.90.3.64/26
  ipv6-subnet: 3fff:172:90:3:b::/80
topology:
  defaults:
    kind: linux
    image: redes-router
    sysctls:
      net.ipv6.conf.all.disable_ipv6: 1
      net.ipv6.conf.default.disable_ipv6: 1
  nodes:
    sw1:
      exec:
        - ip link add br0 type bridge
        - sysctl -q -w net.ipv6.conf.br0.disable_ipv6=1
        - ip link set eth1 master br0
        - ip link set eth2 master br0
        - ip link set eth3 master br0
        - ip link set br0 up
    sw2:
      exec:
        - ip link add br0 type bridge
        - sysctl -q -w net.ipv6.conf.br0.disable_ipv6=1
        - ip link set eth1 master br0
        - ip link set eth2 master br0
        - ip link set eth3 master br0
        - ip link set eth4 master br0
        - ip link set br0 up
    r1:
      binds: [r1/frr.conf:/etc/frr/frr.conf:ro]
      exec:
        - sysctl -q -w net.ipv6.conf.default.disable_ipv6=1
        - sysctl -q -w net.ipv6.conf.eth1.disable_ipv6=1
    h1:
      exec:
        - ip addr add 10.203.110.1/24 dev eth1
        - ip route replace default via 10.203.110.254
    h2:
      exec:
        - ip addr add 10.203.120.2/24 dev eth1
        - ip route replace default via 10.203.120.254
    h3:
      exec:
        - ip addr add 10.203.110.3/24 dev eth1
        - ip route replace default via 10.203.110.254
    h4:
      exec:
        - ip addr add 10.203.120.4/24 dev eth1
        - ip route replace default via 10.203.120.254
  links:
    - type: veth
      endpoints:
        - {node: sw1, interface: eth1}
        - {node: h1, interface: eth1, mac: "02:00:00:00:00:01"}
    - type: veth
      endpoints:
        - {node: sw1, interface: eth2}
        - {node: h2, interface: eth1, mac: "02:00:00:00:00:02"}
    - type: veth
      endpoints:
        - {node: sw2, interface: eth1}
        - {node: h3, interface: eth1, mac: "02:00:00:00:00:03"}
    - type: veth
      endpoints:
        - {node: sw2, interface: eth2}
        - {node: h4, interface: eth1, mac: "02:00:00:00:00:04"}
    - type: veth
      endpoints:
        - {node: sw1, interface: eth3, mac: "02:00:00:00:01:03"}
        - {node: sw2, interface: eth3, mac: "02:00:00:00:02:03"}
    - type: veth
      endpoints:
        - {node: sw2, interface: eth4, mac: "02:00:00:00:02:04"}
        - {node: r1, interface: eth1, mac: "02:00:00:00:00:fe"}
