Доступ SSH для новичков
Устройство OpenWrt по умолчанию всегда прослушивает доступ к командной строке SSH на порту 22. Для ssh в маршрутизатор» вы вводите команду ssh root@192.168.1.1 в эмуляторе терминала (для маршрутизатора с адресом 192.168.1.1).
В первый раз, когда вы подключитесь к маршрутизатору, вы, вероятно, увидите предупреждение о отпечатке ключа RSA. Если вы уверены, что это адрес вашего маршрутизатора OpenWrt, просто введите yes и нажмите Return. Затем введите пароль, предоставленный вашему маршрутизатору, или нажмите Return, если это начальная настройка. Вот пример сеанса:
$ ssh root@192.168.1.1Чтобы завершить ssh сеанс на маршрутизаторе, введите exit и нажмите Return.
Остальная часть этой страницы описывает несколько эмуляторов терминала, которые Windows, Linux или macOS могут использовать для доступа к вашему маршрутизатору OpenWrt.
Терминальные эмуляторы Windows
Cmder, Smartty, Putty и WinSCP являются терминальными эмуляторами, которые позволяют вам сходить в маршрутизатор.
Использование Cmder
Cmder для Windows эмулятор терминала с открытым исходным кодом, который работает в Windows. Он может свободно использовать и обеспечивает легкую “оболочку командной строки” которая позволяет вам ssh в OpenWrt. Его привлекательные шрифты и цветовая схема легко видны на глазах. Полное распределение является предпочтительным (over the mini distribution), так как она обеспечивает эмуляцию Баша, с Unix-й набором команд.
Загрузить cmder из https://cmder.net/ Распакуйте cmder.zip файл
Откройте папку Cmder и дважды щелкните Cmder значок. Вы увидите окно Cmder, похожее на изображение ниже.
Чтобы передать ssh в маршрутизатор OpenWrt на 192.168.1.1, введите ssh root@192.168.1.1 затем нажмите Return
![]()
Использование Smartty
Smartty дает вам доступ к командной строке для OpenWrt и позволяет вам открывать /редактировать/загружать/загружать файлы в OpenWrt и в целом более современную и удобную для пользователя, чем Putty (еще один инструмент, описанный ниже):
Загрузите Smartty из http://sysprogs.com/SmarTTY/: выберите “загрузить” для установщика или «портативную версию“, если вы хотите, чтобы это была отдельная программа, которая работает без установки.
после установки или после распаковки архива, дважды щелкните по исполняемому файлу SmarTTY.Вы будете приветствованы окном с двумя вариантами, дважды нажмите “setup новое соединение SSH ” (другая опция предназначена для последовательных подключений, для usb- TTL -ключей и иногда вы подключаетесь к серийным выводам устройства на плате, мы выиграли Не используйте это сейчас).
Окно изменится в настройку SSH , напишите следующую информацию: Имя хоста: IP -адрес устройства OpenWrt (по умолчанию 192.168.1.1) Имя пользователя: root (это “администратор” и только пользователь по умолчанию OpenWrt)Пароль: оставьте это поле пустым для вашего первого подключения, а затем напишите пароль, который вы установили (либо в графическом интерфейсе Luci, либо после первого доступа к SSH )
Нажмите кнопку “Подключиться” внизу, и теперь вы увидите большой экран терминала.По умолчанию в прошивке OpenWrt отсутствует серверный компонент, позволяющий открывать /редактировать/просматривать/загружать/загружать файлы в Smartty, поэтому после того, как вы подключились к интернету, напишите, opkg update && opkg install openssh-sftp-server чтобы установить его. Если следующий шаг завершится неудачно, возможно, потребуется перезагрузить устройство OpenWrt для запуска этой новой службы.
Теперь вы можете нажать Файл → Открыть удаленный файл чтобы открыть всплывающее окно с файловой системой устройства OpenWrt, и вы можете перемещаться по нему и открывать текстовые файлы, например, как обычно (они будут открываться в окне текстового редактора SmarTTY)
Если вы хотите загрузить или загрузить файлы в/из определенной папки на устройстве, вы можете щелкнуть по меню SCP и выбрать наиболее подходящее действие оттуда.
После первого подключения к устройству Smartty сохранил профиль, поэтому вы можете снова подключиться к тому же устройству (на этом IP -адресе с этим паролем), просто дважды щелкнув значок в первом окне, которое вы видите при запуске Smartty. Вы можете щелкнуть правой кнопкой мыши по этому значку профиля, чтобы изменить его, если необходимо.
Использование putty
Putty дает вам доступ к командной строке для OpenWrt:
Загрузите Putty https://www.putty.org: просто получите 32-разрядную “putty.exe” загрузку из “Alternative binary files” раздела.
Начните “putty.exe”с вашего клиента Windows. Появится окно входа в систему Putty.перейдите в “Session” категорию окна входа в Putty, найдите поле “Host Name” (or IP address) и просто введите IP -адрес (например, 192.168.1.1 ) вашего устройства OpenWrt, сохраните порт 22 по умолчанию.
Нажмите Open кнопку в нижней части, чтобы открыть соединение. Это вызовет окно оболочки, спрашивая login as . Войдите как root с паролем OpenWrt, который вы определили некоторое время раньше. Если вы еще не установили пароль “root”, вам не будет задан пароль.
Выполнено, вы вошли в командную строку OpenWrt.Использование WinSCP
WinSCP позволяет просматривать файловую систему OpenWrt в Windows Exlorer, например, в стиле GUI :
Сначала вам необходимо установить SFTP -сервер со стороны OpenWrt, так как WinSCP нуждается в том, чтобы успешно соединиться. В командной строке putty (см. Предыдущий раздел) выполните:
opkg update opkg install openssh-sftp-serverОбычно этого не требуется, но для простоты этого способа перезагрузите ваше устройство OpenWrt, чтобы убедиться, что служба SFTP действительно запущена
Скачать WinSCP из https://winscp.net/eng/download.php, получить не-бета Installation package или portable executables установить или распаковать их на клиенте Windows ,
Начните WinSCP.exe с вашего клиента Windows, появится окно входа WinSCP.Нажмите New Site слева, затем введите свой IP -адрес устройства OpenWrt (192.168.1.1) с правой стороны Host name , сохраните порт по умолчанию 22 . В User name enter root, in Password , введите ваш root пароль (или оставьте пустым, если вы не установили пароль еще)
Нажмите Login на нижнюю часть окна. Готово. Теперь у вас есть вид, похожий на Exlorer, на вашу файловую систему OpenWrt.Редактирование конфигурационных файлов OpenWrt с помощью встроенного графического редактора WINSCP:
для редактирования конфигурационного файла OpenWrt с помощью редактора WinSCP с графическим интерфейсом щелкните правой кнопкой мыши файл в WinSCP и выберите “Edit” из контекстного меню.Linux Terminal Emulators
Все дистрибутивы Linux предоставляют клиентский интерфейс ssh как часть стандартной установки.
Откройте эмулятор терминала и напишите ssh root@192.168.1.1 (“ssh» - это команда, root это пользователь OpenWrt, к которому вы подключаетесь, а 192.168.1.1 это светодиод по умолчанию OpenWrt)
появится сообщение о принятии нового ключа от устройства OpenWrt, напишите “yes” и нажмите клавишу “Ввод”.
Если по какой-то причине вы переустановили OpenWrt, у устройства будет другой ключ, и вы получите сообщение о несоответствии ключей. В этой ошибке будет указано, что является командной строкой для копирования-вставки в вашем терминале, чтобы удалить старый ключ и продолжить.
если вы хотите закрыть сеанс, напишите “exit”Обычно у Linux также есть клиенты SCP (для открытия/редактирования/загрузки/выгрузки файлов в OpenWrt), которые могут быть установлены или не установлены по умолчанию. Вам нужно найти документацию вашего дистрибутива или выполнить поиск с помощью интерфейса управления пакетами для “SCP”, чтобы найти, где он находится, и его текущий статус установки. Прочтите его встроенное руководство (“man scp”, например, для клиента командной строки SCP) или google некоторые учебные пособия, чтобы узнать, как его использовать.
macOS Terminal Emulators
На macOS (ранее Mac OSX) любой эмулятор терминала позволит вам ssh. Там несколько терминальных эмуляторов:
Терминал - встроенная терминальная программа macOS. Найти его /Приложения/УтилитыiTerm2 https://iterm2.com/ значительно улучшенная терминальная программа. Пожертвования - это того стоит.
Чтобы подключиь ssh в вашем маршрутизаторе OpenWrt на 192.168.1.1, введите ssh root@192.168.1.1 , и нажмите Return.
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website. OK More information about cookies
- Last modified: 2020/01/10 15:01
- by stokito
Self-registration in the wiki has been disabled.
If you want to contribute to the OpenWrt wiki, please post HERE in the forum or ask on IRC for access.
Except where otherwise noted, content on this wiki is licensed under the following license:
CC Attribution-Share Alike 4.0 International
Как получить доступ по ssh к openwrt роутеру подключенному в режиме клиента wifi?
Роутер с опенврт подключен в режиме клиента к основному роутеру, раздающему интернет по вайфай. Хотелось бы получить доступ к веб интерфейсу или ssh роутера openwrt через мобильный телефон, который подключен к роутеру раздающему интернет. Опенврт роутер кое-как настроил, теперь его можно подключить к компьютеру и он отдает интернет в ethernet, при этом на ethernet статический адрес 192.168.2.1 по которому с компютера можно подключиться по ssh. если же отключаю его от ethernet то по вайфай не могу получить доступ к ssh. При этом если сканировать с телефона сеть роутера раздающего вайфай, то роутер с опенврт имеет адрес 192.168.1.206 (и все устройства 192.168.1.*) как настроить сеть, чтоб получить доступ к ssh опенврт роутера с телефона?
- Вопрос задан более двух лет назад
- 1148 просмотров
Если я правильно понял, у вас есть основной роутер, раздающий интернет, и роутер с OpenWRT, не выполняющий никакой дополнительной функции на данный момент.
Измените логику настроек в OpenWRT так, чтобы WAN-зоны не было вовсе, а была одна большая LAN. VLAN у WAN-порта тоже заведите в LAN. У LAN отключите DHCP, назначьте статический адрес. Такой настройкой у вас OpenWRT будет выступать свитчом.
Ответ написан более двух лет назад Комментировать Нравится Комментировать Ваш ответ на вопросВойдите, чтобы написать ответ

- Системное администрирование
- +1 ещё
Как «из коробки» прикрутить uefi к wds?
- 2 подписчика
- вчера
- 78 просмотров
SSH access for newcomers
One of the methods to manage OpenWrt is using command-line interface over SSH. OpenWrt listens for incoming SSH connections on port 22/tcp by default. To “ssh into your router”, you can enter the following command in a terminal emulator using you router's LAN IP address that is typically 192.168.1.1 :
ssh root@192.168.1.1
The first time you ssh into your router, you will probably see a warning about the RSA key fingerprint. If you are certain this is the address of your OpenWrt device, simply type yes and press Return. Then enter the password you have given to your router, or press Return if this is the initial setup. Here is an example session:
$ ssh root@192.168.1.1To end your ssh session to your router, type exit and press Return.
The remainder of this page describes several terminal emulators that Windows, Linux, or macOS can use to access your OpenWrt device.
Note: To add a SSH public key to your OpenWrt device, see From the LuCI Web Interface
Windows terminal emulators
Windows Terminal or the legacy PowerShell, Command Prompt, ConHost, or WSL Bash choices are available. Third party programs such as PuTTY, MinGW (installed with Git), Cmder, SmarTTY, and WinSCP are also terminal emulators that can provide SSH into an OpenWrt router.
Windows 10/11 built-in terminals
Windows Terminal, PowerShell, and Command Prompt allow using the SSH client. That client is now available by default, however if your version of Windows is older, you may follow this guide to enable SSH.
If you have installed a WSL distribution, the SSH client is usually preinstalled in there.
If you directly launch cmd.exe , powershell.exe or wsl.exe the legacy ConHost terminal will open. Otherwise, you can install the modern Windows Terminal from the MS store and select any of these shells from there.
Open any of the above terminal emulators and write ssh root@192.168.1.1 (“ssh” is the command, “root” is the OpenWrt user you are connecting to, and “192.168.1.1” is OpenWrt default IP )
There will be a message to accept a new key from the OpenWrt device, write “yes” and press Enter key.
If for some reason you have reinstalled OpenWrt the device will have a different key and you get an error about key mismatch. The error will state what is the command line to copy-paste in your terminal to delete the old key and proceed. Do it and retry. If that does not resolve the error then you may need to delete C:\Users\yourusername\.ssh\known_hosts and try again.
If you want to close the session, write “exit”.The Windows optional SSH feature also includes SCP client (to open/edit/download/upload files in OpenWrt via SSH ). Use google for SCP tutorials to learn how to use it. Otherwise, use WinSCP which is easier for SCP purposes.
PowerShell
Powershell provides SSH access.
Windows Subsystem for Linux (WSL)
The Windows Subsystem for Linux is a convenient way to run a Linux environment of your choice including most,command-line tools, utilities, and applications directly on Windows. For detailed steps of how to install WSL on Windows 10, refer to Microsoft's documentation: https://docs.microsoft.com/en-us/windows/wsl/install-win10
PuTTY
PuTTY gives you command-line access to OpenWrt.
Download PuTTY, get the 32bit putty.exe from the Alternative binary files section. Start putty.exe on your Windows client → PuTTY's login window pops up.go to the Session category of PuTTY's login window, look for the field Host Name (or IP address) and simply enter the IP -address (e.g. 192.168.1.1) of your OpenWrt device, keep the default provided port 22.
Click the Open button at the Bottom to open a connection. This will pop up a shell windows, asking to login as . Login as root with the OpenWrt password you have defined some time before. If you have not yet set a password yet on “root”, you will not be asked for the password.
Done, you are logged into the OpenWrt command line.Setting up key-based authentication.
Generate a key pair using puttygen.exe . Save the private key to the PC and add the public key to /etc/dropbear/authorized_keys on your OpenWrt device.
Connection → SSH → Auth: In the box “Authentication Parameters” under “Private key file for Authentication” state the path to your private key file for this connection (e.g. the openwrt.ppk file you created before). Best is to click “Browse. ” and select the file via the file dialog.
Connection → Data: In the box “Login details” enter the “Auto-login username” which is root .Load, save or delete a stored session, enter openwrt.lan in Saved Sessions and click the Save button.
To make a PuTTY shortcut with an automatic login, create one and append the saved session with an @ sign, for example call PuTTY with: putty.exe @openwrt.lan
WinSCP
WinSCP allows you to browse the OpenWrt file system in Windows Exlorer like GUI -style.
Download WinSCP, get the non-beta Installation package or portable executables and install or unzip them on your Windows client
Start WinSCP.exe on your Windows client, WinSCP's login window will pop upClick on New Site on the left, ensure File protocol is set to scp then enter your OpenWrt device IP address (192.168.1.1) on the right side into Host name , keep the default port 22 . In User name enter root, in Password , enter your root password (or leave blank, if you have not set a password yet)
Click the Login at the bottom of the Window. Done. You now have an Exlorer-like view of your OpenWrt file system.Editing OpenWrt config files with WinSCP's integrated GUI editor.
To edit an OpenWrt config file with WinSCP's GUI -based editor, just right-click the file in WinSCP and select Edit from the context menu.
Cmder
Cmder for Windows is an open-source terminal emulator that runs on Windows. It is free to use and provides an easy “command line shell” that allows you to ssh into OpenWrt. Its attractive fonts and color scheme are easy on the eyes. The Full distribution is preferred (over the mini distribution), since it provides a bash emulation, with a Unix-y suite of commands.
Unzip the cmder.zip file.Open the Cmder folder, and double-click the Cmder icon. You'll see a Cmder window open similar to the image below.
To ssh into the OpenWrt router at 192.168.1.1, type ssh root@192.168.1.1 then press Return.SmarTTY
SmarTTY gives you command line access to OpenWrt and allows you to open/edit/download/upload files in OpenWrt, and is overall more modern and user-friendly than PuTTY (another tool detailed below).
Download SmarTTY, choose “download” for the installer, or “portable version” if you want it as a standalone program that works without installation.
after installation or after unzipping the archive, doubleclick on SmarTTY executable file.You will be greeted by a window with two choices, doubleclick on “setup a new SSH connection” (the other option is for serial connections, for usb- TTL dongles and somesuch you connect to the device's debug serial pins on the board, we won't use that now).
The window changes into the SSH setup, write the following info: Host name: OpenWrt device IP address (default is 192.168.1.1 ) User Name: root (this is the “administrator” and only user in default OpenWrt)Password: leave this blank for your first connection, then write the password you set up (either in Luci GUI or after your first SSH access)
Click “Connect” button at the bottom, and you will now see a big terminal screen coming upA default OpenWrt firmware lacks the server component to allow you to open/edit/view/upoad/download files in SmarTTY, so after you have connected to the internet write opkg update && opkg install openssh-sftp-server to install it. If the next step fails, it might be necessary to reboot the OpenWrt device for this new service to start up properly.
Now you can click on File → Open a Remote File to open a popup that shows the file system of the OpenWrt device, and you can navigate in it and open text files for example as normal (they will open in a SmarTTY text editor window)
If you want to upload or download files to/from a specific folder in the device, you can click on SCP menu and choose the most appropriate action from there.
After the first time you connected to a device, SmarTTY saved a profile, so you can connect again to the same device (at that IP address with that password) by just doubleclicking its icon on the first window you see when starting SmarTTY. You can right-click on this profile icon to edit it again, if needed.
Linux terminal emulators
All Linux distributions provide a command-line ssh client as part of the default installation.
Open a terminal emulator and write ssh root@192.168.1.1 (“ssh” is the command, “root” is the OpenWrt user you are connecting to, and “192.168.1.1” is OpenWrt default IP )
there will be a message about accepting a new key from the OpenWrt device, write “yes” and press Enter key.
If for some reason you have reinstalled OpenWrt the device will have a different key and you get an error about key mismatch. The error will state what is the command line to copy-paste in your terminal to delete the old key and proceed.
if you want to close the session, write “exit”Linux also usually has SCP/ SFTP clients (to open/edit/download/upload files in OpenWrt), which may or may not be installed by default. You need to look up your distro's documentation or search with your package management interface for “scp” and “sftp” to find where it is and its current installation status. Read scp manual for the command line SCP client or google some tutorials to learn how to use it.
Midnight Commander
Midnight Commander is Norton Commander like file manager that works on Linux and macOS. You can access remote files on OpenWrt via mc:
Select 'Left' panel config Select 'Shell link' Input 'root@192.168.1.1/' and press OK Now you'll see list of files and directories in root of OpenWrtInternally it works over scp like protocol FISH so it not needs for installed SFTP server.
macOS terminal emulators
On macOS (formerly Mac OSX) any terminal emulator will allow you to ssh.
Terminal - The macOS built-in terminal program, find it in /Applications/Utilities. iTerm2 a much-enhanced terminal program, donation-ware - it's worth it.To ssh into your OpenWrt router at 192.168.1.1, type ssh root@192.168.1.1 , then press Return.
ChromeOS terminal emulator
On ChromeOS, the Secure Shell App will allow you to SSH .
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website. OK More information about cookies
- Last modified: 2022/08/05 15:30
- by palebloodsky
Self-registration in the wiki has been disabled.
If you want to contribute to the OpenWrt wiki, please post HERE in the forum or ask on IRC for access.
Except where otherwise noted, content on this wiki is licensed under the following license:
CC Attribution-Share Alike 4.0 International
Первый запуск
Любая только что установленная система OpenWrt по умолчанию запускается со следующими настройками:
dnsmasq ( DHCP daemon) запущен собственный IP адрес на интерфейсе внутренней сети 192.168.1.1/24 раздача IP адресов внутри сети осуществляется в пределах 192.168.1.100–250 dropbear ( SSH daemon) НЕ запущен telnet daemon запущен на стандартном порту (23)После новой установки OpenWrt каждый раз будет загружаться в этой конфигурации, пока вы не установите пароль:
Подключение через telnet
подключитесь к вашему роутеру командой telnet 192.168.1.1 . Приветственное окно выглядит следующим образом:
BusyBox v1.17.3 (2011-02-22 23:42:42 CET) built-in shell (ash) Enter 'help' for a list of built-in commands. _______ ________ __ | |.-----.-----.-----.| | | |.----.| |_ | - || _ | -__| || | | || _|| _| |_______|| __|_____|__|__||________||__| |____| |__| W I R E L E S S F R E E D O M ATTITUDE ADJUSTMENT (bleeding edge, r26290) ---------- * 1/4 oz Vodka Pour all ingredents into mixing * 1/4 oz Gin tin with ice, strain into glass. * 1/4 oz Amaretto * 1/4 oz Triple sec * 1/4 oz Peach schnapps * 1/4 oz Sour mix * 1 splash Cranberry juice ----------------------------------------------------- root@openwrt:~$
наберите passwd в строке ввода. Вам будет предложено создать новый пароль для пользователя root:
root@openwrt:~$ passwd Changing password for root New password: Retype password: Password for root changed by root root@openwrt:~$
пожалуйста, используйте надежный пароль.
после того как вы установили пароль telnet daemon будет отключен, наберите exit в командной строке
SSH уже доступен без перезагрузки; подключайтесь через HTTP S, если Web-интерфейс (LuCI) уже установлен TLS-модули
подключитесь опять с помощью команды ssh root@192.168.1.1 или используйте dropbear.public-key.auth
продолжайте с базовой конфигурацией
Подключение через Web-интерфейс
LuCI
Откройте ваш браузер и подключитесь к роутеру по его стандартному IP -адресу (обычно, это 192.168.1.1). Подключайтесь, исползуя username root а пароль оставьте пустым.
Кликните на правую часть верхнего меню в разделе Administration, и затем идите на вкладку System (просто наведите мышкой, не кликайте), в выпадающем меню выберите Admin Password. Как выглядит страница смены пароля показана ниже.
Напишите ваш пароль в поле Password и подтвердите его в поле Confirmation. Наконец, кликните на Submit.
Ваш новый пароль установлен.
X-Wrt
Откройте ваш браузер и подключитесь к роутеру по его стандартному IP -адресу (обычно, это 192.168.1.1). Web-интерфейс теперь попросит вас установить пароль. Наберите свой пароль в поле New Password и подтвердите его в поле Confirm Password затем, нажмите set.
Gargoyle
Откройте ваш браузер и подключитесь к роутеру по его стандартному IP -адресу (обычно, это 192.168.1.1). Web-интерфейс теперь попросит вас ввести пароль (по умолчанию: password). После попросит дважды ввести свой новый пароль в поле New Password и подтвердите его в поле Confirm Password затем, нажмите set.
Проблемы при входе
Если вы столкнулись с проблемой при входе, например вы не можете подключиться, это часто бывает связано с настройками вашего firewall-а в системе Linux или Windows. Если у вас запущены firewalls, вы можете попробовать отключить их и повторить попытку входа. Еще раз напоминаем, что после того, как вы установили пароль в OpenWrt, подключение по telnet больше не возможно (см. выше).
Не получается подключиться через SSH после установки пароля
Попробуйте еще раз через пару минут. При первой загрузке OpenWrt создает файловую систему и генерирует SSH ключи; SSH сервер не будет стартовать, пока эти ключи не будут сгенерированы.
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website. OK More information about cookies
- Last modified: 2020/09/23 13:58
- by vgaetera
Self-registration in the wiki has been disabled.
If you want to contribute to the OpenWrt wiki, please post HERE in the forum or ask on IRC for access.
Except where otherwise noted, content on this wiki is licensed under the following license:
CC Attribution-Share Alike 4.0 International