| Linode Forum https://forum.linode.com/ |
|
| Just another iptables question https://forum.linode.com/viewtopic.php?f=19&t=4542 |
Page 1 of 1 |
| Author: | lec [ Sun Aug 23, 2009 11:08 am ] |
| Post subject: | Just another iptables question |
I'm trying to set up iptables on CentOS 5.2 but not having luck. This is what it does: Code: [root@webhost ~]# service iptables start Based on some Googling I've created the following script to set up my rules (I've replaced some of my top secret port numbers with [PortNumber] Code: #!/bin/bash Any help would be greatly appreciated. LEC |
|
| Author: | sweh [ Sun Aug 23, 2009 2:04 pm ] |
| Post subject: | |
Why do you think it's not working? "lsmod" shows what modules are loaded. If the iptables is hard-coded into the kernel then it won't load as a module. Code: % zgrep -i iptables /proc/config.gz What you need to do is run "iptables -L -n" to check rules are loaded. |
|
| Author: | lec [ Sun Aug 23, 2009 3:52 pm ] |
| Post subject: | |
Oh, cool. Thank you. I read it somewhere that that's the way to check it but I guess it's not. The only reason I thought it wasn't running is because I can't get in through SSH. I changed the default port to my secret [PortNumber] and for some reason it doesn't work. My ssh_config file looks like this: Code: Host * And my iptables entry as you saw above is: Code: # SSH When I try to connect I get: Code: [root@webhost ~]# ssh root@myserver -p [PortNumber] |
|
| Author: | sweh [ Sun Aug 23, 2009 3:58 pm ] |
| Post subject: | |
Since your policy is "drop" but you're seeing "connection refused", I'm guessing that either you have other firewall rules in place ('reject') or else your ssh daemon isn't listening on the port you specified. Did you mean sshd_config? "ssh_config" is for the client; sshd_config is for the server. Given that you have "SendEnv" lines in there, I'm guessing you modified the wrong ssh configuration file. You can check with "iptables -L" for the firewall and "netstat -anp" to see if sshd is listening properly. |
|
| Author: | lec [ Sun Aug 23, 2009 4:14 pm ] |
| Post subject: | |
Yes, I was editing the wrong file. |
|
| Author: | Vance [ Sun Aug 23, 2009 7:57 pm ] |
| Post subject: | |
On CentOS, you can run service iptables status to view the current rules. The command service iptables save will save the current ruleset in /etc/sysconfig/iptables. You can edit this file, then use service iptables restart to load the rules from there. That ruleset will also be automatically loaded on boot (assuming you have the iptables service set to start in that runlevel). |
|
| Page 1 of 1 | All times are UTC-04:00 |
| Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |
|