title: How to get server ip (web access ip) as a variable in python flask
body: <p>I have a Python flask server, its serving me on port 8080. Server can access through NAT . Real IP of server is 192.168.200.10 and after NAT this will be 192.168.100.10. </p>
  
  <p>I have a VNC server running on the same server, i fetched server IP by using ,</p>
  
  <pre><code>def sysip():
      sys_cmd = "ip  -f inet a show enp0s31f6| grep inet| awk '{ print $2}' | cut -d/ -f1"
      sysip = os.popen(sys_cmd).read()        
      return sysip
  </code></pre>
  
  <p>Web part,</p>
  
  <pre><code>&lt;a class="btn btn-primary btn-sm" href="http://{{sysip}}:6080/vnc.html" target="_blank" role="button"&gt;console &lt;/a&gt;
  </code></pre>
  
  <p>But this method is actually not making any sense, because of using NAT.</p>
  
  <p>Is there any way to append whatever 'IP' user accessing to web server, as vnc ip ?  </p>
  
  <p>Eg: <a href="http://192.168.100.10:8080" rel="nofollow noreferrer">http://192.168.100.10:8080</a>   -- Main server after using NAT</p>
  
  <blockquote>
    <p>Now for VNC I am getting <a href="http://192.168.200.10:6080/vnc.html" rel="nofollow noreferrer">http://192.168.200.10:6080/vnc.html</a>  (Because of above script)</p>
  </blockquote>
  
  <p>Instead i need <a href="http://192.168.100.10:6080/vnc.html" rel="nofollow noreferrer">http://192.168.100.10:6080/vnc.html</a></p>
  
  <p>Is there any method in Flask or javascript ?</p>