How to forward calls from my remote host to my local one - putty

I wish all calls to my_remote_host:port to be redirected to my_local_host:port, where my remote host is Linux and my local host is Windwos

Open File C:\Windows\System32\drivers\etc\hosts
127.0.0.1 my_local_host

Related

windows: ping url fails but ping -4 url works in local network

I have been learning some network and system administration and encountered a puzzling problem.
SETUP:
I setup a small local offline network with a Windows Server 2019 and a Ubuntu server hosting gitea. In the Windows Server I have assigned a static IP of 169.254.0.2 and installed DNS and DHCP roles. In the Ubuntu server I have assigned a static IP of 169.254.0.3.
DNS has been configured with a primary zone funlab.abc. I created a single A record for gitea.funlab.abc. to point to 169.254.0.3. DHCP has been configured to lease addresses from 169.254.0.100 to 169.254.255.254. Subnet mask is 255.255.0.0.
PROBLEM:
With this setup, I successfully got client machines to connect to the local LAN network, transparently get a dynamic IP address, and access gitea.funlab.abc through the browser.
But in windows 10 client machines, I am unable to run ping gitea.funlab.abc in command prompt. I get an error message :
Ping request could not find host gitea.funlab.abc. Please check the name and try again
Git clone/push operations involving the URL gitea.funlab.abc also does not work.
However I can run ping -4 gitea.funlab.abc successfully. Git clone/push operations can also work if I replace the URL with the static IP. nslookup gitea.funlab.abc works correctly as well.
QUESTION:
Why is this happening? What did I misconfigure such that ping and git commands do not work?
Turns out ping and git commands works just fine when I change the IP address to 192.168.X.X. I guess windows treat the 169.254.X.X addresses differently.

scp from remote server to ec2-instance

I want to copy a folder from remote ubuntu to ec2-instance tried the below at remote ubuntu machine
scp -i </path/of/ec2_pemkey> -r <folder that I wanna copy> user#<ip of ec2>:/path/where/I wanna/copy
I copied my pem to remote and changed permissions chmod 400
error: connection timed out
The Connection Time out means that your local can't be able to reach the remote.
to debug :
Check if your remote machine authorize traffic from port 22 ( Security Group)
Check if You have the good public IP of your machine
If its was an error with your pem key or user (ubuntu) you will receive an access denied error.
From you comment, that means its was the IP of the machine missing or not good.
I missed adding ip address of my remote ubuntu machine to security groups of my ec2 instance. Once done, I was able to scp from remote ubuntu to ec2 instance.
Make sure security group type is SSH which enables port 22

OSX SSH tunnel from remote port to local

I've created SSH tunnels in the past, but I'm having trouble on OSX. I'm looking to take a website's port 80, and direct it to my localhost:8080. When I run this command
ssh -L 8080:<cloud_ip_address>:80 root#<cloud_ip_address> -N
I get the default apache 'it works!' page.
Why am I not getting the port 80 of the remote machine (which is running a web app)?
UPDATE
I still do not have a solution yet, but I have some more information. The page I am getting is the default page in /var/www/html but I am serving a Flask app which does not have static pages.
Because HTTP protocol contains not only the IP address, but also the hostname (the URL you type into your browser), which differs between the <cloud_hostname> and localhost. The easiest way to trick it is to create /etc/hosts (there will be some OSX alternative -- search ...) entry redirecting the hostname of your remote machine to localhost.
127.0.0.1 <cloud_hostname>
But note that in this case you will not be able to access the remote machine using the hostname!

Hosts file redirect to local computer directory

I have a local Apache server running on my desktop which allows me to run a local site which I want to access from my laptop.
I'm able to access the computer in my hosts file using '192.168.0.5 liam.pc' but I can't figure out how to enter a directory. I've tried '192.168.0.5/Hudex/public hudex.dev' but it doesn't seem to work.
How can I accomplish the effect I want?
HOSTS file:
127.0.0.1 localhost
127.0.0.1 zheil.dev
192.168.0.5 liam.pc

Access virtual host from guest os ( oracle virtual box)

I am using ubuntu 11.10 and have installed different virtual host on different ip like
127.0.0.2 www.example.local
127.0.0.3 www.wordpress.local
... etc
I want to test these website in IE9, for this i have install windows7 in oracle virtual box and also modified host file of windows7 and add this line 10.0.2.2 localhost at the end of the file and also create a new bridge adapted.
After all this setup i can access localhost of ubuntu from windows7, but find problem while accessing virtual host of ubuntu.
Please help me to access these virtual host on windows 7, i have already search google, ubuntu forum and stackoverflow for this but didnt find right answer.
If I understand you correctly, you want the virtual adapters ip, ie. the gateway ip.
Just add those lines you have added to Ubuntu's host file to the host file in your Windows 7 VM, replacing 127.0.0.x with 10.0.2.2 should make your Windows VM connect to your Ubuntu host for requests to those hosts. This should usually sufficient, unless your HTTP server is configured to serve www.example.local only for connection to 127.0.0.2 and similar for www.wordpress.local.

Resources