0

I use Putty to connect to a Linux Red Hat machine on an AWS instance. My local computer is Windows 8. On the iptables I had to make a change and accidentally forgot to put back this default rule: -A INPUT -m state --state ESTABLISHED,RELATED -j

Now I lost connection to Putty and get Network error: Software caused connection abort. I can't connect at all anymore. Can I restore it and how?

Update: After posting the question I did already try attaching the volumes to another amazon instance (debug instance) but when I connect to it, it displays the same "Software caused connection abort" error unfortunately.

I also tried to fix it by editing settings in the Connection section of the Putty configuration.

Thanks.

5
  • Please consider doing a bit of research of your own next time before posting a question here. Aug 18, 2015 at 11:50
  • "I did already try attaching the volumes to another amazon instance but when I connect to it, it displays the same "Software caused connection abort" error": Is there a possibility that you attached the volume as a root volume to the debug instance, and not as an additional one? There is no reason for a new instance spawned from a viable AMI to be unreachable, as long as you configured it correctly (IGW/NAT, security groups etc). and I don't see how attaching a volume to an instance could make it unreachable...
    – Tom
    Aug 18, 2015 at 13:55
  • @Tom I have multiple volumes (6). First I attached them all. I got the same error and then I tried to attach only sda1 (a root volume) of the first instance as an additional on to the debug instance (debug has all its own volumes + the root volume of first instance). So it has 2 root volumes now. Got the error. The configuration for security groups are the same (only port 22). I can however attach non-root volumes on the debug instance and connect to SSH but when I go to iptables, it's not the one that's missing the rule.
    – Kim
    Aug 19, 2015 at 16:08
  • I don't know how skilled you are, so please excuse me if this seems trivial to you. After having attached the volume to your debug instance, you need to mount the it to (e.g) /mnt on this VM. then access the iptables config in /mnt/etc/sysconfig/iptables. Do not go directly to /etc/sysconfig/iptables
    – Tom
    Aug 19, 2015 at 16:24
  • That's ok, I'm not skilled at all, just started learning. Ah yes, I couldn't find the etc folder on the non-roots, so I'm can't do /mnt/etc/sysconfig/iptables yet. It must be on the root one right? But that one gives the same error (even when I have the original root volume attached, so then I have 2 of them).
    – Kim
    Aug 20, 2015 at 8:36

2 Answers 2

0

You need to create a new instance to fix the iptables. Follow the guide here(scroll down a bit): https://aws.amazon.com/articles/5213606968661598

Then add a script updating the iptables into the rc.d folder so it runs at launch

Sync & Detach the volume. Reattach to the old instance.

Start and hopefully it has worked.

Done.

Little note: There is usually no need for iptables. You can control the firewall using the AWS console.

2
  • Thanks for your answer, that's how it should be done as I read and tried but unfortunately when I attach that volume I still can't get inside the machine (give the same error on the debug instance then).
    – Kim
    Aug 20, 2015 at 8:59
  • @Kim If you have mounted the volume of the broken instance, look at the logs including auth and boot.log (usually somewhere in /var/logs). Maybe this will provide some insights into what's wrong. Have you managed to append a new shell script to the rc.local? If so check that it is executed by having it touch a specific file for example. Failing that you can always rescue any data and start from scratch.
    – kcrk
    Aug 20, 2015 at 14:05
0

If it wasn't on AWS, you'd just need to log in on the console of the Linux server and add back the missing rule from there.

Regrettably, AWS doesn't provide console login access to instances, so you'll have to follow the steps described in the AWS tutorial How to Recover an Unreachable Linux Instance to regain access.

3
  • Thanks for your quick reply. I mean that I lost connection and when I try to reconnect it keeps prompting that error message so I can't get on a new session in the putty console (if that's what you mean).
    – Kim
    Aug 18, 2015 at 10:53
  • No, the console means the keyboard and screen. Or eventually a remote KVM (if available), IPMI console (if available, through the IPMI controller management IP), VNC server (if the server is a virtual machine running a graphical mode console), etc.
    – b0fh
    Aug 18, 2015 at 11:09
  • Sorry, I forgot to mention that the server is on an AWS instance. I just edited this now in the question. @b0fh I think AWS instance only can connect through ssh.
    – Kim
    Aug 18, 2015 at 11:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .