Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
nextgen-router
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
nextgen-router
Commits
28132504
Commit
28132504
authored
Dec 08, 2020
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finish
parent
69f3f72e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
102 additions
and
22 deletions
+102
-22
files/dnsmasq/dnsmasq.conf.j2
files/dnsmasq/dnsmasq.conf.j2
+1
-1
files/interfaces.j2
files/interfaces.j2
+2
-0
files/services/docker-compose.yml.j2
files/services/docker-compose.yml.j2
+53
-0
files/utility.sh.j2
files/utility.sh.j2
+1
-1
network.yaml
network.yaml
+8
-10
services.yaml
services.yaml
+16
-0
tasks/sysctl.yaml
tasks/sysctl.yaml
+1
-1
variables.yaml
variables.yaml
+20
-9
No files found.
files/dnsmasq/dnsmasq.conf.j2
View file @
28132504
...
@@ -18,7 +18,7 @@ no-dhcp-interface=lo{% for br in bridges %}{% if not br.dhcp %},{{br.name}}{% en
...
@@ -18,7 +18,7 @@ no-dhcp-interface=lo{% for br in bridges %}{% if not br.dhcp %},{{br.name}}{% en
dhcp-range={{br.name}},{{br.dhcp.start}},{{br.dhcp.end}},{{br.dhcp.time}}
dhcp-range={{br.name}},{{br.dhcp.start}},{{br.dhcp.end}},{{br.dhcp.time}}
{% if br.
i
pv6 %}
{% if br.
dhc
pv6 %}
dhcp-range=tag:{{br.name}},::,constructor:{{br.name}},ra-names,24h
dhcp-range=tag:{{br.name}},::,constructor:{{br.name}},ra-names,24h
{% endif %}
{% endif %}
...
...
files/interfaces.j2
View file @
28132504
...
@@ -60,6 +60,8 @@ bridge_stp on
...
@@ -60,6 +60,8 @@ bridge_stp on
bridge_maxwait 3
bridge_maxwait 3
{% if br.type == "static" %}
{% if br.type == "static" %}
address {{br.address}}
address {{br.address}}
{% elif br.type == "dhcp" %}
metric 9999
{% endif %}
{% endif %}
post-up {{ansible_user_dir}}/nextgen-router/scripts/{{br.name}}/post-up.sh
post-up {{ansible_user_dir}}/nextgen-router/scripts/{{br.name}}/post-up.sh
pre-down {{ansible_user_dir}}/nextgen-router/scripts/{{br.name}}/pre-down.sh
pre-down {{ansible_user_dir}}/nextgen-router/scripts/{{br.name}}/pre-down.sh
...
...
files/services/docker-compose.yml.j2
0 → 100644
View file @
28132504
version: '2.4'
services:
dummy:
image: alpine
command: sleep infinity
{% for br in bridges %}
{% if br.dhcpv6 %}
{% for ppp in ppps %}
{% if ppp.dhcpv6 %}
dhcpv6-ppp{{ppp.id}}-{{br.name}}:
restart: always
image: git-registry.mycard.moe/nanahira/docker-dhcpv6-client
network_mode: host
cap_add:
- NET_ADMIN
environment:
WAN_INTERFACE: ppp{{ppp.id}}
LAN_INTERFACE: {{br.name}}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% for instance in services.ddns %}
ddns-{{instance.name}}:
restart: always
image: oznu/cloudflare-ddns
network_mode: host
environment:
EMAIL: {{instance.email}}
API_KEY: {{instance.apiKey}}
ZONE: {{instance.zone}}
SUBDOMAIN: {{instance.subdomain}}
{% if instance.interface %}
INTERFACE: {{instance.interface}}
{% endif %}
DNS_SERVER: 1.0.0.1
{% if instance.ipv6 %}
RRTYPE: AAAA
{% else %}
RRTYPE: A
{% endif %}
{% endfor %}
{% for instance in services.tr069 %}
tr069-daemon-{{instance.interface}}:
restart: always
image: git-registry.mycard.moe/nanahira/tr069-daemon
network_mode: host
cap_add:
- NET_ADMIN
environment:
TRO69_INTERFACE: {{instance.interface}}
TABLE: {{instance.table}}
{% endfor %}
files/utility.sh.j2
View file @
28132504
...
@@ -19,7 +19,7 @@ initialize_ipset() {
...
@@ -19,7 +19,7 @@ initialize_ipset() {
{% 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 && \
{% endfor %}
{% endfor %}
ip rule add pref 80 172.16.0.0/12 lookup main
ip rule add pref 80
to
172.16.0.0/12 lookup main
true
true
}
}
...
...
network.yaml
View file @
28132504
...
@@ -65,16 +65,14 @@
...
@@ -65,16 +65,14 @@
with_items
:
'
{{bridges}}'
with_items
:
'
{{bridges}}'
-
name
:
dhclient.conf
-
name
:
dhclient.conf
become
:
true
become
:
true
blockinfile
:
copy
:
path
:
/etc/dhcp/dhclient.conf
content
:
|
block
:
|
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
{% for br in bridges %}
send host-name = gethostname();
{% if br.type == "dhcp" %}
request subnet-mask, broadcast-address;
interface "{{br.name}}" {
timeout 300;
request subnet-mask, broadcast-address;
}
dest
:
/etc/dhcp/dhclient.conf
{% endif %}
{% endfor %}
-
name
:
pppoe password
-
name
:
pppoe password
become
:
true
become
:
true
blockinfile
:
blockinfile
:
...
...
services.yaml
View file @
28132504
...
@@ -14,6 +14,8 @@
...
@@ -14,6 +14,8 @@
-
my-card.in
-
my-card.in
-
mius.pro
-
mius.pro
tasks
:
tasks
:
-
name
:
sysctl
include_tasks
:
./tasks/sysctl.yaml
-
name
:
dnsmasq directory
-
name
:
dnsmasq directory
file
:
file
:
name
:
'
{{ansible_user_dir}}/nextgen-router/services/dnsmasq/smartdns'
name
:
'
{{ansible_user_dir}}/nextgen-router/services/dnsmasq/smartdns'
...
@@ -42,6 +44,20 @@
...
@@ -42,6 +44,20 @@
docker_compose
:
docker_compose
:
project_src
:
'
{{ansible_user_dir}}/nextgen-router/services/dnsmasq'
project_src
:
'
{{ansible_user_dir}}/nextgen-router/services/dnsmasq'
remove_orphans
:
true
remove_orphans
:
true
-
name
:
other service directory
file
:
name
:
'
{{ansible_user_dir}}/nextgen-router/services/others'
state
:
directory
recurse
:
true
-
name
:
service docker-compose
template
:
src
:
./files/services/docker-compose.yml.j2
dest
:
'
{{ansible_user_dir}}/nextgen-router/services/others/docker-compose.yml'
-
name
:
start services
docker_compose
:
project_src
:
'
{{ansible_user_dir}}/nextgen-router/services/others'
remove_orphans
:
true
pull
:
true
handlers
:
handlers
:
-
name
:
restart_dnsmasq
-
name
:
restart_dnsmasq
docker_compose
:
docker_compose
:
...
...
tasks/sysctl.yaml
View file @
28132504
...
@@ -53,7 +53,7 @@
...
@@ -53,7 +53,7 @@
value
:
2
value
:
2
sysctl_set
:
true
sysctl_set
:
true
with_items
:
'
{{bridges}}'
with_items
:
'
{{bridges}}'
when
:
item.
i
pv6
when
:
item.
dhc
pv6
-
name
:
TCP BBR
-
name
:
TCP BBR
become
:
true
become
:
true
sysctl
:
sysctl
:
...
...
variables.yaml
View file @
28132504
vars
:
vars
:
ansible_ssh_user
:
root
ansible_ssh_user
:
root
localnets
:
localnets
:
-
10.0.0.0/24
-
10.0.0.0/24
# 系统内的所有内网网段
links
:
links
:
-
name
:
eno1
-
name
:
eno1
# 物理网卡
bonds
:
bonds
:
-
name
:
bond0
-
name
:
bond0
# bond,一般用mode 4来LACP
links
:
links
:
-
eno1
-
eno1
mode
:
4
mode
:
4
vlans
:
vlans
:
-
link
:
bond0
-
link
:
bond0
# vlan,只需要写link和tag,最后网卡名字会变成 link.tag
tag
:
2
tag
:
2
-
link
:
bond0
-
link
:
bond0
tag
:
3
tag
:
3
...
@@ -18,7 +18,7 @@ vars:
...
@@ -18,7 +18,7 @@ vars:
tag
:
41
tag
:
41
-
link
:
bond0
-
link
:
bond0
tag
:
46
tag
:
46
bridges
:
bridges
:
# bridge,IP只能在这里配
-
name
:
brlan
# 名称
-
name
:
brlan
# 名称
links
:
links
:
-
bond0
# 上行链路
-
bond0
# 上行链路
...
@@ -31,7 +31,7 @@ vars:
...
@@ -31,7 +31,7 @@ vars:
up
:
echo "up"
# 启动脚本和关闭脚本
up
:
echo "up"
# 启动脚本和关闭脚本
down
:
echo "down"
down
:
echo "down"
mac
:
null
# 自定义mac地址,否则bridge随机,注意dhcp会以原始mac请求dhcp,因此不建议dhcp模式使用
mac
:
null
# 自定义mac地址,否则bridge随机,注意dhcp会以原始mac请求dhcp,因此不建议dhcp模式使用
i
pv6
:
true
# DHCPv6落脚点,只能有1个LAN获得
dhc
pv6
:
true
# DHCPv6落脚点,只能有1个LAN获得
dhcp
:
# 是否开启dhcp,不是的话直接没有这一栏
dhcp
:
# 是否开启dhcp,不是的话直接没有这一栏
start
:
10.0.0.100
start
:
10.0.0.100
end
:
10.0.0.240
end
:
10.0.0.240
...
@@ -54,13 +54,14 @@ vars:
...
@@ -54,13 +54,14 @@ vars:
ppps
:
ppps
:
-
id
:
0
# ppp id
-
id
:
0
# ppp id
link
:
bond0.41
# 上行链路
link
:
bond0.41
# 上行链路
username
:
user
# 拨号用户名,密码在
上面的
pppoeUsers给出
username
:
user
# 拨号用户名,密码在pppoeUsers给出
mac
:
null
# 给ISP看的mac地址,null为随机
mac
:
null
# 给ISP看的mac地址,null为随机
pppoeUsers
:
dhcpv6
:
false
# 使用这里的DHCPv6,所有ppp只能有1个
pppoeUsers
:
# PPPoE帐号
-
username
:
user
-
username
:
user
password
:
pass
password
:
pass
smartdns
:
smartdns
:
disable_ipv6
:
false
disable_ipv6
:
false
# 是否禁用IPv6解析
tls_dns
:
tls_dns
:
-
8.8.8.8
-
8.8.8.8
-
1.1.1.1
-
1.1.1.1
...
@@ -70,3 +71,13 @@ vars:
...
@@ -70,3 +71,13 @@ vars:
china_dns
:
china_dns
:
-
114.114.114.114
-
114.114.114.114
-
223.5.5.5
-
223.5.5.5
services
:
tr069
:
[]
# tr069 网卡名列表
ddns
:
-
name
:
test-ddns
email
:
name@example.com
# cf邮箱
apiKey
:
qweqwe
# api密钥
zone
:
mycard.moe
# ddns主域名
subdomain
:
test
# ddns子域名
ipv6
:
false
# 是否解析ipv6
interface
:
brwan
# 网卡名,可以是null,null则用公网解析结果
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment