Register Eureka Client as hostname instead of localhost - netflix-eureka

I have my Eureka server running on a remote raspberry pi. I have other Eureka clients on other pi's and they are working fine. I'm trying to run another client on my laptop but when it registers with the Eureka service it is registering as localhost. Obviously this will not work because the client is not running on the same host as the Eureka server. How can I get my client to register it self with the actual hostname (or IP) instead of localhost?

You can either set eureka.instance.hostname="your-host-name" for the client in its config to whatever you want it to register with, or try setting eureka.instance.prefer-ip-address=true
See https://cloud.spring.io/spring-cloud-netflix/multi/multi_spring-cloud-eureka-server.html#spring-cloud-eureka-server-prefer-ip-address

Related

Configuring an IP address in Spring Boot admin client

I am using Spring Boot admin version 2.6.9 and using
spring.boot.admin.client.instance.prefer-ip=true
to register to admin server via an IP address. Now since I am running my apps inside Docker containers, the admin server receives Docker IP addresses and not the public IP addresses
of the applications.
I have tried changing management.address, but that does not work.
I can not use the Docker network to connect to these machines and I can not change the server.address property. I have tried the below properties as well, but they don’t show anything on the admin server apart from online status.
spring.boot.admin.client.instance.service-url=http://11.0.134.202:9999
spring.boot.admin.client.instance.management-url=http://11.212.134.202:9999
I got it working using
spring.boot.admin.client.instance.prefer-ip=true
spring.boot.admin.client.instance.service-url=http://127.0.0.1:9999
spring.boot.admin.client.instance.management-url=http://127.0.0.1:9999/actuator

How to set up a client/server connection using port forwarding

I created a multi-threaded client/server application that can send messages to each other at real time. Everything works perfectly, but I want to be able to send messages over the Internet. From what I understand, I need to do port forwarding to be able to make my server reachable for the clients. I then set up my port forwarding options by providing a port (9991) and then my Macbook Air's IP Address (192.168.0.1).
I then tried to connect to my server using my public server IP (let's say 197.132.20.222) and it didn't work. I then tried to see if the port forwarding worked by using this website: https://www.yougetsignal.com/tools/open-ports/ and I realized that the connection was closed. I also tried the command nc -vz 197.132.20.222 9991 while running my application and the connection is refused.
I'm using a JavaFX application, and for my server side I use a ServerSocket with port 9991. For the client side, I use a Socket and set the IP Address to my public router IP Address, and I tried to connect with another PC using mobile data to use a different network.
My firewall settings are turn off, so I really don't know what is blocking my application to connect to that port. Could it be my ISP is blocking connections? I just don't understand why my ports are blocked even with no firewalls enabled.

Xdebug cannot connect to remote DBGp Proxy

I am running Xdebug extension on PHP webserver (IIS), and VSCode on different development machine.
When I start listening for Xdebug session in VSCode (with Felix Becker's PHP Debug) without proxy, everything works as expected.
Now I am trying to use dbgpProxy because there are multiple devs on the development machine.
I have tried to run dbgpProxy on the webserver and register to it by activating proxy settings in VSCode, but it fails with Connection refused. At the same time, Xdebug connects to the proxy just fine and proxy tries to forward incoming session based on IDE key but of course cannot find it because the registration failed.
So I tried running dbgpProxy on the development machine. This time VSCode registered successfully with the proxy, but when Xdebug tried to connect to the listening proxy, it failed.
I was pretty sure I knew what I was doing, ports were open, everything SHOULD work but it didn't.
It turned out to be a problem in the IP addresses.
I ran the proxy with default settings, which is localhost (127.0.0.1) for both server and client part with respective ports 9000 and 9001. Which was wrong (for my situation).
To listen to the incoming connections from another machine, proxy has to be configured with real IP address of the machine it is running on, otherwise it won't listen.
In my case I have decided to run the proxy on the server, so I run it with just one parameter for the incoming client connections and leave the server parameter default (which is 127.0.0.1:9000 and of course configure XDebug in php.ini to this address and port).
dbgpProxy.exe -i 10.123.54.76:9001

Reverse OpenVPN connection

I am close to getting this to work but need some assistance.
I have OpenVPN Access server running on a Droplet in Digital ocean.
I have a RaspberryPi with a wireless connection on my network.
IP = 192.168.20.205
The user the pi connects to the Access server is set to be a VPN gateway with :
Allow Access From: all server-side private subnets
Allow Access From: all other VPN clients
192.168.20.0/24.
I have another user that connects to the Access server without the gateway settings.
When both users connect I can see them both in the web GUI of the access server with an IP assigned. 172.27.232.XXX
Now from the remote user I can ping the Pis 172.xxx.xxx.xxx IP address and even SSH into it using the 172 address.
However, it seems like the Pi isn't bridging / routing correctly or getting stopped by a firewall, as from the remote user I cant see the local network 192.168.20.xxx.
any pointers for me here?
Thanks!
The solution to your problem is clearly explained here:
https://openvpn.net/vpn-server-resources/site-to-site-routing-explained-in-detail/
You have to set the static routes on both routers and set the ip forward on the raspberry pi

Unable to access jetty server with local IP address

I have configured jetty-maven-plugin in my eclipse Mars and I can run the server using jetty start and stop goals. I can able to access the website using http://localhost:8080/myapp but not using local IP address(i.e., http://192.168.0.5:8080/myapp) from my own computer or other computers connected in the same network via LAN and Wi-Fi.
As mentioned as a solution in these posts,
how to make jetty server accessible from LAN?
Configuring Jetty to accept connections from all hosts
I configured the server host to 0.0.0.0 from localhost to listen on all hosts. With this setting I can see on server start log,
INFO:oejs.AbstractConnector:Started SelectChannelConnector#0.0.0.0:8080
and it works only on http://localhost:8080 but it's not accessible from http://192.168.0.5:8080.
I also tried running that if the interface is accessible using the Networks Interface Listing as mentioned in this comment. and I got,
Display name: NETGEAR WNA1000M N150 Wireless USB Micro Adapter
Name: wlan4
InetAddress: /192.168.0.5
I also tried turning off my Windows Firewall/antivirus but din't help. My jetty version is <jetty.version>9.3.0.M1</jetty.version> and JDK 1.7. What could be the problem? Any help is appreciated.
McAfee Endpoint Security was the culprit here. It was blocking the requests with IP addresses from my very own computer. Turned off the firewall inside the Antivirus and I was able to access the site with http://192.168.0.5:8080/mysite from the browser and other devices connected through the network.
Sometimes some other program opens your port on external address before you do that with Jetty. It will receive all traffic instead. On Windows you will not know it if you reuse port (that is Jetty's default behavior). Check with netstat -ano what is the IP of the process that is indeed listening on 0.0.0.0:8080. Verify if it is your Jetty process only.
Then try connecting with telnet or netcat and see if you can open the connection and what is the response.