New Member
Posts: 18
Registered: ‎05-14-2013
Kudos: 1

UPNP - "Could not retrieve address of local host"

[ Edited ]

Hi,

 

I recently started using the EdgeMax and it has been quite straighforward thanks to the great info on this forum. However I have a few questions - here is the first

 

I configured UPNP as shown below

 

show service upnp
listen-on eth1 {
outbound-interface eth0
}

 

The EdgeMax does not seem to respond to UPNP portmap requests - 

 

When I try to connect to the router using PortMapper (a java test program running on my PC) I get the following messages:

 

INFO Using default configuration directory 'C:\Users\PK\AppData\Roaming\UnknownApplicationVendor\PortMapper'.
INFO Creating router factory for class org.chris.portmapper.router.sbbi.SBBIRouterFactory
INFO Searching for routers...
INFO Connected to router IGD Version 1.00
WARN Did not get presentation url
INFO Got external IP address 82.xx.xxx.xxx for router.
INFO Get all port mappings...
INFO Found 0 mappings

 

When I attempt to configure a Port Mapping by sending a UPNP request from PortMapper I get an error message stating "Could not Retieve Address of Local Host".

 

Any suggestions?

 

The full Config is below

 

firewall {
    all-ping enable
    broadcast-ping disable
    conntrack-expect-table-size 4096
    conntrack-hash-size 4096
    conntrack-table-size 32768
    conntrack-tcp-loose enable
    ipv6-receive-redirects disable
    ipv6-src-route disable
    ip-src-route disable
    log-martians enable
    name WAN_IN {
        default-action drop
        description "Packets from Internet"
        enable-default-log
        rule 1 {
            action accept
            description "Allow Established Sessions"
            log disable
            protocol all
            state {
                established enable
                invalid disable
                new disable
                related enable
            }
        }
        rule 2 {
            action drop
            description "Drop Invalid State"
            log disable
            protocol all
        }
    }
    name WAN_Local {
        default-action drop
        description ""
        rule 1 {
            action accept
            log disable
            protocol all
            state {
                established enable
                invalid disable
                new disable
                related enable
            }
        }
        rule 2 {
            action drop
            log disable
            protocol all
        }
    }
    receive-redirects disable
    send-redirects enable
    source-validation disable
    syn-cookies enable
}
interfaces {
    ethernet eth0 {
        address dhcp
        description WAN
        duplex auto
        firewall {
            in {
                name WAN_IN
            }
            local {
                name WAN_Local
            }
        }
        speed auto
    }
    ethernet eth1 {
        address 192.168.1.1/24
        description PKN
        duplex auto
        speed auto
    }
    ethernet eth2 {
        address 192.168.2.1/24
        description Cisco
        duplex auto
        speed auto
    }
    loopback lo {
    }
}
service {
    dhcp-server {
        disabled false
        shared-network-name Cisco-DHCP {
            authoritative disable
            subnet 192.168.2.0/24 {
                default-router 192.168.2.1
                lease 86400
                start 192.168.2.100 {
                    stop 192.168.2.254
                }
                static-mapping Cisco_891 {
                    ip-address 192.168.2.10
                    mac-address 64:9e:f3:ae:97:a9
                }
            }
        }
        shared-network-name PKN-DHCP {
            authoritative disable
            subnet 192.168.1.0/24 {
                default-router 192.168.1.1
                dns-server 192.168.1.1
                lease 86400
                start 192.168.1.100 {
                    stop 192.168.1.254
                }
            }
        }
    }
    dns {
        forwarding {
            cache-size 150
            dhcp eth0
            listen-on eth1
        }
    }
    gui {
        https-port 443
    }
    lldp {
    }
    nat {
        rule 5000 {
            description "Masquerade for WAN"
            log disable
            outbound-interface eth0
            protocol all
            type masquerade
        }
    }
    ssh {
        port 22
        protocol-version v2
    }
    upnp {
        listen-on eth1 {
            outbound-interface eth0
        }
    }
}
system {
    host-name PKN-Gateway
    login {
        user ubnt {
            authentication {
                encrypted-password $1$zKNoUbAo$gomzUbYvgyUMcD436Wo66.
            }
            level admin
        }
    }
    ntp {
        server 0.ubnt.pool.ntp.org {
        }
        server 1.ubnt.pool.ntp.org {
        }
        server 2.ubnt.pool.ntp.org {
        }
        server 3.ubnt.pool.ntp.org {
        }
    }
    syslog {
        global {
            facility all {
                level notice
            }
            facility protocols {
                level debug
            }
        }
    }
    time-zone UTC
}


/* Warning: Do not remove the following line. */
/* === vyatta-config-version: "config-management@1:dhcp-relay@1:dhcp-server@4:firewall@4:ipsec@3:nat@3:qos@1:quagga@2:system@4:ubnt-pptp@1:vrrp@1:webgui@1:webproxy@1:zone-policy@1" === */
/* Release version: v1.1.0.4543695.130312.1019 */

 

Previous Employee
Posts: 10,504
Registered: ‎06-09-2011
Kudos: 3141
Solutions: 945
Contributions: 16

Re: UPNP - "Could not retrieve address of local host"

[ Edited ]

When I try PortMapper I get:

WARN  Could not get address of localhost. Please enter it manually.
INFO  Adding port mappings for preset foo
INFO  Adding port mapping foo
INFO  Adding port mapping TCP :1 -> 192.168.1.10:1 enabled foo
INFO  Adding port mapping foo
INFO  Adding port mapping TCP :15 -> 192.168.1.10:15 enabled foo
INFO  Adding port mapping foo
INFO  Adding port mapping TCP :16 -> 192.168.1.10:16 enabled foo
INFO  Portmapping was added successfully
INFO  Get all port mappings...
INFO  Found 3 mappings

 So even though I get that message, I am able to connect to the router and am my port mappings.

 

Also from the router I can see those mappings add to iptables:

 
ubnt@WLB:~$ sudo iptables -vnL PREROUTING -t nat
Chain PREROUTING (policy ACCEPT 1564 packets, 164K bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 DNAT       tcp  --  eth2   *       0.0.0.0/0            0.0.0.0/0           tcp dpt:16 to:192.168.1.10:16 
    0     0 DNAT       tcp  --  eth2   *       0.0.0.0/0            0.0.0.0/0           tcp dpt:15 to:192.168.1.10:15 
    0     0 DNAT       tcp  --  eth2   *       0.0.0.0/0            0.0.0.0/0           tcp dpt:1 to:192.168.1.10:1 
 2954  322K VYATTA_PRE_DNAT_HOOK  all  --  *      *       0.0.0.0/0            0.0.0.0/0           

 

 

EdgeMAX Router Software Development
New Member
Posts: 18
Registered: ‎05-14-2013
Kudos: 1

Re: UPNP - "Could not retrieve address of local host"

I don't have any success

 

If I click "connect" on Portmapper then it finds the router and shows "External Address" as 82.xx.xxx.xxx but "Internal Address" is empty

If I then try to apply the mapping I get the error about not being able to retrieve the internal address

If I disconnect from the router and then try to apply the mapping as you have then I get a log stating it is adding the mappings (like you) but there is no confirmation that it has succeded and the router doesn't show any mappings

 

Is there a firewall rule that needs to be set for UPNP to work properly?

 

BTW, the EdgeMax provides an empty "Presentation URL" which means that you can't double click on the router icon to access the management interface (from windows)

Also, it would be nice if the UPNP "friendlyname" is set to the "System Host Name" as specified in the general settings (and stored in /etc/hostname)

 

 

INFO  Using default configuration directory 'C:\Users\PK\AppData\Roaming\UnknownApplicationVendor\PortMapper'.
INFO  Creating router factory for class org.chris.portmapper.router.sbbi.SBBIRouterFactory
INFO  Searching for routers...
INFO  Connected to router IGD Version 1.00
WARN  Did not get presentation url
INFO  Got external IP address xx.xx.xxx.xxx for router.
INFO  Get all port mappings...
INFO  Found 0 mappings
INFO  Router Info: friendlyName 	= Linux Internet Gateway Device
INFO  Router Info: manufacturer 	= Linux UPnP IGD Project
INFO  Router Info: manufacturerURL 	= http://linux-igd.sourceforge.net
INFO  Router Info: modelDescription 	= null
INFO  Router Info: modelName 	= IGD Version 1.00
INFO  Router Info: modelNumber 	= null
INFO  Router Info: modelURL 	= null
INFO  Router Info: presentationURL 	= null
INFO  Router Info: serialNumber 	= null
INFO  Router Info: urlBase 	= http://192.168.1.1:49152
INFO  Router Info: vendorFirmware 	= Linux/2.6.32.13-UBNT, UPnP/1.0, Portable SDK for UPnP devices/1.8.0~svn20100401
INFO  def loc http://192.168.1.1:49152/gatedesc.xml
INFO  def loc data <?xml version="1.0"?>

 

Regular Member
Posts: 371
Registered: ‎03-31-2013
Kudos: 230
Solutions: 22

Re: UPNP - "Could not retrieve address of local host"

It looks like the machine you are using for testing doesn't have get DHCP configuration. I checked your DHCP server settings and I can not gather your topology. Can you please share your interface connections and their addressing schemes (dhcp, static, etc.)? From which ERL interface (eth0, eth1?) is your machine trying to open ports to ERL?


Marcos
Previous Employee
Posts: 10,504
Registered: ‎06-09-2011
Kudos: 3141
Solutions: 945
Contributions: 16

Re: UPNP - "Could not retrieve address of local host"

I doubt it's a firewall issue (at least not on the router) since you only have a firewall on eth0 and upnp is listening on eth1.

EdgeMAX Router Software Development
Previous Employee
Posts: 10,504
Registered: ‎06-09-2011
Kudos: 3141
Solutions: 945
Contributions: 16

Re: UPNP - "Could not retrieve address of local host"

BTW, you probably arleady know this, but even though UPnP can be a very convenient feature, it can also be a security risk.  Even the Homeland Security suggests disabling UPnP.

EdgeMAX Router Software Development