4
I have a local (HTTP) server running on my (Linux) machine (listening on 127.0.0.1:port) and a local application that connects to it as a client. Both the server and client applications are proprietary and I can only change some basic config for both. I have had this set up working fine until recently when the client application was updated. The client application now seems to require that the server it connects to must be "on the internet" so it is disallowing connections to 127.0.0.1 and other "local-like" addresses such as 10.0.*.* and 192.168.*.*.
As a workaround, I am now using ngrok to get a remote address for my local server and the client application happily works with that. However, that is a manual/slow process to run ngrok and update the client application's config and it requires an internet connection and going through ngrok's servers.
I am wondering if there is a way to "fake" an "internet-like" IP address to resolve directly to my local machine.
I have looked into "dynamic DNS" solutions but they require changes to router config that I often don't have control over.
What I am thinking is along the lines of setting some porn site's "internet-like" IP to "resolve" to my local machine on my local machine using some kind of "virtual network adapter" BUT I don't want to spend a lot of time building such a set up. Hence, the question, is there an EASY way to do this?
4Is there a reason why you don't want to add a non-local-sounding IP address to one of your interfaces? – Ignacio Vazquez-Abrams – 2018-02-11T05:40:20.877
@IgnacioVazquez-Abrams No, I am open to it. I just don't know an easy/quick way of doing it. – SBhojani – 2018-02-11T06:04:05.840
@IgnacioVazquez-Abrams Is https://www.garron.me/en/linux/add-secondary-ip-linux.html the kind of thing you are suggesting?
– SBhojani – 2018-02-11T06:11:25.957@IgnacioVazquez-Abrams I just tried
ip address add 31.192.120.36/31 dev lo
and the client application doesn't like the that either. Could it be checking the local ip config? – SBhojani – 2018-02-11T06:39:25.5332@SBhojani don't add it to dev lo, add it to eth0. If you've been adding the local network addresses like 192.168.. to dev lo, try those on the eth0 adapter instead of lo and they might work there. – BeowulfNode42 – 2018-02-13T10:54:09.313
@BeowulfNode42 The Linux machine is a VirtualBox VM and doesn't have eth0 for some reason. It has enp0s3, enp0s8 and virbr0 instead. I tried with
ip address add 31.192.120.36/31 dev enp0s3
and it didn't work either. – SBhojani – 2018-02-16T13:17:33.433@SBhojani It looks like you have Predictable Network Names and need to post the output of
– BeowulfNode42 – 2018-02-17T05:43:43.487ip a
. As a guess I would think you need to assign the IP address to the vibr0 adapter.