[systemd-devel] Enable port forwarding via upnp

Kai Krakow hurikhan77 at gmail.com
Wed Feb 25 11:34:51 PST 2015


Mike Gilbert <floppym at gentoo.org> schrieb:

> On Wed, Feb 25, 2015 at 2:16 AM, Kai Krakow <hurikhan77 at gmail.com> wrote:
>> Hello!
>>
>> Is it possible to somehow create a service which enables port forwardings
>> on my router using upnp? Currently, I guess it is not possible (except
>> maybe using ExecPost or ExecPre and the upnpc program). But when my
>> client IP changes via DHCP, it should be reapplied. Also, it needs to be
>> maintained as the programmed port forwardings would timeout and be
>> cleared from the router after a while. So it needs to be hooked up to
>> systemd-networkd somehow (at least that is what I am using).
>>
>> Please advice and tell your thoughts. Maybe it is just plain insane...
> 
> It seems like it would be easy to do this using dhcpcd or dhclient via
> a hook/script, assuming your DHCP lease times are shorter than the
> UPnP timeout period.

Oh, I never thought about exploiting those hooks to do it. Nice idea. But...

> I'm not sure if/how it would be possible when using networkd to
> configure the interface.

I imagine something integrated with systemd, or more specific, with the 
Listen directives for socket activated systemd units, or specifying 
something like "ForwardPorts" for non-socket-activated units. See other 
post...

-- 
Replies to list only preferred.



More information about the systemd-devel mailing list