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
9b8678fb
Commit
9b8678fb
authored
Nov 25, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change mtu also for bridge
parent
c9e87584
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
9 deletions
+21
-9
files/bridge-post-scripts/post-up.sh.j2
files/bridge-post-scripts/post-up.sh.j2
+2
-0
files/bridge-post-scripts/pre-down.sh.j2
files/bridge-post-scripts/pre-down.sh.j2
+2
-0
files/ppp-post-scripts/postdown.sh.j2
files/ppp-post-scripts/postdown.sh.j2
+2
-0
files/ppp-post-scripts/postup.sh.j2
files/ppp-post-scripts/postup.sh.j2
+1
-9
files/utility.sh.j2
files/utility.sh.j2
+14
-0
No files found.
files/bridge-post-scripts/post-up.sh.j2
View file @
9b8678fb
...
...
@@ -14,6 +14,8 @@ ip addr add {{address}} dev {{br.name}}
{
% endfor %
}
{
% endif %
}
_change_mtu
-A
"
$BRIDGE_NAME
"
handle_gateway
()
{
GATEWAY_ID
=
$1
GATEWAY_ADDRESS
=
$2
...
...
files/bridge-post-scripts/pre-down.sh.j2
View file @
9b8678fb
...
...
@@ -7,6 +7,8 @@ export BRIDGE_NAME={{br.name}}
export
BRIDGE_ADDRESS
={{
br.address
}}
{
% endif %
}
_change_mtu
-D
"
$BRIDGE_NAME
"
handle_gateway
()
{
GATEWAY_ID
=
$1
GATEWAY_ADDRESS
=
$2
...
...
files/ppp-post-scripts/postdown.sh.j2
View file @
9b8678fb
#!/bin/bash
source
{{
ansible_user_dir
}}
/nextgen-router/scripts/utility.sh
_change_mtu
-D
"
$PPP_IFACE
"
PPPOE_NEXT_HOP_MARK
=
$[
1000 +
$(
echo
"
$PPP_IFACE
"
|
sed
"s/ppp//g"
)
]
PPPOE_SELECTION_MARK
=
$((
PPPOE_NEXT_HOP_MARK
+
50
))
...
...
files/ppp-post-scripts/postup.sh.j2
View file @
9b8678fb
...
...
@@ -4,15 +4,7 @@ source {{ansible_user_dir}}/nextgen-router/scripts/utility.sh
PPPOE_NEXT_HOP_MARK
=
$[
1000 +
$(
echo
"
$PPP_IFACE
"
|
sed
"s/ppp//g"
)
]
PPPOE_SELECTION_MARK
=
$((
PPPOE_NEXT_HOP_MARK
+
50
))
INTERFACE_MTU
=
$(
ip
link
show dev
"
$PPP_IFACE
"
|
grep
-oP
'mtu \d+'
|
cut
-c
5-
)
INTERFACE_MTU_4
=
$((
INTERFACE_MTU
-
40
))
INTERFACE_MTU_6
=
$((
INTERFACE_MTU
-
60
))
iptables
-w
-t
mangle
-A
FORWARD
-o
"
$PPP_IFACE
"
-p
tcp
-m
tcp
--tcp-flags
SYN,RST SYN
-m
tcpmss
--mss
$INTERFACE_MTU_4
:1460
-j
TCPMSS
--set-mss
$INTERFACE_MTU_4
iptables
-w
-t
mangle
-A
FORWARD
-i
"
$PPP_IFACE
"
-p
tcp
-m
tcp
--tcp-flags
SYN,RST SYN
-m
tcpmss
--mss
$INTERFACE_MTU_4
:1460
-j
TCPMSS
--set-mss
$INTERFACE_MTU_4
ip6tables
-t
mangle
-A
FORWARD
-o
"
$PPP_IFACE
"
-p
tcp
-m
tcp
--tcp-flags
SYN,RST SYN
-m
tcpmss
--mss
$INTERFACE_MTU_6
:1460
-j
TCPMSS
--set-mss
$INTERFACE_MTU_6
ip6tables
-t
mangle
-A
FORWARD
-i
"
$PPP_IFACE
"
-p
tcp
-m
tcp
--tcp-flags
SYN,RST SYN
-m
tcpmss
--mss
$INTERFACE_MTU_6
:1460
-j
TCPMSS
--set-mss
$INTERFACE_MTU_6
_change_mtu
-A
"
$PPP_IFACE
"
iptables
-w
-t
nat
-o
"
$PPP_IFACE
"
-A
POSTROUTING
-j
MASQUERADE
...
...
files/utility.sh.j2
View file @
9b8678fb
...
...
@@ -58,3 +58,17 @@ _wait_for_interface_online() {
done
echo "Interface $INTERFACE is OK."
}
_change_mtu() {
OPTION=$1
INTERFACE=$2
INTERFACE_MTU=$(ip link show dev "$INTERFACE" | grep -oP 'mtu \d+' | cut -c 5-)
INTERFACE_MTU_4=$((INTERFACE_MTU - 40))
INTERFACE_MTU_6=$((INTERFACE_MTU - 60))
iptables -w -t mangle "$OPTION" FORWARD -o "$INTERFACE" -p tcp -m tcp --tcp-flags SYN,RST SYN -m tcpmss --mss $INTERFACE_MTU_4:1460 -j TCPMSS --set-mss $INTERFACE_MTU_4
iptables -w -t mangle "$OPTION" FORWARD -i "$INTERFACE" -p tcp -m tcp --tcp-flags SYN,RST SYN -m tcpmss --mss $INTERFACE_MTU_4:1460 -j TCPMSS --set-mss $INTERFACE_MTU_4
ip6tables -w -t mangle "$OPTION" FORWARD -o "$INTERFACE" -p tcp -m tcp --tcp-flags SYN,RST SYN -m tcpmss --mss $INTERFACE_MTU_6:1460 -j TCPMSS --set-mss $INTERFACE_MTU_6
ip6tables -w -t mangle "$OPTION" FORWARD -i "$INTERFACE" -p tcp -m tcp --tcp-flags SYN,RST SYN -m tcpmss --mss $INTERFACE_MTU_6:1460 -j TCPMSS --set-mss $INTERFACE_MTU_6
}
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