Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to replace 127.0.0.1 on my local machine for test purposes?

I know it may sound stupid but anyway. Maybe there is a trick?

I just want that the local web server receives requests from my local machine but somehow sees a different IP address? Even one single that is different from the infamous 127.0.0.1 would of a great assistance.

Are there any options available?

like image 572
User Avatar asked Dec 23 '22 11:12

User


2 Answers

Try 127.0.0.2 or 127.0.0.3 ... or ...

Seriously, try it!

Depending on your operating system, localhost might be reachable via the entire 127.0.0.0/8 network, so even 127.42.37.254 would reach localhost (it does on my Ubuntu machine).

like image 134
Joachim Sauer Avatar answered Feb 13 '23 21:02

Joachim Sauer


Or put an entry in your HOSTS file for anything you want, pointing to localhost.

like image 28
dkretz Avatar answered Feb 13 '23 21:02

dkretz