Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scripts
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
infra
scripts
Commits
108b95d6
Commit
108b95d6
authored
May 09, 2024
by
devteam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update rc.rotas
parent
c87fc347
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
rc.rotas
rotas_failover/rc.rotas
+5
-4
No files found.
rotas_failover/rc.rotas
View file @
108b95d6
...
...
@@ -16,11 +16,12 @@ declare -g NT_LINK2
obter_informacoes_rede
(){
local
interface_param
=
$1
IP_CIDR
=
$(
nmcli
-g
IP4.ADDRESS dev show
$interface_param
)
#IP_CIDR=$(nmcli -g IP4.ADDRESS dev show $interface_param)
IP_CIDR
=
$(
nmcli
-f
ipv4.addresses con show
$interface_param
|
grep
-oiP
'ipv4.addresses:\s+\K\S+'
)
IP_ADDRESS
=
$(
echo
$IP_CIDR
|
cut
-d
'/'
-f1
)
SUBNET_MASK
=
$(
echo
$IP_CIDR
|
cut
-d
'/'
-f2
)
GATEWAY
=
$(
nmcli
-
g
IP4.GATEWAY dev show
$interface_param
)
NETWORK_ADDRESS
=
$(
ipcalc
-n
-b
-n
-s
-b
$IP_CIDR
|
grep
Network |
awk
'{print $2}'
)
GATEWAY
=
$(
nmcli
-
f
ipv4.gateway con show
$interface_param
|
grep
-oiP
'ipv4.gateway:\s+\K\S+'
)
NETWORK_ADDRESS
=
$(
ipcalc
-n
bs
$IP_CIDR
|
grep
-iPo
"(?<=network=)
\S
+"
)
echo
"
$IP_ADDRESS
$SUBNET_MASK
$GATEWAY
$NETWORK_ADDRESS
"
}
...
...
@@ -63,7 +64,7 @@ main(){
GW_LINK1
=
$(
echo
$resultado
|
cut
-d
' '
-f3
)
NT_LINK1
=
$(
echo
$resultado
|
cut
-d
' '
-f4
)
resultado
=
$(
obter_informacoes_rede
$IF_LINK
1
)
resultado
=
$(
obter_informacoes_rede
$IF_LINK
2
)
IP_LINK2
=
$(
echo
$resultado
|
cut
-d
' '
-f1
)
MASK_LINK2
=
$(
echo
$resultado
|
cut
-d
' '
-f2
)
GW_LINK2
=
$(
echo
$resultado
|
cut
-d
' '
-f3
)
...
...
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