Commit 70dd9505 authored by 神楽坂玲奈's avatar 神楽坂玲奈

babeld

parent e653df69
# MyCard babeld
debug 1
# router-id 00:00:00:00:00:00:00:03
redistribute local ip 10.198.0.0/24
{% for interface in lanInterfaces %}
redistribute if {{interface}}
{% endfor %}
redistribute local deny
reflect-kernel-metric true
{% for connection in connections %}
{% if connection.protocol != "null" and connection.remoteLocalAddress != address %}
interface {{connection.name}} type tunnel rxcost {{connection.metric}} faraway true rtt-max 500
{% endif %}
{% endfor %}
{% for interface in lanInterfaces %}
interface {{interface}}
{% endfor %}
...@@ -4,31 +4,12 @@ ...@@ -4,31 +4,12 @@
log stderr all; log stderr all;
router id {{address}}; router id {{address}};
protocol device { protocol device {}
}
#protocol direct {
# disabled;
# ipv4;
# ipv6;
#}
{% for interface in lanInterfaces %}
protocol direct {
ipv4;
ipv6;
interface "{{interface}}";
}
{% endfor %}
protocol kernel { protocol kernel {
ipv4 { ipv4 {
export where net != 0.0.0.0/0; import all;
}; };
persist;
#kernel table main;
}
protocol kernel {
ipv6 { export all; };
} }
{% for plan in routePlans %} {% for plan in routePlans %}
...@@ -49,61 +30,3 @@ protocol kernel { ...@@ -49,61 +30,3 @@ protocol kernel {
kernel table {{plan.destMark}}; kernel table {{plan.destMark}};
} }
{% endfor %} {% endfor %}
protocol ospf v2 {
ipv4 {
import all;
export where source ~ [ RTS_DEVICE, RTS_STATIC ];
};
area 0 {
networks {
{% for subnet in routeLists.mycard %}
{{subnet}};
{% endfor %}
};
# interface "eth*" {
# type broadcast; # Detected by default
# cost 10; # Interface metric
# hello 5; # Default hello perid 10 is too long
# };
{% for connection in connections %}
{% if connection.protocol != "null" and not (connection.protocol == "oc" and connection.ocType == "server") and connection.remoteLocalAddress != address %}
interface "{{connection.name}}" {
type ptmp;
{% if connection.outbound %}
cost {{connection.metric}};
{% else %}
cost 50000;
{% endif %}
hello 5;
authentication cryptographic;
password "{{ospfToken}}";
};
{% endif %}
{% endfor %}
{% if ocservNeeded %}
interface "mcoc*" {
type ptmp;
cost {{ocMetric}};
hello 5;
authentication cryptographic;
password "{{ospfToken}}";
};
{% endif %}
{% for interface in lanInterfaces %}
interface "{{interface}}" {
type broadcast;
cost 1;
hello 5;
authentication cryptographic;
password "{{ospfToken}}";
};
{% endfor %}
interface "dummy0" {
stub; # Stub interface, just propagate it
};
};
}
...@@ -104,6 +104,12 @@ ...@@ -104,6 +104,12 @@
dest: '{{ansible_user_dir}}/nextgen-network/services/bird.conf' dest: '{{ansible_user_dir}}/nextgen-network/services/bird.conf'
notify: restart_bird notify: restart_bird
when: not noBird when: not noBird
- name: babeld conf
template:
src: babeld.conf.j2
dest: '{{ansible_user_dir}}/nextgen-network/services/babeld.conf'
notify: restart_babeld
# when: not noBird
- name: frps conf - name: frps conf
template: template:
src: protocols/wgfrp/frps.ini.j2 src: protocols/wgfrp/frps.ini.j2
...@@ -142,6 +148,13 @@ ...@@ -142,6 +148,13 @@
services: services:
- bird - bird
when: not noBird when: not noBird
- name: restart_babeld
docker_compose:
project_src: '{{ansible_user_dir}}/nextgen-network/services'
restarted: true
services:
- babeld
# when: not noBird
- name: restart_frps - name: restart_frps
docker_compose: docker_compose:
project_src: '{{ansible_user_dir}}/nextgen-network/services' project_src: '{{ansible_user_dir}}/nextgen-network/services'
......
...@@ -154,6 +154,14 @@ class InventoryBuilder { ...@@ -154,6 +154,14 @@ class InventoryBuilder {
network_mode: 'host', network_mode: 'host',
cap_add: ['NET_ADMIN', 'NET_BROADCAST', 'NET_RAW'], cap_add: ['NET_ADMIN', 'NET_BROADCAST', 'NET_RAW'],
volumes: ['./bird.conf:/etc/bird/bird.conf:ro'] volumes: ['./bird.conf:/etc/bird/bird.conf:ro']
},
babeld: {
restart: 'always',
privileged: true,
image: 'git-registry.mycard.moe/railgun/babeld',
network_mode: 'host',
cap_add: ['NET_ADMIN', 'NET_BROADCAST', 'NET_RAW'],
volumes: ['./babeld.conf:/etc/babeld.conf:ro']
} }
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment