How to create TCP tunnels with Pagekite - networking

I am a complete beginner when it comes to networking and I am trying to set up a TCP tunnel on my machine using pagekite. I want to route all traffic from a TCP address to a port on my localhost, let's say 8080. I would then start a handler on localhost:8080 to deal with the incoming traffic. I can get this to work with ngrok simply by doing ngrok tcp 8080, but on a free ngrok plan I cannot reserve tcp addresses and ngrok is rather slow, so I opted to try and use pagekite.
Pagekite normally allows easy tunnelling to an HTTP address, but they have a guide here about how to use PuTTY along with Pagekite to create a TCP tunnel proxied by HTTP.
I followed their guide but could use some help figuring out if it does what I want it to do.
I am working on a Linux VM, so I first set up an SSH server with openssh like this: sudo service ssh start
I then exposed that SSH server using pagekite like this: python3 pagekite.py 22 ssh:user.pagekite.me
I then started PuTTY, and configured the Host Name to be user.pagekite.me on port 22, setup an HTTP proxy with the proxy hostname user.pagekite.me on port 443 and finally created a tunnel from the PuTTY machine with source port 8080 and destination localhost:8080.
Now I am not sure what this actually accomplished. I know that the PuTTY machine connected to the ssh server running on my VM and I am able to use the linux terminal from the PuTTY terminal but has this actually created a TCP tunnel from user.pagekite.me:8080 to localhost:8080? Additionally after doing this, if I try to setup the handler on localhost:8080 I get the following error:
Handler failed to bind to 0.0.0.0:8080
Rex::BindFailed The address is already in use or unavailable: (0.0.0.0:8080).
Again I am completely clueless when it comes to networking so if anyone could explain what it is I'm doing and if it is even possible to do what I want the way that I am doing it, that would be quite helpful.

Related

WebSocket-Sharp doesn't respond to public IP address

I have a problem hosting WebSocket-Sharp on a public internet IP. Locally it works fine.
This problem occurs on Windows and Linux.
I do no receive a timeout or an HTTP status code, the page blocks immediately.
I'm 99% sure I have port forwarding set up correctly; I've tried with an Android modem, VPN and regular NAT router setup.
I've tried the following combinations:
192.168.1.2:80 8080 5000 39393
0.0.0.0: ....
public IP: ....
The problem resides in the HttpServer provided with WebsScketSharp. The pure websocket variant (WebSocketServer.cs), instead of the HttpServer option with Get functionality, has an option to set AllowForwardedRequest to true so will be reachable from non localhost addresses. The HttpServer class doesn't support this.
It is partially a solution as I gave up regular GET functionality, but thats fine by me.
Ok, assuming your server with the public Ip addres is Linux:
Check what ports are listening and what program are listening in those
netstat -tulpn
Check your Firewall rules both in the provider and in the Server
sudo ufw status
See if connections are getting to your Server
sudo tcpdump
You can filter for the port of for origin Ip (if you use a proxy that will be different Ip).
sudo tcpdump | grep "80\|123.45.67.89"
That's the only way to see if the packets are getting into the server.
Let me know if you use Docker as thinks work a bit different.
You can create a tunnel and try like if it was local
ssh -L 80:123.45.67.89:80 ubuntu#yourserver.com
Cheers

SSH No Route to Host

I apologize for the novice question, but have been struggling on this for many hours. I am running Ubuntu Server on Ubuntu 16.04. I can ssh fine into local host (thus know ssh server is running)
However, when I try to log into my server externally, I get the error message shown below (yes I know port 22 is not secure):
I have enabled port 22 on my /etc/ssh/sshd_config file and allowed the ListenAddress to be everything by leaving it empty (tried with other addresses), and ensured that my iptables are open:
Finally, I am using a static IP address. And ensuring that I am forwarding ports:
I am not including a port triggering as I do not believe that it is necessary?
What do I need to do to expose this server externally and be able to SSH into it? Any help is very much appreciated.
Solved, no responses required. My internal ip address that I had my port forwarding selected for was different than the internal ip address that my computer was on.

Cannot access chef-server web interface. (No route to host)

I have got chef-server installed on a centos machine.
Everything is working as expected except that I cannot access the chef-server web interface from another machine on my local network.
I can access the web interface from the centos machine itself:
telnet mychefserver.local 4000
Connected
If I do the same from my machine I have got:
telnet: Unable to connect to remote host: No route to host
I can successfully ping mychefserver.local from my machine
Any idea how to configure nginx with chef-server to access the chef-server from the network?
Since Chef Server 10, the web interface uses normal HTTPS (TCP 443), it only listens on the high ports locally, and nginx proxies as needed to the different backend services. I would try with a normal web browser as telnet isn't exactly great at error messages. Normally I would expect that to mean telnet is getting TCP transmission errors, but maybe it is just confused? If it is really a TCP transmit error then more likely the internal DNS is having issues. .local often means mDNS which has uneven support in some places, I would try an actual IP address to be sure.
My issue was iptables.
I stopped iptables and I can access the chef-server from my local network again.

port forward http port (80) on virgin super hub

I am currently working on a project to make my apache server live, which is new me so this is the first time I am doing anything like this. basically I have gone in to the router and requested port forwarding on port 80 for my local IP address, but to no effect. when I test it with a web tool which tells you if a port is open or not it says it's closed. More confusingly when I run a netstsat -a command it shows http as listening. I'm not sure if its a firewall issue or I'm going about it all wrong. any Ideas would be much appreciated. Thanks
You need to be testing from outside your local network. If you run netstat on your server, of course it is going to say "listening". Is your web testing tool being run from outside your firewall? You should also be able to turn off wifi on your phone and test hitting your broadband IP address:80. Are you forwarding from port 80 on your router to port 80 on your server? Is it possible that your provider is blocking port 80 for residential accounts?
First google for an online port scanner and ask it to scan port 80.
Second if you're using Ubuntu ufw (firewall) is probably running default deny rules so do this: sudo ufw allow 80
To check it's working just plug your WAN IP into your browser URL bar, it should connect to your test page in /var/www/html/index.html

How to try out HTTP, FTP, SMTP etc. application protocols

I am reading Computer Networking: A Top-Down Approach 5th (fifth) edition. I have reached chapter two and I wonder if it is possible to actually try out the different application protocols by writing the requests etc? I am using Windows if that matter if you need a tool for doing that, and if I need a tool, what does the tool do behind the scenes for connecting?
You should use telnet to connect to all of these protocol, do your request, reading the answer and so on.
I'm reading that telnet is disabled by default on newer windows version (unbelievable, why? Thank goodness I stopped using it!)... Follow this guide to re-enable it if you're using a windows version newer than xp.
Telnet was used to remotely login to a host. Today it's completely unsafe to use it in this way, as long as a telnet connection isn't encrypted and we have such a better tool like ssh for remote connection. However, you can think to Telnet as a generic TCP client. It can establish TCP connection on every port.
By default, it will try to attempt to connect to port 23 (that is the telnet port) but you can easily change that.
For example, if you want to test HTTP, you can write in your command line:
~$ telnet www.example.com 80
Trying 192.0.43.10...
Connected to www.example.com.
Escape character is '^]'.
Where 80 is the http port (of course, if you're running it locally, you should connect to localhost). Other lines state the connection is ready to receive a request. Now you can type any http command you want.
GET /
HTTP/1.0 302 Found
Location: http://www.iana.org/domains/example/
Server: BigIP
Connection: close
Content-Length: 0
Where GET / is the command I typed and the rest is the http response.
Changing the port number, you can speak to (almost?) every protocol in the internet.
Well you can them out like this.... just to name a few...
Ftp : ftp ip_addr or ftp domain_name
Telnet : telnet ip_addr or telnet ip_addr:port_no or tracert domain_name
tracert : tracert ip_addr or tracert domain_name
ping : ping ip_addr or ping domain_name

Resources