0

For some reason my ip address is banned from using ssh or sftp. I have no problem connecting to the server using an other ip nor i have problems reaching all other services (like http, teamspeak) with my own ip.

I've searched iptables with no results, added my ip to be allowed:

Chain            num   pkts bytes target     prot opt in     out     source               destination         

ALLOWIN          1    88230 4544K ACCEPT     all  --  !lo    *       my.ip.here      0.0.0.0/0

ALLOWOUT         1    88514   11M ACCEPT     all  --  *      !lo     0.0.0.0/0            my.ip.here

Also: Added my ip as "alloweduser" in root@my.ip in the sshd_config. Added my ip in the hosts.allowed. Not listed in hosts.deny. Tried to connect to the ip instead of hostname. Rebooted. Downloaded half of google's datacenter. (figure of speech) ... and etc etc.

Still, i get the error that the server unexpectedly closed the network connection.

My ip address is semi-permanent, which makes it quite annoying and frustrating that i can't figure out why i can't connect with my own ip. The only way i can reach this server over ssh or sftp is using an other server to connect to it or borrow someone else's pc over teamviewer.

edit: ip doesn't seem to be banned, i can connect using the same ip using an other computer.

Any more ideas? :s

edit: added upon request:

Chain INPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 ACCEPT     tcp  --  !lo    *       213.186.33.99        0.0.0.0/0           tcp dpt:53
    0     0 ACCEPT     udp  --  !lo    *       213.186.33.99        0.0.0.0/0           udp dpt:53
    0     0 ACCEPT     tcp  --  !lo    *       213.186.33.99        0.0.0.0/0           tcp spt:53
  996 88927 ACCEPT     udp  --  !lo    *       213.186.33.99        0.0.0.0/0           udp spt:53
  14M 1554M LOCALINPUT  all  --  !lo    *       0.0.0.0/0            0.0.0.0/0
3036K  248M ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0
3306K  604M INVALID    tcp  --  !lo    *       0.0.0.0/0            0.0.0.0/0
  14M 1527M ACCEPT     all  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate RELATED,ESTABLISHED
    0     0 ACCEPT     tcp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:20
  959 50296 ACCEPT     tcp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:21
  418 24660 ACCEPT     tcp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:22
  120  6800 ACCEPT     tcp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:25
    1    40 ACCEPT     tcp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:53
 259K   14M ACCEPT     tcp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:80
    0     0 ACCEPT     tcp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:110
    2   100 ACCEPT     tcp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:143
   73  3780 ACCEPT     tcp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:443
    2   100 ACCEPT     tcp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:465
    0     0 ACCEPT     tcp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:587
    0     0 ACCEPT     tcp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:993
    2   100 ACCEPT     tcp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:995
    0     0 ACCEPT     tcp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:2008
  712 42720 ACCEPT     tcp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:2222
    3   120 ACCEPT     tcp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:3306
    0     0 ACCEPT     tcp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:9987
  610 36600 ACCEPT     tcp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:10011
    0     0 ACCEPT     udp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW udp dpt:20
    0     0 ACCEPT     udp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW udp dpt:21
    0     0 ACCEPT     udp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW udp dpt:22
    8   895 ACCEPT     udp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW udp dpt:53
    0     0 ACCEPT     udp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW udp dpt:2008
    0     0 ACCEPT     udp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW udp dpt:3306
 3324  358K ACCEPT     udp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW udp dpt:9987
    0     0 ACCEPT     udp  --  !lo    *       0.0.0.0/0            0.0.0.0/0           ctstate NEW udp dpt:10011
62941 2076K ACCEPT     icmp --  !lo    *       0.0.0.0/0            0.0.0.0/0           icmp type 8 limit: avg 1/sec burst 5
    0     0 ACCEPT     icmp --  !lo    *       0.0.0.0/0            0.0.0.0/0           icmp type 0 limit: avg 1/sec burst 5
    1    56 ACCEPT     icmp --  !lo    *       0.0.0.0/0            0.0.0.0/0           icmp type 11
   22  3539 ACCEPT     icmp --  !lo    *       0.0.0.0/0            0.0.0.0/0           icmp type 3
17689  933K LOGDROPIN  all  --  !lo    *       0.0.0.0/0            0.0.0.0/0

Chain FORWARD (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 ACCEPT     tcp  --  *      !lo     0.0.0.0/0            213.186.33.99       tcp dpt:53
 1016 72259 ACCEPT     udp  --  *      !lo     0.0.0.0/0            213.186.33.99       udp dpt:53
    0     0 ACCEPT     tcp  --  *      !lo     0.0.0.0/0            213.186.33.99       tcp spt:53
    0     0 ACCEPT     udp  --  *      !lo     0.0.0.0/0            213.186.33.99       udp spt:53
  21M 6176M LOCALOUTPUT  all  --  *      !lo     0.0.0.0/0            0.0.0.0/0
  131  8015 ACCEPT     tcp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           tcp dpt:53
31705 2660K ACCEPT     udp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           udp dpt:53
    3   132 ACCEPT     tcp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           tcp spt:53
    8   493 ACCEPT     udp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           udp spt:53
3036K  248M ACCEPT     all  --  *      lo      0.0.0.0/0            0.0.0.0/0
3014K 4013M INVALID    tcp  --  *      !lo     0.0.0.0/0            0.0.0.0/0
  21M 6156M ACCEPT     all  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate RELATED,ESTABLISHED
    0     0 ACCEPT     tcp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:20
    0     0 ACCEPT     tcp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:21
    0     0 ACCEPT     tcp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:22
  639 38340 ACCEPT     tcp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:25
    0     0 ACCEPT     tcp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:53
 7762  466K ACCEPT     tcp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:80
    0     0 ACCEPT     tcp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:110
    0     0 ACCEPT     tcp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:113
    5   300 ACCEPT     tcp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:443
    0     0 ACCEPT     tcp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:587
    0     0 ACCEPT     tcp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:993
    0     0 ACCEPT     tcp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:995
   24  1440 ACCEPT     tcp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:2008
    0     0 ACCEPT     tcp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:2222
    0     0 ACCEPT     tcp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:3306
    0     0 ACCEPT     tcp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:9987
    0     0 ACCEPT     tcp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW tcp dpt:10011
    0     0 ACCEPT     udp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW udp dpt:20
    0     0 ACCEPT     udp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW udp dpt:21
    0     0 ACCEPT     udp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW udp dpt:22
    0     0 ACCEPT     udp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW udp dpt:53
    0     0 ACCEPT     udp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW udp dpt:113
    0     0 ACCEPT     udp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW udp dpt:123
    0     0 ACCEPT     udp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW udp dpt:2008
    0     0 ACCEPT     udp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW udp dpt:3306
    0     0 ACCEPT     udp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW udp dpt:9987
    0     0 ACCEPT     udp  --  *      !lo     0.0.0.0/0            0.0.0.0/0           ctstate NEW udp dpt:10011
    0     0 ACCEPT     icmp --  *      !lo     0.0.0.0/0            0.0.0.0/0           icmp type 0
    0     0 ACCEPT     icmp --  *      !lo     0.0.0.0/0            0.0.0.0/0           icmp type 8
    3  1728 ACCEPT     icmp --  *      !lo     0.0.0.0/0            0.0.0.0/0           icmp type 11
    0     0 ACCEPT     icmp --  *      !lo     0.0.0.0/0            0.0.0.0/0           icmp type 3
 9507 1599K LOGDROPOUT  all  --  *      !lo     0.0.0.0/0            0.0.0.0/0

Chain ALLOWIN (1 references)
 pkts bytes target     prot opt in     out     source               destination
 169K 8151K ACCEPT     all  --  !lo    *       my.ip.is.here      0.0.0.0/0

Chain ALLOWOUT (1 references)
 pkts bytes target     prot opt in     out     source               destination
 169K   16M ACCEPT     all  --  *      !lo     0.0.0.0/0            my.ip.is.here

Chain DENYIN (1 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 DROP       all  --  !lo    *       119.27.26.112        0.0.0.0/0
    0     0 DROP       all  --  !lo    *       93.146.193.237       0.0.0.0/0
    1    60 DROP       all  --  !lo    *       182.100.67.115       0.0.0.0/0
    0     0 DROP       all  --  !lo    *       80.179.145.180       0.0.0.0/0
    0     0 DROP       all  --  !lo    *       182.100.67.102       0.0.0.0/0
   19  1128 DROP       all  --  !lo    *       200.161.210.250      0.0.0.0/0
  456 27360 DROP       all  --  !lo    *       80.82.65.61          0.0.0.0/0
   11   740 DROP       all  --  !lo    *       218.87.111.108       0.0.0.0/0
   21  1604 DROP       all  --  !lo    *       43.255.188.162       0.0.0.0/0
   13   956 DROP       all  --  !lo    *       182.100.67.114       0.0.0.0/0
   81  3888 DROP       all  --  !lo    *       59.92.245.31         0.0.0.0/0
  606 29128 DROP       all  --  !lo    *       180.214.233.74       0.0.0.0/0
   16  1128 DROP       all  --  !lo    *       58.218.211.166       0.0.0.0/0
   19  1396 DROP       all  --  !lo    *       218.65.30.73         0.0.0.0/0

Chain DENYOUT (1 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 LOGDROPOUT  all  --  *      !lo     0.0.0.0/0            119.27.26.112
    0     0 LOGDROPOUT  all  --  *      !lo     0.0.0.0/0            93.146.193.237
    0     0 LOGDROPOUT  all  --  *      !lo     0.0.0.0/0            182.100.67.115
    0     0 LOGDROPOUT  all  --  *      !lo     0.0.0.0/0            80.179.145.180
    0     0 LOGDROPOUT  all  --  *      !lo     0.0.0.0/0            182.100.67.102
   18  1293 LOGDROPOUT  all  --  *      !lo     0.0.0.0/0            200.161.210.250
    0     0 LOGDROPOUT  all  --  *      !lo     0.0.0.0/0            80.82.65.61
   10  1360 LOGDROPOUT  all  --  *      !lo     0.0.0.0/0            218.87.111.108
   11  1496 LOGDROPOUT  all  --  *      !lo     0.0.0.0/0            43.255.188.162
   10  1360 LOGDROPOUT  all  --  *      !lo     0.0.0.0/0            182.100.67.114
    0     0 LOGDROPOUT  all  --  *      !lo     0.0.0.0/0            59.92.245.31
   15  1065 LOGDROPOUT  all  --  *      !lo     0.0.0.0/0            180.214.233.74
   10  1360 LOGDROPOUT  all  --  *      !lo     0.0.0.0/0            58.218.211.166
   10  1360 LOGDROPOUT  all  --  *      !lo     0.0.0.0/0            218.65.30.73

Chain INVALID (2 references)
 pkts bytes target     prot opt in     out     source               destination
17270 1031K INVDROP    all  --  *      *       0.0.0.0/0            0.0.0.0/0           ctstate INVALID
    0     0 INVDROP    tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x3F/0x00
    0     0 INVDROP    tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x3F/0x3F
    0     0 INVDROP    tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x03/0x03
    0     0 INVDROP    tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x06/0x06
    0     0 INVDROP    tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x05/0x05
    0     0 INVDROP    tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x11/0x01
    0     0 INVDROP    tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x18/0x08
    0     0 INVDROP    tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x30/0x20
  705  240K INVDROP    tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:!0x17/0x02 ctstate NEW

Chain INVDROP (10 references)
 pkts bytes target     prot opt in     out     source               destination
17975 1271K DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0

Chain LOCALINPUT (1 references)
 pkts bytes target     prot opt in     out     source               destination
  14M 1554M ALLOWIN    all  --  !lo    *       0.0.0.0/0            0.0.0.0/0
  14M 1546M DENYIN     all  --  !lo    *       0.0.0.0/0            0.0.0.0/0

Chain LOCALOUTPUT (1 references)
 pkts bytes target     prot opt in     out     source               destination
  21M 6176M ALLOWOUT   all  --  *      !lo     0.0.0.0/0            0.0.0.0/0
  21M 6161M DENYOUT    all  --  *      !lo     0.0.0.0/0            0.0.0.0/0

Chain LOGDROPIN (1 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:67
    0     0 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:67
    0     0 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:68
   96 33108 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:68
    0     0 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:111
    0     0 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:111
    0     0 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:113
    0     0 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:113
    0     0 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpts:135:139
    7   547 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpts:135:139
    0     0 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:445
    0     0 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:445
    0     0 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:500
    0     0 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:500
    0     0 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:513
    0     0 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:513
    0     0 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:520
    1    52 DROP       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:520
13095  662K LOG        tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 30/min burst 5 LOG flags 0 level 4 prefix `Firewall: *TCP_IN Blocked* '
  297 23542 LOG        udp  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 30/min burst 5 LOG flags 0 level 4 prefix `Firewall: *UDP_IN Blocked* '
    0     0 LOG        icmp --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 30/min burst 5 LOG flags 0 level 4 prefix `Firewall: *ICMP_IN Blocked* '
17585  899K DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0

Chain LOGDROPOUT (15 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 LOG        tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x17/0x02 limit: avg 30/min burst 5 LOG flags 8 level 4 prefix `Firewall: *TCP_OUT Blocked* '
 7110 1173K LOG        udp  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 30/min burst 5 LOG flags 8 level 4 prefix `Firewall: *UDP_OUT Blocked* '
    0     0 LOG        icmp --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 30/min burst 5 LOG flags 8 level 4 prefix `Firewall: *ICMP_OUT Blocked* '
 9591 1608K DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0

Not sure what is meant with "The output of ssh -v server, from your client" the clients i'm using are winscp and putty, one must first be able to connect!?

Not sure for "tcpdump on the server" either, from where exactly?

edit:

This shows up in /var/log/secure when i'm trying to connect from this pc: May 22 19:31:21 whiskey sshd[27252]: fatal: no matching mac found: client hmac-sha1,hmac-sha1-96,hmac-md5 server hmac-sha2-512,hmac-sha2-256,hmac-ripemd160

Solved: i've updated putty from 0.62 to 0.64 and winscp from 5.1.5 to 5.7.3 and everything works again. not really sure why i was able to connect with them at first and suddenly after being on the server for little while couldn't anymore...

  • 2
    If you think this might be firewall-related, we need to see the whole ruleset; please cut and paste the output of iptables -L -n -v into your question. The output of ssh -v server, from your client, would also be useful in determining if this might be something other than firewall-related. – MadHatter May 22 '15 at 6:44
  • 1
    Check server logs. Do a tcpdump on the server. – Dan May 22 '15 at 13:40
  • On unix systems running ssh with the -v flag increases verbosity and will show more information about the error you're having when connecting. There should be similar options in putty to save a log file and increase verbosity. There may also be information in /var/log/messages or /var/log/secure about the failure. – Yozomiri May 22 '15 at 17:18
  • This shows up in /var/log/secure when i'm trying to connect from this pc: May 22 19:31:21 whiskey sshd[27252]: fatal: no matching mac found: client hmac-sha1,hmac-sha1-96,hmac-md5 server hmac-sha2-512,hmac-sha2-256,hmac-ripemd160 – Santy May 22 '15 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.