smcgrath12
Occasional Visitor
Hello, I am running Merlin 384.9 on RT-AC68. I have enabled both OpenVPN servers in TUN mode in the router. From what I see, the names of the interfaces are TUN21 and TUN22 every time (whenever I reboot the router or the OpenVPN process). I am not running any OpenVPN client on the router.
I have a requirement to add routes using these TUNs (Adding Multicast routes via SMCRoute). The commands need the correct name of the TUNs, it does not take "TUN+". Also, I cannot run these commands correctly unless both TUNs are UP and have IP addresses assigned to them when I run the commands. I tried using "services-start", but TUNs come up late in the boot process. A hard-coded delay works, but it is not ideal. Is there a "post-up" command (tied to an interface) available in the router that can run code when this "post-up" event is triggered for a new interface?
So, I would like to do:
1. How can my script get the TUN names (TUN21 and TUN22)? I look a peek at nvram and I could not find any reference to these named TUNs...
Or, how can you create a TUN adapter manually (using "ip tuntap" and "ip link set") in a persistent state? Then, can you force the OpenVPN server to use this "pre-existing" TUN and not create a brand new TUN? In this case, my script does not need to get the names of TUNs dynamically....
2. How can my script check the status of both TUNs, verifying that they are UP an IP assigned? I am assuming that I will need a while loop running continuously? Some sample code will be very helpful.
3. Should my script be tied to "services-start" or "openvpn-event"?
I have a requirement to add routes using these TUNs (Adding Multicast routes via SMCRoute). The commands need the correct name of the TUNs, it does not take "TUN+". Also, I cannot run these commands correctly unless both TUNs are UP and have IP addresses assigned to them when I run the commands. I tried using "services-start", but TUNs come up late in the boot process. A hard-coded delay works, but it is not ideal. Is there a "post-up" command (tied to an interface) available in the router that can run code when this "post-up" event is triggered for a new interface?
So, I would like to do:
1. How can my script get the TUN names (TUN21 and TUN22)? I look a peek at nvram and I could not find any reference to these named TUNs...
Or, how can you create a TUN adapter manually (using "ip tuntap" and "ip link set") in a persistent state? Then, can you force the OpenVPN server to use this "pre-existing" TUN and not create a brand new TUN? In this case, my script does not need to get the names of TUNs dynamically....
2. How can my script check the status of both TUNs, verifying that they are UP an IP assigned? I am assuming that I will need a while loop running continuously? Some sample code will be very helpful.
3. Should my script be tied to "services-start" or "openvpn-event"?