Score:0

server address and ip in ubuntu 20.04

ru flag

I have not used ubuntu much, only when I have to deploy a web. Right now I am trying to deploy a python django web, but I have an issue with ip address.

So, I tried python manage.py runserver at first, and it gave timed-out errors. Server address, which I was told by my supervisor and which I can only access via putty, is xxx.yy.zzz.aaa. When I tried to deploy my python django web specifically to this address by using python manage.py runserver xxx.yy.zzz.aaa:8000, I get an error saying

that ip address can't be assigned to.

I used few other ports like 8001, but still it did not work.

So, I used the following command to see what ip address is.

ifconfig

And I got three addresses: one is localhost (127.0.0.1), the other is related to docker, which I did not create. The third is under hostname enp---, but it is not xxx.yy.zzz.aaa. It is completely different one.

So, then, I googled some more and I used the following command.

curl https://ipinfo.io/ip

Then, I get the "correct" address xxx.yy.zzz.aaa.

I do not know much about network and ip in ubuntu, but can ubuntu have different ip's besides docker ip address? If so, then how can I set the ip address so that I can use xxx.yy.zzz.aaa to deploy python django web?

uz flag
Jos
As I understand it, a Django server process listens for incoming connections at a given port, which is 8080 by default. It may be that another process has already claimed that port. Either deploy your Django web at another port, or find out which process is running at that port (`sudo netstat -tulpn`) and kill it.
beginnercoder avatar
ru flag
@Jos Jenkins is running at port 8080, so I tried to run Django at port 8000 by using ```python manage.py runserver xxx.yy.zzz.aaa:8000```, but still it does not work. I did the same for all other addresses including docker just in case, but still no luck.
uz flag
Jos
This is useful information. Please add it to your question (comments are sometimes cleaned up).
beginnercoder avatar
ru flag
@Jos, just edited my question. Thanks.
raj avatar
cn flag
raj
Your server probably sits behind a NAT, and public (external) IP address xxx.yy.zzz.aaa is being translated to the internal (private) one you see on enp--- interface. The translation is done probably somewhere **outside** your server. You need to get more information about that NAT, because the only thing you know right now is that the NAT forwards requests to port 22 (ssh) on xxx.yy.zzz.aaa to your Ubuntu server. It is not known whether it forwards any other ports that you can use for your web app.
beginnercoder avatar
ru flag
@raj thanks. Then, I have to find more about NAT and that whole translating ip address situation. In the meantime, do you know, by any chance, if, and how, I could use external ip address to deploy django? If I understood correctly, I should be able to access django when I deploy it to 0:8000, but I can't right now.
raj avatar
cn flag
raj
Without knowledge about the NAT configuration, it's hard to say on which address and port you can deploy the app and if this is possible at all without changing the NAT configuration.
beginnercoder avatar
ru flag
@raj okay, got it. Thanks. At least now I know how I should go about this.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.