Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hooks for when link goes up and down #986

Closed
wants to merge 1 commit into from
Closed

Add hooks for when link goes up and down #986

wants to merge 1 commit into from

Conversation

Joibel
Copy link

@Joibel Joibel commented Apr 28, 2022

When the link has been established optionally run a supplied 'up-hook'
and when it goes down run 'down-hook'.

Allows simple interaction with other subsystems, in my case
reconfiguring proxies.

When the link has been established optionally run a supplied 'up-hook'
and when it goes down run 'down-hook'.

Allows simple interaction with other subsystems, in my case
reconfiguring proxies.
@pschichtel
Copy link

I'm using ppp's if-up and if-down scripts for this purpose. What would be the advantage of this?

@Tatsh
Copy link

Tatsh commented Jul 20, 2022

I'm using ppp's if-up and if-down scripts for this purpose.

How do you do that?

@DimitriPapadopoulos
Copy link
Collaborator

@DimitriPapadopoulos
Copy link
Collaborator

That said, I think it might be worth setting routing and DNS in a separate script called by openfortivpn, ideally vpnc-scripts. When needed, it can be replaced by alternate scripts such as vpn-slice or a custom script. We would get IPv6 support and better DNS as a bonus.

I just don't have the time to change openfortivpn myself these days.

@Joibel
Copy link
Author

Joibel commented Jul 20, 2022

Yeah, if-up and if-down do this, so lets abandon this.

@Tatsh
Copy link

Tatsh commented Jul 26, 2022

@pschichtel omitting the details, can you share your scripts that set up DNS with the pppd hooks?

@pschichtel
Copy link

pschichtel commented Jul 26, 2022

@Tatsh that's my /etc/ppp/ip-up.d/* script

#!/bin/bash

routes=(...)
dns_servers=(...)
search_domains=(...)

resolvectl dns "$1" "${dns_servers[@]}"
resolvectl domain "$1" "${search_domains[@]}"

for route in "${routes[@]}"
do
    ip route add "$route" dev "$1"
done

@Tatsh
Copy link

Tatsh commented Jul 26, 2022

@Tatsh that's my /etc/ppp/ip-up.d/* script

#!/bin/bash

routes=(...)
dns_servers=(...)
search_domains=(...)

resolvectl dns "$1" "${dns_servers[@]}"
resolvectl domain "$1" "${search_domains[@]}"

for route in "${routes[@]}"
do
    ip route add "$route" dev "$1"
done

So all your routes and DNS etc are static and known beforehand?

I would like to make the same kind of thing but I want to get it from the VPN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants