Actualiser server
parent
16d863e504
commit
48396128be
1 changed files with 24 additions and 3 deletions
25
server.md
25
server.md
|
@ -1,10 +1,31 @@
|
|||
only reboot if vpn isn't used
|
||||
# only reboot if vpn isn't used
|
||||
|
||||
```bash
|
||||
if [ $(ifstat -i tun0 1s 1 | awk 'NR==3 {print $1}' | sed 's#\..*##') -eq 0 ]; then systemctl reboot; fi
|
||||
```
|
||||
|
||||
fix routing
|
||||
# fix routing
|
||||
|
||||
> replace `<localip>` by the IP
|
||||
|
||||
## `routing.sh`
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
# supression d'une ancienne route
|
||||
ip route del <localip> 2> /dev/null
|
||||
# ajoute de la nouvelle route avec la bonne IP
|
||||
ip route add <localip> via $(ip -4 -br addr show tun0 | awk '{split($3,a,"/"); print a[1]}') dev tun0
|
||||
|
||||
echo "Done :)"
|
||||
|
||||
# vérification
|
||||
# ip route
|
||||
```
|
||||
|
||||
## run the script
|
||||
|
||||
```bash
|
||||
if [ $(ip route | grep <localip> | wc -l) -ne 1 ]; then /root/openvpn/routing.sh; fi
|
||||
```
|
Loading…
Reference in a new issue