Sometimes we want to run some commands before or after the TUN device is started, so there are two tun-pre-up and tun-post-up args that can be used in such scenarios.
- TUN-Pre-UP: The commands specified in the
tun-pre-up option are executed before the TUN device is created.
- TUN-Post-UP: The commands specified in the
tun-post-up option are executed after the TUN device has been created.
For example, if we want to run a script to automatically configure the ip address for our interface addresses and routes, we can use tun-post-up arg like this:
Please note that the script you provided must have the execution permission.
Multiple Commands
If we want to run multiple commands with tun-pre-up or tun-post-up args, we can call a shell to do the trick, e.g.:
OR in Windows: