D
D
Dymok2018-11-12 23:03:04
linux
Dymok, 2018-11-12 23:03:04

How to raise a GRE tunnel on CentOS startup?

I'm trying to set up a GRE tunnel on CentOS, I made the /etc/gre.sh script:

#!/bin/bash
ip tunnel add gre1 mode gre remote 20.20.20.100 local 10.10.10.1
ip link set gre1 up
ip addr add 10.5.5.1/30 dev gre1

Added it to crontab as
@reboot /etc/gre.sh
But when the system starts, the tunnel does not rise, although the script definitely works. If you start it manually, the tunnel will rise.
The same script with the same crontab works on Debian9 but fails on CentOS7, what's the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saenara, 2018-11-13
@UnluckySerivelha

Try something like this .

N
nedoadimn, 2020-11-18
@nedoadimn

In the cron tab, after the @reboot entry, it is first written from which user you need to start, then after how many seconds after the system starts, then be sure to put ; and not: I figured out with this later to understand what the error is, in general, the entry should be like this
@reboot root sleep 10; /opt/gre.sh
And you need to give the script permissions to read, etc. chmod command

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question