Switching VMs and The Static IP - linux

I recently changed the VM im running CentOS on to a new one, and everything works fine. Except that recently i face problems starting gogs, a self hosted git server, with the following error. As the erorr states, there is a problem with ip, apparently my old VM ip is still hardcoded somewhere in the VM, and this is the old ip im getting below.
Are there any linux configuration i should be aware of to update my new ip on the VM, knowing that ifconfig gets me the right ip, the new one.

Take a look at http://gogs.io/docs/advanced/configuration_cheat_sheet.html
You'll need to edit the file custom/conf/app.ini and change the value of HTTP_ADDR

Thanks to #Etan Reisner, I checked the /etc/hosts file on the system and made sure that host and dig from the new system return the correct IP address.

Related

vSphere Cloud-Init not keeping the static IP

I'm getting odd behavior that I don't understand in dealing with vSphere and Terraform. My terraform code provisions a host in vSphere with a static network configuration (network, IP, mask, gateway, etc.), and on the first boot, it seems to be correct. The IP and relevant network settings are applied.
However on reboot, the network configuration falls back to DHCP, which fails.
I see in the /var/log/cloud-init.log file that on the first boot, it is able to successfully apply the config:
However after that, on reboot, it reverts to DHCP?
I noticed this issue when trying to bring up Consul on the host, and Consul complained that there wasn't an IPv4 address to bind to. So, when I rebooted, the IP was gone. So I don't think the address is applying correctly.
The terraform code works for DHCP based networks, but for some reason when I apply static configurations, it adds it once, and then doesn't seem like it keeps.
Anyone ever hit this similar issue?
Edit:
Troubleshooting further by reading the cloud-init debugs:
This is the first boot, which should be the base template.
The second boot, which should be the deployed host receiving the config from terraform -> cloud-init:
...it's a bug in vSphere.
https://kb.vmware.com/s/article/71264
Symptoms
Virtual Machine has cloud-init customization enabled and a static IP
After reboot the virtual machine is configured with DHCP
Cause
This issue occurs due to cloud-init considering the virtual machine as a new instance. This instance can not retrieve data from the datasource when there is no customization, and will have DatasourceNone applied defaulting to DHCP.
Resolution
Currently there is no resolution.
Workaround
To workaround this issue apply one of the following.workarounds:
Add the setting manual_cache_clean: True to the /etc/cloud/cloud.cfg for the customized virtual machine.
Uninstall cloud-init from the virtual machine

IP address set to static, cannot get connection to server

I set my server with static IP address from the Network and Sharing Center. My server is an Azure VM. After setting it with static IP, i lost connection to my Machine. I check from the portal.azure.com, the server status is running but i realize that the network out dropped to 0MB.
I can't remote desktop to the server, I tried restart the server from Azure, but it doesn't come back alive (At this point i mean i can't remote desktop to it).
What can i do next? Is that's all? I just screw up my server?
Please help! I believe there's some miracle to let it get back to life.
This link describes the correct way to set internal private static IP addresses to azure VMs (using Powershell). You can try the step "How to remove a static internal IP from a VM" but I'm not sure if it will undo the change you've made within the OS - did you try shutting down the VM completely and restarting it?
ps- this question probably suits Server Fault rather than Stack Overflow.
Sorry for late reply. Didn't notice this question until now.
Actually, the server is no longer accessible after setting the IP address. Later then I found out you shouldn't set a static IP for an Azure VM. It should be assigned by DHCP.
So.. lesson learn i guess.. :I

Windows Server 2012 with IIS can't connect to it's own public IP

I encountered a very strange issue I've seen more often but could workaround. A VPS with Windows Server 2012 on it and IIS installed is unable to access its own webpages by its public IP.
When I open up Internet Explorer on the VPS and goto localhost, I see the default IIS page. Whenever I try the public IP, it times out.
If I access the same IP from another PC, I can also see the IIS page.
I've tried pinging to my public IP from the VPS, this works. I then tried to disable my firewall all to no avail.
Has someone encountered this before? And more importantly: Did you manage to fix it and if so, how?
Most likely then this is a NAT issue caused by how the NAT gateway/router is configured your connections go via. I'd recommend talking to your host and confirming whether this is the reason and if they are willing to do anything to resolve it. That might be difficult if it is a limitation of the router or done for security reasons that they are unwilling to change.
Running some Wireshark traces should be able to confirm what is happening.
You may be able to resolve it your self with Split DNS and the use of a domain name rather than direct to an IP address. Why do you need to use the IP specifically?
Read serverfault.com/questions/216569/cant-ping-static-ip-from-internal-network-only-from-outside for some further insight.

bind ip to subdomain

i have a linux client which uses pppoe to connect to the internet and
everytime this client comes online I wanna bind his ipadress to a subdomain.
dyndns is not an option due to their TTL.
It looks like i have to setup my own nameserver on my root server to accomplish this task because I cannot create the keys needed to run an nsupdate on the client with a provider nameserver... am I correct?
If so is there a good Howto for setting up a bind server for this specific task?
I havent ever maintained pppoe but if it uses dhcp to provide the ip address to the client, you could do updates from the dhcp to the dns.
Instructions on how to do this for debian here: http://www.debian-administration.org/article/Configuring_Dynamic_DNS__DHCP_on_Debian_Stable
Do not thou that you can adapt these to other distros too. You can find the same software atleast on fedora and ubuntu, difference is only how you install the required software.
One posibility is to set their machine to register with somebody like DynDNS. They have all the software you need to automatically notify them when they come online/go offline. This will give them a domain name of something like whatever.homelinux.org (it does not really matter). You then put static CNAME entries in your DNS to point your nice domain names eg southern.company.com to point to whatever.homelinux.org.
When they come online the domain will start to resolve and stop when they go off line since DynDNS have low TTL for this very reason. You can use large TTL in your zone file since the CNAMEs will not change.
Well dont you just need to create an A-Record for this IP on your DNS Server?
If your domain is 'google.com' and you wanted your host to be called 'server1'. Create an A-Record for 'server1' and point it to your machines IP.
Unless I am misunderstanding what you are asking for help with.

Wrong DNS for just one site on development machine

www.superyoink.de is my clients' website. I can access it from any machine except my development one.
If I ping it on my development machine, I get 80.67.28.107 - this is wrong.
My laptop, next to me, is able to resolve it correctly.
I have tried putting correct address into hosts like so:
93.187.232.191 www.superyoink.de
Still resolves to wrong address.
Rebooted, did ipconfig /flushdns nothing seems to work.
Can anyone suggest a way to fix this?
A few things you could try:
Double check your hosts file to make sure you don't have more than one entry for www.superyoink.de. You may wish to include the content of your hosts file with your question.
Compare the hosts file of your development machine and the laptop. Assuming that the contents should be similar -- are there any significant differences with respect to www.superyoink.de?
Compare the network configuration of your development machine and the laptop. Are both machines using the same DNS servers or different DNS servers?
Have you checked the DNS servers match a "working" machine?

Resources