Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    • Register
    • Login
    Introducing Netgate Nexus: Multi-Instance Management at Your Fingertips.

    Querying WAN IP of an inner router (pfsense) behind another router on NAT

    Scheduled Pinned Locked Moved NAT
    nat
    2 Posts 1 Posters 410 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      mickeyil
      last edited by

      Hi,

      I'm wondering if there's a way for a software running on a PC (Linux) to query an inner router's WAN IP (SG-1100 running pfsense), where the SG-1100 itself is connected behind another router and have an internal NAT IP as it's WAN IP.
      For example, suppose the SG-1100's WAN IP is 192.168.1.10 and the inner PC behind the SG-1100's NAT has the IP of 10.100.1.3.

      Here is the setup:

      PC --> SG-1100 --> outer router --> internet (WAN)
      

      My initial thought was to use traceroute with small ttl, but it gives the external router's IP (192.168.1.1) and not the SG-1100's IP.
      Is there any way the pfsense can be queried for its WAN IP? perhaps through a package?

      Would love to hear your thoughts about it.

      1 Reply Last reply
      Reply Quote 0
      • M
        mickeyil
        last edited by

        Found a manual (meaning outside of standard config / package) and hacky workaround, would love to hear of any improvement over that :)

        Create a user in pfsense's User Manager, enable SSH access for that user with a password-less SSH key login (I'm aware it's risky, extra precautions below).

        Create a script in the home user dir, show_wan_ip.sh, containing:

        #!/bin/sh
        ifconfig mvneta0.4090 | sed -n '/.inet /{s///;s/ .*//;p;}'
        

        Edit ~user/.ssh/authorized_keys and add the following before the key:

        command="/home/user/show_wan_ip.sh",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty 
        

        This can be executed from the (less trusted) PC that connects to it over LAN:

        ssh user@10.100.1.1 "/home/user/show_wan_ip.sh"
        192.168.1.10
        
        1 Reply Last reply
        Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post
        Copyright 2026 Rubicon Communications LLC (Netgate). All rights reserved.
        Privacy Policy · Cookie Policy