Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagetext
themeEmacs
titleDevice 1 (server)
 ifc tap0 192.168.1.1/24 up
 sshd tunnel add ssh_tun $ecRet tap0
 sshd -window=128000 -keepalive=30
 sshd start

На втором устройстве так же создадим интерфейс Configure secind device same way, create the "tap0" и назначим ему IP-адрес interface and assign the "192.168.1.2/24" .  Настроим параметры внутреннего окна, продолжительности проверки и значение интерфейса на сервере, если на сервере настроен интерфейс "tap0", нужно указывать IP address to it. Set the parameters of internal window, check duration and server interface value, if "tap0" interface was created on server, "-remote-if=0" . Логин и пароль должны совпадать с указанными на удалённой стороне. Опционально указываем алгоритм шифрования, алгоритм обмена ключами и другие параметры туннеля, получить список поддерживаемых алгоритмов можно командойcommand should be used. Login and password must match those on the remote side. Optionally, we can specify the encryption algorithm, the key exchange algorithm and other tunnel parameters, a list of supported algorithms is displayed by the command: "sshtun tap0 -algo-list", где where "kex" - алгоритмов SSH для обмена ключами SSH key exchange algorithms, "hostkey" - аутентификацииauthentication, "cipher" - кодирования данныхdata coding, "hash" - проверки данных и data verification and "compress" - сжатия данных. Активируем SSH демон. Для того что бы запустить SSH туннель, необходимо обязательно ввести команду data compression. Enable SSH daemon. In order to enable SSH tunnel, enter the "sshtun start" command.

Code Block
languagetext
themeEmacs
titleУстройство Device 2 (клиентclient)
 ifc tap0  192.168.1.2/24 up
 sshtun tap0 -window=128000 -keepalive=30 -remote-if=0
 sshtun tap0 ssh_tun:$ecRet@192.168.1.1 start
 sshtun tap0 -cipher-algos=aes256-cbc -kex-algos=diffie-hellman-group1-sha1 -hostkey-algos=ssh-rsa  -hash-algos=hmac-sha1 -comp-algos=none
 sshd start
 sshtun start
  • На разных концах туннеля можно настроить на tap-интерфейсах IP-адреса из разных подсетей (например At opposite ends of the tunnel is possible configure IP addresses from different subnets on tap interfaces (for example 192.168.1.1/24 и and 192.168.100.1/24). Однако при такой конфигурации с обеих сторон будут необходимы статические маршруты, настраиваемые командойHowever, this configuration require static routes on the both sides configured by the command:
Code Block
languagetext
themeEmacs
route add <net>/<mask> <local_interface_ip_address> -iface

При добавлении маршрута с указанием адреса локального интерфейса в качестве шлюза и опцией "-iface" пакеты будут отправляться через данный интерфейс (в нашем случае tap0).

...

When adding a route with the address of the local interface as a gateway and the "-iface" option, packets will be sent through this interface (in our case tap0).

  • To configure an SSH tunnel using a port other than "22".

На сервереOn the server:

Добавить команду Add the "sshd -port" с указанием порта в диапазоне 1command with port value in range 1...32767.

Code Block
languagetext
themeEmacs
sshd -port 32000

На клиенте:

В команду указывающую адрес сервера, логин и пароль следует добавить номер портаOn the client:

To the command specifying the server address, login and password, add the port number.

Code Block
languagetext
themeEmacs
sshtun tap0 ssh_tun:$ecRet@10.10.10.1:32000
  • Между двумя устройствами можно настроить более одного SSH-туннеля. Для этого создаются дополнительные tap-интерфейсыBetween two devices more than one SSH tunnel can be configured. To do this, create additional tap-interfaces.
Code Block
languagetext
themeEmacs
titleУстройство 1 (сервер)
ifc tap0 192.168.1.1/24 up
sshd tunnel add ssh_tun $ecRet tap0
sshd -window=128000 -keepalive=30
sshd start
ifc tap1 192.168.100.1/24 up
sshd tunnel add ssh_tun $ecRet tap1
sshd -window=128000 -keepalive=30
sshd start
Code Block
languagetext
themeEmacs
titleУстройство 2 (клиент)
ifc tap0  192.168.1.2/24 up
sshtun tap0 -window=128000 -keepalive=30 -remote-if=0
sshtun tap0 ssh_tun:$ecRet@192.168.1.1 start
sshd start
sshtun start
ifc tap1  192.168.100.2/24 up
sshtun tap1 -window=128000 -keepalive=30 -remote-if=1
sshtun tap1 ssh_tun:$ecRet@192.168.100.1 start
sshtun start

SSH-туннель между устройством Инфинет и клиентом, с запущенным openssh

...

SSH tunnel between the InfiNet device and the client running openssh

InfiNet device is configured as described above.

Code Block
languagetext
themeEmacs
ifc tap0 10.10.20.1/24 up
sshd tunnel add TEST QQTEST tap0
sshd start

В данном примере клиентское устройство это сервер с ОС Debian. На клиентском устройстве необходимо предварительно установить пакет uml-utilitiesIn this example, the client device is a server with Debian OS. Install the uml-utilities package on the client device first.

Code Block
languagetext
themeEmacs
tunctl
ifconfig tap0 up
ifconfig tap0 10.10.20.2/24
ssh -N –o Tunnel=Ethernet –w 0:0 TEST@10.10.20.1

Далее система запросит пароль и, при успешном его вводе, поднимется туннель, по которому могут быть переданы данные. Чтобы туннель работал в фоновом режиме следует использовать командуAfter that the system will request a password and a tunnel for data transmission will be established. To make the tunnel run in the background, use the command:

Code Block
languagetext
themeEmacs
ssh -fN –o Tunnel=Ethernet –w 0:0 TEST@10.10.20.1 
Без опции
Note
iconfalse
titleВНИМАНИЕ
NOTE

In case a password is set on the InfiNet device, without the -N (не выполнять команды) туннель, при наличии установленного на устройстве Инфинет пароля, не подниметсяoption (do not execute commands) the tunnel, will not be established.