[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
howtos:network_services:tunnel_interfaces [2013/02/11 01:11 (UTC)] – [Sources] ricky_cardo | howtos:network_services:tunnel_interfaces [2020/06/25 13:38 (UTC)] – [Results] ricky_cardo | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | <!-- Add your text below. We strongly advise to start with a Headline (see button bar above). --> | ||
====== Tunnel Interfaces ====== | ====== Tunnel Interfaces ====== | ||
If you are looking to establish an SSH tunnel between two networks and treat the tunnel as an interface, this may help. | If you are looking to establish an SSH tunnel between two networks and treat the tunnel as an interface, this may help. | ||
- | * First I would recommend enabling rc.ip_forward in /etc/rc.d/ (on local and target machines) | + | * First I would recommend enabling rc.ip_forward in /etc/rc.d/ (on local and target machines) <code bash> |
- | <note tip>chmod +x / | + | root@darkstar: |
- | or for a temporary (loose at reboot) way use | + | </code> or for a temporary (lose at reboot) way use <code bash> |
- | <note tip>echo " | + | root@darkstar: |
- | + | </code> | |
- | * Next I'm using autossh found at slackbuilds.org The below script requires it. | + | * Almost forgot you will need to enable tunneling in / |
- | * You will also want to have non-interactive ssh connections set up. Meaning authorized_keys setup with public/ | + | root@darkstar: |
- | * Also assuming you have sudo privledges | + | `\ by\ `/ |
- | * Next I'm using a little | + | * Next I'm using autossh found at [[http://slackbuilds.org/ |
- | <file bash rc.tunnel># | + | * You will also want to have non-interactive ssh connections set up. Meaning |
+ | * Also assuming you have sudo privileges | ||
+ | rich ALL=(ALL) NOPASSWD: ALL | ||
+ | </ | ||
+ | * Next I'm using a simple | ||
+ | #!/bin/bash | ||
########################################################### | ########################################################### | ||
Line 20: | Line 24: | ||
# | # | ||
target=74.79.121.210 | target=74.79.121.210 | ||
+ | port=22 | ||
# | # | ||
+ | ########################################################### | ||
+ | # suggestions contact rich at lehcar.duckdns.org | ||
+ | # with thanks to Billy T (for idea and assistance) | ||
########################################################### | ########################################################### | ||
#load module | #load module | ||
/ | / | ||
#load remote module | #load remote module | ||
- | / | + | / |
- | sleep 1 | + | /bin/sleep 1 |
- | / | + | / |
/bin/sleep 4 | /bin/sleep 4 | ||
- | / | + | / |
/ | / | ||
/ | / | ||
- | / | + | / |
/ | / | ||
- | / | + | / |
- | / | + | / |
- | / | + | / |
</ | </ | ||
- | To direct traffic over the tunnel try: | + | * To direct traffic over the tunnel try: <code bash> |
- | <note tip>sudo /sbin/route add -net 74.125.131.0 netmask 255.255.255.0 dev tun0</note> | + | user@darkstar: |
+ | </code> | ||
+ | |||
+ | * To substitute normal ssh rather than autossh substitute this line below for the one with autossh (line 20)<code bash> | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | To recap some of the options: | ||
+ | |||
+ | ==== Results ==== | ||
+ | |||
+ | Now you can access the remote computer using "'' | ||
+ | |||
+ | I'm not going to be able to elaborate on the iptables rules still a little green there, but they work. | ||
+ | Here are a couple usage examples. | ||
+ | **/ | ||
+ | **/ | ||
====== Sources ====== | ====== Sources ====== | ||
<!-- If you are copying information from another source, then specify that source --> | <!-- If you are copying information from another source, then specify that source --> | ||
<!-- * Original source: [[http:// | <!-- * Original source: [[http:// | ||
<!-- Authors are allowed to give credit to themselves! --> | <!-- Authors are allowed to give credit to themselves! --> | ||
- | < | + | |
<!-- * Contributions by [[wiki: | <!-- * Contributions by [[wiki: | ||
<!-- Please do not modify anything below, except adding new tags.--> | <!-- Please do not modify anything below, except adding new tags.--> | ||
- | <!-- You must remove the tag-word " | + | {{tag> |
- | {{tag> | + |