Jump to content

dynamic ip


anuj9122

Recommended Posts

Hi

 

I need help.I search forum but i cannt find anything. 

 

I am using dynamic ip from my isp. I am making hosting server. Everything works great but when i configure email server from this link https://www.digitalocean.com/community/tutorials/how-to-run-your-own-mail-server-with-mail-in-a-box-on-ubuntu-14-04  so i need to install bind.

 

 

 

The issue is is it possible to write automatically dynamic ip address in the host file? I am using cubieboard 1.

 

 

Please tell me or put me the the right track.

Link to comment
Share on other sites

4 hours ago, anuj9122 said:

The issue is is it possible to write automatically dynamic ip address in the host file?

Your question is a bit vague ...

If you wish to get your external IP address, here is a small python script that could help :

#!/usr/bin/python

import urllib, httplib, json

headers = {"User-Agent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1",
	"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
	"Accept-Language": "en-us,en;q=0.5",
	"Connection": "keep-alive" }
conn = httplib.HTTPConnection("api.ipify.org")
conn.request("GET", "/?format=json", "", headers)
r1 = conn.getresponse()
data = r1.read()
jsonobj = json.loads(data)
myIP = jsonobj['ip']
print myIP

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines