Commit b63bffc1 authored by nanahira's avatar nanahira

fix localnet ipset

parent 091d2266
...@@ -57,6 +57,7 @@ handle_gateway {{gateway.id}} {{gateway.address}} {% if gateway.mac is defined a ...@@ -57,6 +57,7 @@ handle_gateway {{gateway.id}} {{gateway.address}} {% if gateway.mac is defined a
{% if br.masq is defined and br.masq %} {% if br.masq is defined and br.masq %}
# Masquerade # Masquerade
ensure_localnet_ipset
iptables -t nat -A POSTROUTING -o "$BRIDGE_NAME" -m set --match-set localnet src -m set ! --match-set localnet dst -j MASQUERADE iptables -t nat -A POSTROUTING -o "$BRIDGE_NAME" -m set --match-set localnet src -m set ! --match-set localnet dst -j MASQUERADE
{% endif %} {% endif %}
......
#!/bin/bash #!/bin/bash
source {{ansible_user_dir}}/nextgen-router/scripts/utility.sh source {{ansible_user_dir}}/nextgen-router/scripts/utility.sh
ipset restore -f {{ansible_user_dir}}/nextgen-router/localnet-ipset ensure_localnet_ipset
iptables-restore --noflush {{ansible_user_dir}}/iptables-gateways iptables-restore --noflush {{ansible_user_dir}}/iptables-gateways
{% for subnet in localnets %} {% for subnet in localnets %}
ip rule add pref 80 to {{subnet}} lookup main ip rule add pref 80 to {{subnet}} lookup main
......
ensure_localnet_ipset() {
ipset restore -f {{ansible_user_dir}}/nextgen-router/localnet-ipset
}
restore_mark() { restore_mark() {
OPTION=$1 OPTION=$1
MARK=$2 MARK=$2
...@@ -12,6 +16,7 @@ restore_mark() { ...@@ -12,6 +16,7 @@ restore_mark() {
} }
ppp_origin() { ppp_origin() {
ensure_localnet_ipset
OPTION=$1 OPTION=$1
INTERFACE=$2 INTERFACE=$2
MARK=$[1000 + $(echo "$INTERFACE" | sed "s/ppp//g")] MARK=$[1000 + $(echo "$INTERFACE" | sed "s/ppp//g")]
...@@ -21,6 +26,7 @@ ppp_origin() { ...@@ -21,6 +26,7 @@ ppp_origin() {
} }
eth_origin() { eth_origin() {
ensure_localnet_ipset
OPTION=$1 OPTION=$1
BRIDGE_NAME=$2 BRIDGE_NAME=$2
GATEWAY_ID=$3 GATEWAY_ID=$3
......
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