So, here is the thing. I have a server with static IP and a domain (example.com), and I have some other servers with changing locations and dynamic IPs and no domains. I wanna give them my subdomain (like 1.example.com); and when my costumers wanna go to 1.example.com, I want my main server forward them to the other server. So I need to run a program on my other servers that listen to their IPs and send them to main server, after that I need a program that run on my main server that listen to other servers for their IPs and update the bind subdomain records. I look the entire the Internet and I didn't find anything suitable for my situation.
PS: I got a situation that my network is limited and I can not use "no-ip" or "duckdns" or similar. I have apache2 on all the servers and they are all using "Ubuntu server".
What is the solution and what should I DO???!
11 Answer
Well, after so many tries and research I decided to write my own python program for Dynamic DNS Server. So for the first part I will post here the example of python codes that I used, consider that the code is not complete and I will post edit this post later.
ServerSide:
#----- A simple TCP based server program in Python using send()$
import socket
import logging
# Create a stream based socket(i.e, a TCP socket)
# operating on IPv4 addressing scheme
serverSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Bind and listen
serverSocket.bind(("**Localhost**",**port**))
serverSocket.listen(5)
print ('Hello client!')
# Accept connections
while(True): (clientConnected, clientAddress) = serverSocket.accept() print("Accepted a connection request from %s:%s"%(clientAddress[0], clientAddress[1])) dataFromClient = clientConnected.recv(1024) print(dataFromClient.decode()) # Send some data back to the client clientConnected.send("Hello User".encode()) user = dataFromClient cip = clientAddress LOG_FILENAME = '/log.txt' logging.basicConfig(filename=LOG_FILENAME,level=logging.DEB$ file = open("log.txt","r+") file.truncate(0) file.close() logging.debug(cip) logging.debug(user) logging.debug("--------------------------------------------$ClientSide:
import socket
# Create a client socket
clientSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Connect to the server
clientSocket.connect(("**Server's public**",**port**))
# Send data to server
data = 'Hello server'
clientSocket.send(data.encode())
# Receive data from server
dataFromServer = clientSocket.recv(1024)
# Print to the console
print(dataFromServer.decode())