Skip to content

Add AvmIpPortMapping

Gincules edited this page Apr 4, 2023 · 1 revision

Add-AvmIpPortMapping

Synopsis

Action: AddPortMapping
Available on: ✅ FRITZ!Box / 🚫 FRITZ!Repeater
Status: ✅
Remote access: ✅
Required rights: 🔧

Description

Port mapping entries are only allowed for hosts inside of LAN. Furthermore hosts can only add port mapping entries for themselves and not for other hosts in the LAN. It is not intended to allow port mapping entries for the guest network or hosts with IP addresses routed into WAN.

Input:

Data type Variable Example or Description
String NewRemoteHost 0.0.0.0
Ushort NewExternalPort 21
String NewProtocol UDP or TCP
Ushort NewInternalPort 21
String NewInternalClient 192.168.178.2
Boolean NewEnabled 1
String NewPortMappingDescription FTP-Server
Uint NewLeaseDuration 0

Output:

Data type Variable Example
String u urn:dslforum-org:service:WANIPConnection:1

Syntax

Add-AvmIpPortMapping
    [-Insecure]
    [-RemoteAccess]
    [-Url <String>]
    [-Port <Ushort>]
    [-Credential <PSCredential>]
    [-NewRemoteHost <String>]
    [-NewExternalPort <Ushort>]
    [-NewProtocol <String>]
    [-NewInternalPort <Ushort>]
    [-NewInternalClient <String>]
    [-NewEnabled <Boolean>]
    [-NewPortMappingDescription <String>]
    [-NewLeaseDuration <Uint>]

Examples

Example 1

This example describes how to run the command using a valid certificate and remote access.

[PSCredential]$Credential = Import-Clixml -Path "${env:APPDATA}\PScred\avmtools-credential.xml"

$splatParameters = @{
    RemoteAccess = $true
    Url = "https://myfritzaddress12.myfritz.net"
    Port = 443
    Credential = $Credential
    NewRemoteHost = "0.0.0.0"
    NewExternalPort = 21
    NewProtocol = "TCP"
    NewInternalPort = 21
    NewInternalClient = "192.168.178.2"
    NewEnabled = 1
    NewPortMappingDescription = "FTP-Server"
    NewLeaseDuration = 0
}

Add-AvmIpPortMapping @splatParameters

Example 2

This example describes how to run the command using local connection with a valid certificate.

[PSCredential]$Credential = Import-Clixml -Path "${env:APPDATA}\PScred\avmtools-credential.xml"

$splatParameters = @{
    Url = "https://fritz.box"
    Port = 49443
    Credential = $Credential
    NewRemoteHost = "0.0.0.0"
    NewExternalPort = 21
    NewProtocol = "TCP"
    NewInternalPort = 21
    NewInternalClient = "192.168.178.2"
    NewEnabled = 1
    NewPortMappingDescription = "FTP-Server"
    NewLeaseDuration = 0
}

Add-AvmIpPortMapping @splatParameters

IP address can be used instead of DNS name.

[PSCredential]$Credential = Import-Clixml -Path "${env:APPDATA}\PScred\avmtools-credential.xml"

$splatParameters = @{
    Url = "https://192.168.178.1"
    Port = 49443
    Credential = $Credential
    NewRemoteHost = "0.0.0.0"
    NewExternalPort = 21
    NewProtocol = "TCP"
    NewInternalPort = 21
    NewInternalClient = "192.168.178.2"
    NewEnabled = 1
    NewPortMappingDescription = "FTP-Server"
    NewLeaseDuration = 0
}

Add-AvmIpPortMapping @splatParameters

Example 3

This example describes how to run the command using local connection without a valid certificate.

[PSCredential]$Credential = Import-Clixml -Path "${env:APPDATA}\PScred\avmtools-credential.xml"

$splatParameters = @{
    Insecure = $true
    Url = "http://fritz.box"
    Port = 49000
    Credential = $Credential
    NewRemoteHost = "0.0.0.0"
    NewExternalPort = 21
    NewProtocol = "TCP"
    NewInternalPort = 21
    NewInternalClient = "192.168.178.2"
    NewEnabled = 1
    NewPortMappingDescription = "FTP-Server"
    NewLeaseDuration = 0
}

Add-AvmIpPortMapping @splatParameters

IP address can be used instead of DNS name.

[PSCredential]$Credential = Import-Clixml -Path "${env:APPDATA}\PScred\avmtools-credential.xml"

$splatParameters = @{
    Insecure = $true
    Url = "http://192.168.178.1"
    Port = 49000
    Credential = $Credential
    NewRemoteHost = "0.0.0.0"
    NewExternalPort = 21
    NewProtocol = "TCP"
    NewInternalPort = 21
    NewInternalClient = "192.168.178.2"
    NewEnabled = 1
    NewPortMappingDescription = "FTP-Server"
    NewLeaseDuration = 0
}

Add-AvmIpPortMapping @splatParameters
Clone this wiki locally