Telnet to linux connection refused

Telnet to locahost refused, but via IP works? [closed]

I have a weird problem, to be specific it’s about Jboss’s JNDI and on linux. If I’m on the server via ssh (Putty) and run the following: telnet localhost 1099 It tells me connection refused, but. If I run: telnet x 1099 where x is the ip address of the server, it connects, all this on the actual server. How can this be? shouldn’t work via localhost? I also tried 127.0.0.1 with no luck.

3 Answers 3

It sounds like the program is binding to a specific IP address or network interface. Run netstat -tnlp | grep :1099 and you will probably see that it is listening on a non-loopback interface.

If you can instruct the application to listen on 0.0.0.0 (the IPv4 wildcard address) then it will be accessible from any network interface on the machine.

I’ve tried it, Jboss is binding to 0.0.0.0 and the problem persists, this is the output from «netstat -tnlp | grep :1099» = «tcp 0 0 172.20.41.135:1099 0.0.0.0:* LISTEN 30306/java»

I am guessing that your JBoss instance was started with the option —host=x (or -b x) where x is the IP address (not 127.0.0.1, not 0.0.0.0 and not localhost). This means JNDI will only listen on x.

You can determine if this is the case by inspecting the system properties in JMXConsole. Find the MBean jboss:name=SystemProperties,type=Service. Find the operation called showAll and invoke it. The system properties will be displayed. Look for the value of jboss.bind.address and you may find that it says x instead of 0.0.0.0 which it sounds is what you really want.

Having said that, you may have a specific override for the binding address on the naming (jndi) service. The —host= or -b options set the property jboss.bind.address which becomes the default binding address for nearly all the network services, but it is possible to configure individual services to specific bind addresses that are different from jboss.bind.address. Take a look at the jboss:service=Naming MBean in JMXConsole , and look for the BindAddress attribute. That address indicates the interfaces where you can connect to. (If it’s 0.0.0.0, then it’s all your interfaces.

Источник

Connection refused telnet localhost 8080

@Esse when I do this, nothing appears. But when I do it for port 22 for example, it is listening. Any suggestions on what to do?

Читайте также:  Линукс при беременности можно

remove 8080 port from your telnet command..Use telnet localhost . telnet always works on port 22 by default.

2 Answers 2

That’s simple: port 8080 is not opened, just like @Esse told you.

You can check the connection with echo also:

echo OK > /dev/tcp/localhost/8080 echo $? 

You can list opened ports using netstat:

Edit:

You can test that the port is not opened by trying to open the port yourself:

# open port 8080 using netcat nc -l 8080 & # check connection netstat -tulpn | grep 8080 telnet localhost 8080 echo OK > /dev/tcp/$(hostname -f)/8080 nc 127.0.0.1 8080 

I used nc -v -l 8080 and got 8080: inverse host lookup failed: Unknown host listening on [any] 44613 .

same $ sudo iptables -L -t nat

Chain PREROUTING (policy ACCEPT) target prot opt source destination
DOCKER all — anywhere anywhere ADDRTYPE match dst-type LOCAL

Chain INPUT (policy ACCEPT) target prot opt source destination

Chain OUTPUT (policy ACCEPT) target prot opt source destination
DOCKER all — anywhere !localhost/8 ADDRTYPE match dst-type LOCAL

Chain POSTROUTING (policy ACCEPT) target prot opt source destination
MASQUERADE all — 172.17.0.0/16 anywhere

Chain DOCKER (2 references) target prot opt source destination
RETURN all — anywhere anywhere

Источник

настройка Telnet соединения

Здравствуйте! Нужно соединить два компьютера с помощью Telnet. На обоих стоит Ubuntu 12.04. Компьютеры соединены патчкордом напрямую. Пингуется все отлично в обе стороны. Но при попытке сделать telnet соединение выдает ошибку:

telnet 192.168.0.3 Trying 192.168.0.3. telnet: Unable to connect to remote host: Connection refused

Мне подсказали, что возможно причина в фаерволе, поэтому на обоих компьютерах я выполнил команду:

Однако ничего не изменилось. Подскажите пожалуйста, в чем может быть проблема и как ее исправить. Заранее спасибо!

Telnet — это клиент. Подумай о запуске сервера на другой стороне соединения.

Проблема может быть в том, что Ubuntu по умолчанию не поднимает сервер Telnet’а на 23 порту.

Расскажите пожалуйста, как его поднять? В гугле ничего внятного найти не смог. Видимо очень уж старая технология, что информации в сети почти не осталось

В гугле ничего внятного найти не смог.

Вторая ссылка в гугле http://miku.acm.uiuc.edu/ по telnet server.

Какой толстый суббкотний ОП, взоржал с треда 🙂

Никак. Telnet умер. Используй ssh.

hostA# apt-get install openssh-server

Нет, вру. Уже нашел, но все инструкции старые и файлы о которых там говориться (например /etc/inetd.conf или /etc/init.d/inetd) на моей системе просто отсутствуют

~$ aptitude show nyancat-server Package: nyancat-server New: yes State: not installed Version: 1.2.1-1 Priority: extra Section: misc Maintainer: Jonathan McCrohan Uncompressed Size: 46.1 k Depends: nyancat (>= 1.2.1-1), openbsd-inetd | inet-superserver, reconf-inetd Conflicts: telnetd Description: Animated terminal Nyancat server configurations nyancat-server contains the configuations required to quickly set up a nyancat server. This allows the animated poptart cat to be served to many users via telnet. Installing this package will automatically configure and activate a nyancat telnet server. Homepage: https://github.com/klange/nyancat 

Источник

Читайте также:  Suse linux enterprise обзор

Почему маршрутизатор отказывается пустить вас телнетом

Вступление
С оборудованием Cisco я работаю уже несколько лет, но с подобной проблемой столкнулся впервые. Хотя может и не впервые :). Точно сказать не могу, так как всякого рода траблов и непоняток было много, из-за того что я настраивал в работу и изучал их одновременно. Но раньше скорее всего все решалось обычным хардрезетом, теперь же я разобрался в чем дело.

Что было поводом?
В один прекрасный день мне понадобилось зайти удаленно на один из роутеров Cisco, чтобы посмотреть вывод sh ver. Обычно я захожу со своей машины с OS Windows посредством Putty. Как обычно окно терминала открылось, и…, не выдав никакой текстовой информации с велкомом и приглашением к логину, сразу же закрылось без объяснения причин.

Попробовал с линуксового сервера:

[valent@linux ~]$ telnet 10.15.xxx.yy
Trying 10.15.xxx.yy.
telnet: connect to address 10.15.xxx.yy: Connection refused
telnet: Unable to connect to remote host: Connection refused

Попробовав еще несколько раз с тем же результатом с других хостов я решил немного
попинать головой стену подумать 🙂
И вот что обнаружилось и придумалось.

Так как фаервола и ACL от меня в сторону роутера не было, да и я заходил на роутер перед этим много раз на прошлой неделе, настраивая тоннель, то я сделал вывод, что закончились свободные vty line. Конечно, дошел к этому выводу я не так быстро и сразу, были разные предположения, но помогло то, что глюков в циске я еще не встречал, роутер по информации маршрутизации и cdp работал, в чудеса особо не верю, заходил на роутер буквально пару дней назад и еще помню примерно конфиг, плюс на днях читал блог одного цисковода, где он как раз тюннинговал эти самые vty line.

Что было сделано?
На прошлой неделе я настраивал на этом роутере (к слову сказать Cisco 1841) тоннель через партнерские сети к другому такому же роутеру. Что бы окно терминала не закрывалось из-за бездействия при выводе дебага, в настройках line vty я установил параметр exec-timeout 0 0 (время бездействия в 0 минут 0 секунд, то есть сессия будет висеть практически вечно).
В процессе настройки несколько раз выходил нештатно, то есть просто закрывал окно терминала. В итоге все мои telnet-сессии остались открытыми и занятыми и когда я попытался очередной раз зателнетится на роутер — меня не пустило.
Повезло только то, что был еще открыт доступ по http протоколу и это помогло диагностировать и решить проблему.

Читайте также:  Для linux pdf printer

Нужно посмотреть сводный статус TCP-соединений:

cisco#show tcp brief
TCB Local Address Foreign Address (state)
8173B78C 10.15.xxx.yy.23 10.15.aa.bb.2530 ESTAB
.
80CCEB24 10.15.xxx.yy.23 10.15.aa.bb.4427 ESTAB

Первая колонка — это TCB адрес (Transmission Control Block адрес установленого TCP-соединения). По аналогии с *nix, можно сказать что это PID процесса, который можно убить:

router#clear tcp tcb 8173B78C
[confirm]

для подтверждения нажав «y» мы убиваем данную сессию.

Таким образом, сняв TCP-сессии, я освободил vty линии и смог зайти телнетом на роутер.

Хочу заметить еще, что более подробно о TCP-соединении можно узнать, если ввести команду:

router#show tcp tcb 80CCF254
Connection state is ESTAB, I/O status: 1, unread input bytes: 1
Local host: 10.15.xxx.yy, Local port: 23
Foreign host: 10.15.aa.bb, Foreign port: 1840

Enqueued packets for retransmit: 1, input: 0 mis-ordered: 0 (0 bytes)

Event Timers (current time is 0x374828A8):
Timer Starts Wakeups Next
Retrans 123 7 0x374829CB
TimeWait 0 0 0x0
AckHold 128 11 0x0
SendWnd 0 0 0x0
KeepAlive 0 0 0x0
GiveUp 0 0 0x0
PmtuAger 0 0 0x0
DeadWait 0 0 0x0

iss: 2866020113 snduna: 2866027408 sndnxt: 2866027946 sndwnd: 65097
irs: 672352072 rcvnxt: 672352285 rcvwnd: 3916 delrcvwnd: 212

SRTT: 302 ms, RTTO: 319 ms, RTV: 17 ms, KRTT: 0 ms
minRTT: 156 ms, maxRTT: 564 ms, ACK hold: 200 ms
Flags: passive open, higher precedence, retransmission timeout

Datagrams (max data segment is 536 bytes):
Rcvd: 248 (out of order: 0), with data: 137, total data bytes: 212
Sent: 166 (retransmit: 7, fastretransmit: 0), with data: 154, total data bytes: 8368

P.S. Хабр читаю уже давно, часто есть желание прокоментировать тот или иной пост. И вот, документируя вышеизложеное в свой вики, я подумал что может быть это будет интересно и еще кому-то.
Пользуясь представленой возможностью, хочу заметить, что это мой первый пост на хабре и, надеюсь, что не последний 🙂

Источник

Оцените статью
Adblock
detector