0
anuj9122

dynamic ip

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.

Share this post


Link to post
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

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
0