Commit 3ad18142 authored by nanahira's avatar nanahira

wait for a solution..

parent ac125363
log syslog all; log stderr all;
router id {{address}}; router id {{address}};
protocol device { protocol device {
...@@ -64,7 +64,7 @@ protocol ospf v2 { ...@@ -64,7 +64,7 @@ protocol ospf v2 {
{% for connection in connections %} {% for connection in connections %}
{% if connection.protocol != "null" and connection.remoteLocalAddress != address %} {% if connection.protocol != "null" and connection.remoteLocalAddress != address %}
interface "{{connection.name}}" { interface "{{connection.name}}" {
type ptp; type ptmp;
{% if connection.outbound %} {% if connection.outbound %}
cost {{connection.metric}}; cost {{connection.metric}};
{% else %} {% else %}
......
...@@ -19,4 +19,4 @@ Endpoint = {{conn.remoteAddress}}:{{conn.remotePort}} ...@@ -19,4 +19,4 @@ Endpoint = {{conn.remoteAddress}}:{{conn.remotePort}}
PersistentKeepalive = 1 PersistentKeepalive = 1
{% endif %} {% endif %}
# forced change # forced change 12.11 2
...@@ -15,7 +15,7 @@ ip rule add pref 81 to {{subnet}} lookup main || true ...@@ -15,7 +15,7 @@ ip rule add pref 81 to {{subnet}} lookup main || true
# chain for wg origin # chain for wg origin
iptables -t mangle -N NEXTGEN_ORIGIN iptables -t mangle -N NEXTGEN_ORIGIN
iptables -t mangle -A PREROUTING ! -p ospf -m set ! --match-set mycard src -j NEXTGEN_ORIGIN iptables -t mangle -A PREROUTING ! -d 224.0.0.0/3 ! -p ospf -m set ! --match-set mycard src -j NEXTGEN_ORIGIN
# switch rules # switch rules
{{ansible_user_dir}}/nextgen-network/scripts/switch-rules-up.sh {{ansible_user_dir}}/nextgen-network/scripts/switch-rules-up.sh
......
...@@ -27,7 +27,7 @@ interface_origin() { ...@@ -27,7 +27,7 @@ interface_origin() {
OPTION=$1 OPTION=$1
INTERFACE=$2 INTERFACE=$2
MARK=$3 MARK=$3
iptables -t mangle "$OPTION" NEXTGEN_ORIGIN ! -p ospf -i "$INTERFACE" -m set ! --match-set mycard src -j CONNMARK --set-xmark "$MARK" iptables -t mangle "$OPTION" NEXTGEN_ORIGIN ! -p ospf -i "$INTERFACE" ! -d 224.0.0.0/3 -m set ! --match-set mycard src -j CONNMARK --set-xmark "$MARK"
restore_mark_origin "$OPTION" "$MARK" restore_mark_origin "$OPTION" "$MARK"
} }
......
...@@ -37,7 +37,7 @@ class InventoryBuilder { ...@@ -37,7 +37,7 @@ class InventoryBuilder {
host.wgPublickey = await this.wgPublickey(host.wgPrivateKey); host.wgPublickey = await this.wgPublickey(host.wgPrivateKey);
} }
// console.log(Object.values(this.hosts)); // console.log(Object.values(this.hosts));
const hosts = Object.fromEntries(Object.values(this.hosts).map(h => [h.host, this.host_vars(h)])); const hosts = Object.fromEntries(Object.values(this.hosts).map(h => [h.name, this.host_vars(h)]));
// console.log(hosts); // console.log(hosts);
const vars = await this.loadUtilities(); const vars = await this.loadUtilities();
const result = YAML.stringify({ wg: { hosts, vars } }); const result = YAML.stringify({ wg: { hosts, vars } });
...@@ -115,8 +115,10 @@ class InventoryBuilder { ...@@ -115,8 +115,10 @@ class InventoryBuilder {
} }
return { return {
ansible_ssh_host: host.host,
ansible_ssh_user: host.user, ansible_ssh_user: host.user,
ansible_python_interpreter: "python3", ansible_ssh_port: host.sshPort || 22,
ansible_python_interpreter: host.python || "python3",
address: host.address, address: host.address,
isCN: host.location.startsWith("CN"), isCN: host.location.startsWith("CN"),
key: host.wgPrivateKey, key: host.wgPrivateKey,
...@@ -143,7 +145,7 @@ class InventoryBuilder { ...@@ -143,7 +145,7 @@ class InventoryBuilder {
const localGatewayName = (cis ? params.lif : params.rif) || params.if; const localGatewayName = (cis ? params.lif : params.rif) || params.if;
const localGateway = localGatewayName ? this.gateways[local.name][localGatewayName] : _.find(this.gateways[local.name]); const localGateway = localGatewayName ? this.gateways[local.name][localGatewayName] : _.find(this.gateways[local.name]);
//console.log(local.name, paramsString, params, localGatewayName, localGateway.name) //console.log(local.name, paramsString, params, localGatewayName, localGateway.name)
const localGatewayMark = localGateway.selectionMark; const localGatewayMark = localGatewayName ? localGateway.selectionMark: "";
const remoteGatewayName = (cis ? params.rif : params.lif) || params.if; const remoteGatewayName = (cis ? params.rif : params.lif) || params.if;
const remoteGateway = remoteGatewayName ? this.gateways[remote.name][remoteGatewayName] : _.find(this.gateways[remote.name]); const remoteGateway = remoteGatewayName ? this.gateways[remote.name][remoteGatewayName] : _.find(this.gateways[remote.name]);
//const remoteGatewayMark = remoteGatewayName ? remoteGateway.mark : undefined; //const remoteGatewayMark = remoteGatewayName ? remoteGateway.mark : undefined;
......
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