Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
6
rated 0 times [  6] [ 0]  / answers: 1 / hits: 4212  / 2 Years ago, sun, february 20, 2022, 4:26:58

As my title suggest, I would like to set up a proxy in linux. The client that I'm using is a mac osx lion. I think I understand the theory but I keep hitting roadblocks.



I started using set proxy server ubuntu linux tutorial here. I already found a spare pc and installed ubuntu 12 on it. According to the article, I have to create an ssh tunnel from how to tunnel traffic with ssh article.



In ubuntu, I made sure that I have ssh server so I did a apt-get install ssh.



Then, it is time to forward ports on my router to individual machine. The individual machine, I assume, is my ubuntu machine which will act as a ssh server. My router is a Cisco Linksys E3000.



As I try to set up port forwarding, I came across this article. This is where it confuses me:




Enter your application name. For a list of which ports an application might use, see the Sources and Citations section below.




It seems that I have to know which application and what port they are using to access the internet??? For example, if I use the terminal in OSX, I need to specify 'Terminal' as the application and know what port it uses? And I need to repeat that for Chrome, firefox, App Store, Diablo 3, etc...?



Is that the standard way of channeling your internet traffic through a proxy so you can bypass firewall?



How do I set up my proxy such that all my internet connections goes through my ubuntu server and channels it back to my client (Mac OSX).



If anyone is interested, I wanted to do this because as I use heroku for my web app deployment, I keep running into firewalls at my workplace, while traveling, etc...



Thanks!!!


More From » server

 Answers
1

Using SSH tunnels: Ports and port forwarding on your router:


Using an ssh tunnel as a proxy involves setting up a local proxy on the default socks5 port (1080). All applications will then send their web traffic to that port, and it will then be sent through the encrypted ssh tunnel to your server and then to the internet.


The only application that your router needs to forward ports for is the ssh client/server--route all incoming TCP requests on port 22, to the IP address of your server on your local network.


Here's a picture illustrating this:


socks5sshtunnel


Let's take a look at the command used to create the SSH tunnel to understand how it works.


ssh -ND 1080 [email protected] -p 22

The above command is what creates this tunnel from the client to the server. -D 1080 set what sets up the socks5 proxy at local port 1080 for your applications to use. This is all on your local machine. Port 1080 does not need to be routed anywhere using your router.


user is your username on your server. 11.11.11.111 is the ip address of your server. -p 22 is the port that the ssh client tries to connect to your ssh server using (port 22 is the default so you don't really need to include -p 22 in your command if you haven't changed from the default, I just added it in for explanation purposes). This is the port that you will need to make sure your router is forwarding to your server. If you choose not to use the default ssh port (22) you will also need to configure your ssh server to listen on a different port.


To make applications use this tunnel...


you just have to modify their proxy settings (or use a global proxy--I'm not familiar with how OS X does this though) to use a socks5 proxy at localhost:1080 or 127.0.0.1:1080. For example this is how to do this with Firefox:


Using the menus go to Edit:Preferences:Advanced:Network:(connection)Settings


firefox proxy


To set a global proxy on OS X


I don't use OS X but the OP confirmed that this works (see comments). You can try installing this GUI tool for OS X, navigating to System Preferences -> Network -> Advanced... -> Proxies and entering 127.0.0.1 as the server and 1080 as the port.


Hope this helps.


[#38059] Tuesday, February 22, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
repend

Total Points: 195
Total Questions: 113
Total Answers: 107

Location: Nicaragua
Member since Tue, Dec 8, 2020
3 Years ago
repend questions
Thu, May 11, 23, 09:38, 1 Year ago
Thu, Jan 5, 23, 21:41, 1 Year ago
Mon, Nov 22, 21, 19:37, 2 Years ago
Mon, Jan 24, 22, 11:26, 2 Years ago
;