Re: open port

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16Feb2020 13:44, Patrick Dupre <pdupre@xxxxxxx> wrote:
I also tried:
ssh -f -L 5901:localhost.fr:5901 euripide sleep 10

bind [127.0.0.1]:5901: Address already in use
channel_setup_fwd_listener_tcpip: cannot listen to port: 5901
Could not request local forwarding.

Just to this part:

For things to which I connect regularly I allocate extra 127.0.0.n addresses to my local interface. This lets you bind to a specific address without conflict. Here's part of my local machine's ifconfig:

   % ifconfig -a
   lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
       options=3<RXCSUM,TXCSUM>
       inet6 ::1 prefixlen 128
       inet 127.0.0.1 netmask 0xff000000
       inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
       inet 127.0.0.31 netmask 0xff000000
       inet 127.0.0.25 netmask 0xff000000
       inet 127.0.0.23 netmask 0xff000000
       inet 127.0.0.2 netmask 0xff000000
       inet 127.0.0.3 netmask 0xff000000
   ... etc ...

I also make entries in /etc/hosts:

   127.0.0.28 solar.l
   ... etc ...

which lets you do things like this:

   ssh -f -L solar.l:5900:localhost.fr:5900 euripide sleep 10

i.e. bind the local port to a distinct 127.0.0.n address allocated for that ssh tunnel target. I've got over 30 such addresses and names on my personal machine, to support several tunnels.

Our home server does similar (on a lesser scale) and has this line in /etc/rc.local:

   addif -i lo 127.0.0.2..9

Note the "2..9" indicating I want 127.0.0.2 through 127.0.0.9. You can get addif here:

   https://bitbucket.org/cameron_simpson/css/src/tip/bin/addif

It is just a script to make the right "ifconfig" calls to add addresses, with the right OS-specific variants.

With this I have ssh clauses with preprepared port forward configurations using these. For example, my standard tunnel to the home server has (amongst other forwards):

   Host homeserver
       LocalForward          homeserver.l:5905 localhost:5905
       LocalForward          solar.l:5900 solar:5900

which forwards to the server's local vnc:5 desktop and also to the VNC on the solar monitoring box (which is on the home LAN).

Cheers,
Cameron Simpson <cs@xxxxxxxxxx>
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux