localhost:8080 -> remote_webserver1:80
localhost:8081 -> remote_webserver2:80
localhost:139 -> remote_smbserver:139
On a Windows machine, though, I've been able to go a step further. I use the Microsoft Loopback Adapter to create several virtual network connections, each with their own local IP address. That way, I can set up my tunnels like so:
10.0.0.1:80 -> remote_webserver1:80
10.0.0.2:80 -> remote_webserver2:80
10.0.0.3:139 -> remote_smbserver:139
With corresponding entries in my hosts file, I can access those remote resources using their actual names and ports:
10.0.0.1 remote_webserver1
10.0.0.2 remote_webserver2
10.0.0.3 remote_smbserver
This makes things much easier when I physically move my machine on and off of the remote network, or for web-based apps that insist on absolute references instead of relative.
Can anyone suggest a way to create this type of virtual network connection in OS X (I'm using 10.5.8)? Thanks!
September 16 2009, 21:34:14 UTC 2 years ago
127.0.0.1 remote_webserver1
127.0.0.1 remote_webserver2
127.0.0.1 remote_smbserver
September 16 2009, 21:38:26 UTC 2 years ago
http://remote_webserver:8080/ and http://remote_webserver:8081/ like the OP mentions.
Sometimes that works, sometimes it doesn't (like if the remote server doesn't honor the hostname:port when it generates links).
The benefit of binding to alias IP addresses is that each tunnel can use its own port 80.
September 16 2009, 21:44:53 UTC 2 years ago
September 16 2009, 21:48:00 UTC 2 years ago
September 16 2009, 22:03:59 UTC 2 years ago
That can handle Cisco and Windows VPNs, but more and more customers get Sonicwall SSL VPNs that we can't automate, and can barely make work in Linux at all, nevermind Mac OS X.
Oh, and most customers that give us VPN access only allow one connection from our user, so only one person can work on them at a time. We've had to resort to doing SSH port forwarding (on Windows in PuTTY) to forward a connection from our office to their machines so that we can actually do all the work a particular customer demands we do. It's a filthy hack and makes us sad.
So all that said, I'll take an open port 22 over a VPN any day of the week. :o)
September 16 2009, 21:55:54 UTC 2 years ago
If you're just forwarding port 80 to a specific machine, a SOCKS proxy probably isn't what you need - you likely don't want all your traffic going over the tunnel.
September 16 2009, 21:34:58 UTC 2 years ago Edited: September 16 2009, 21:40:06 UTC
sudo ifconfig en0 alias 10.0.0.1 netmask 255.255.255.255Then set up the ssh tunnel using a command like this or your current scripts, modified appropriately:
sudo ssh -L 10.0.0.1:80:remote_webserver1:80 luser@tunnel_endpoint_server_hostnameWhen you're done using the tunnel or whatever, you can destroy the alias:
sudo ifconfig en0 -alias 10.0.0.1 netmask 255.255.255.255Edit to clarify: these commands will only work if the alias addresses you're choosing are on the real subnet that your primary IP is on. So if you're really 10.0.0.1 you'd want to create aliases in that same subnet.
If you wanted to use IPs that don't share the same subnet as the primary IP on that interface, you'll have to add routing for that subnet.
September 16 2009, 21:59:03 UTC 2 years ago
Well, it's still awesome, just less useful for me personally. Should sort the OP out, though!
September 17 2009, 00:46:21 UTC 2 years ago
September 16 2009, 23:51:00 UTC 2 years ago
no?
lo0 info as pulled from ifconfig on my macbook:
lo0: flags=8049
no?
lo0 info as pulled from ifconfig on my macbook:
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
inet6 fd47:f1f9:f1dd:6975:223:32ff:fecb:f164 prefixlen 128
September 17 2009, 02:03:12 UTC 2 years ago
September 17 2009, 00:43:43 UTC 2 years ago
I added the alias creation commands to the beginning of my shell script, and modified my SSH tunnels accordingly.
Now, if only I could figure out a way to automatically invoke the shell script destroying the aliases when I disconnect from the SSH host...
September 17 2009, 16:19:56 UTC 2 years ago