Commit 8f0c125f authored by nanahira's avatar nanahira

add direct

parent 09f822aa
......@@ -3,7 +3,7 @@
source {{ansible_user_dir}}/nextgen-router/scripts/utility.sh
export BRIDGE_NAME={{br.name}}
{% if br.macvlan is defined and br.macvlan %}
{% if br.macvlan is defined and br.macvlan and br.links is defined and br.links and br.links | length > 0 %}
# macvlans
{% for link in br.links %}
......
......@@ -7,6 +7,7 @@ export BRIDGE_NAME={{br.name}}
{{br.linkUp}}
{% endif %}
{% if br.links is defined and br.links and br.links | length > 0 %}
{% for link in br.links %}
# link {{link}}
......@@ -19,5 +20,6 @@ ip link add link {{link}} dev {{br.name}}{{link | regex_replace('\.', '')}} type
ip link set {{br.name}}{{link | regex_replace('\.', '')}} up
{% endif %}
{% endfor %}
{% endif %}
true
......@@ -83,6 +83,7 @@ iface {{vlan.link}}.{{vlan.tag}} inet6 manual
auto {{br.name}}
allow-hotplug {{br.name}}
iface {{br.name}} inet {{br.type}}
{% if not (br.direct is defined and br.direct) %}
{% if br.links is defined and br.links and br.links | length > 0 %}
bridge_ports{% for link in br.links %} {% if br.macvlan is defined and br.macvlan %}{{br.name}}{{link | regex_replace('\.', '')}}{% else %}{{link}}{% endif %}{% endfor %}
......@@ -95,6 +96,7 @@ bridge_stp on
bridge_stp off
{% endif %}
bridge_maxwait 3
{% endif %}
{% if br.type == "static" %}
address {{br.address}}
{% elif br.type == "dhcp" %}
......
#!/bin/bash
{% if not (ppp.direct is defined and ppp.direct) %}
ip link del dev pppm{{ppp.id}}
{% endif %}
......@@ -3,8 +3,10 @@ source {{ansible_user_dir}}/nextgen-router/scripts/utility.sh
_wait_for_interface_online {{ppp.link}}
{% if not (ppp.direct is defined and ppp.direct) %}
ip link add link {{ppp.link}} dev pppm{{ppp.id}} type macvlan
ip link set pppm{{ppp.id}} up
{% if ppp.mac is defined and ppp.mac %}
ip link set pppm{{ppp.id}} address {{ppp.mac}}
{% endif %}
{% endif %}
......@@ -4,7 +4,11 @@ noauth
persist
maxfail 0
holdoff 5
{% if ppp.direct is defined and ppp.direct %}
plugin rp-pppoe.so {{ppp.link}}
{% else %}
plugin rp-pppoe.so pppm{{ppp.id}}
{% endif %}
user "{{ppp.username}}"
ifname ppp{{ppp.id}}
+ipv6
......@@ -23,6 +23,7 @@ vars:
links:
- bond0 # 上行链路
type: static # dhcp还是static,manual理论上也可以
direct: false # 是否不使用 bridge 直接连。这种情况下那个网卡不能在别处出现。
address: 10.0.0.1/24 # 首选地址
moreAddresses:
- 10.0.0.2/24 # 备选地址
......@@ -71,6 +72,7 @@ vars:
username: user # 拨号用户名,密码在pppoeUsers给出
mac: null # 给ISP看的mac地址,null为随机
dhcpv6Client: false # 使用这里的DHCPv6,所有ppp只能有1个
direct: false # 是否不使用 macvlan 直接连。这种情况下同一个链路不能多次使用,且不能使用 mac 属性。
pppoeUsers: # PPPoE帐号
- username: user
password: pass
......
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