OpenVZ Forum


Home » General » Support » *SOLVED* iptables
icon5.gif  *SOLVED* iptables [message #3898] Fri, 23 June 2006 06:42 Go to next message
goeldi
Messages: 92
Registered: June 2006
Member
When I start iptables on my host system, I can no more connect with ssh. Stopping iptables is no option. Can anybody provide a working /etc/sysconfig/iptables file please?

On the host system I already loaded these modules:
iptable_filter iptable_mangle ipt_limit ipt_multiport ipt_tos ipt_TOS ipt_REJECT ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_LOG ipt_length ip_conntrack ip_conntrack_ftp ip_conntrack_irc ipt_conntrack ipt_state ipt_helper iptable_nat ip_nat_ftp ip_nat_irc ipt_REDIRECT

The host is CentOS 4.3 with Kernel 2.6.8-022stab077.1 and the vps is CentOS too.

This is the /etc/sysconfig/iptables file:

# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
# the following 3 lines I added manually, but I think they do the same as the above ones:
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 19150 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 10000 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Generated by webmin
*mangle
:FORWARD ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
COMMIT
# Completed
# Generated by webmin
*nat
:OUTPUT ACCEPT [0:0]
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
COMMIT
# Completed


This is the file /etc/sysctl.conf:
# Controls IP packet forwarding
net.ipv4.ip_forward = 1
net.ipv4.conf.default.proxy_arp = 0
# Enables source route verification
net.ipv4.conf.all.rp_filter = 1
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 1
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0

[Updated on: Fri, 23 June 2006 08:10] by Moderator

Report message to a moderator

Re: iptables [message #3900 is a reply to message #3898] Fri, 23 June 2006 06:50 Go to previous messageGo to next message
Vasily Tarasov is currently offline  Vasily Tarasov
Messages: 1345
Registered: January 2006
Senior Member
Just for clarity:

1) You can't connect to VPS or to Host?
2) iptables rules you've posted are for host or for VPS?

Thanks.
Re: iptables [message #3901 is a reply to message #3900] Fri, 23 June 2006 06:59 Go to previous messageGo to next message
goeldi
Messages: 92
Registered: June 2006
Member
hello again Wink

I can't connect to the host (the hardware node) if iptables is loaded with openvz-kernel. I can if iptables is loaded with standard CentOS kernel and I can if openvz-kernel runs WITHOUT iptables.

The posted iptables rules are for the host.
Re: iptables [message #3902 is a reply to message #3898] Fri, 23 June 2006 07:32 Go to previous messageGo to next message
Vasily Tarasov is currently offline  Vasily Tarasov
Messages: 1345
Registered: January 2006
Senior Member
You should load ip_conntrack module with parameter
ip_conntrack_enable_ve0=1 in 2.6.8 kernel.
Here is described how to do it easily:
http://forum.openvz.org/index.php?t=tree&th=294&mid= 1686&&rev=&reveal=
Re: iptables [message #3905 is a reply to message #3902] Fri, 23 June 2006 08:01 Go to previous messageGo to next message
goeldi
Messages: 92
Registered: June 2006
Member
Yes, that was it. Thank you very much.

Another question though: the w command doesn't show any user logged in in the host and in the vps although there are 2. Is this a openvz or a kernel 2.6.8 'feature'?
Re: iptables [message #3906 is a reply to message #3905] Fri, 23 June 2006 08:10 Go to previous message
Vasily Tarasov is currently offline  Vasily Tarasov
Messages: 1345
Registered: January 2006
Senior Member
You know, w uses utmp file and /proc as the source of information, and there are lot of nuances... manpage on utmp is interesting =)
You can also check this conversation:
http://forum.openvz.org/index.php?t=tree&th=413&mid= 2373&&rev=&reveal=
Previous Topic: Required Packages?
Next Topic: *SOLVED* vzctl create extremly slow
Goto Forum:
  


Current Time: Sun Jul 21 02:21:20 GMT 2024

Total time taken to generate the page: 0.02339 seconds