Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Wed Jan 14, 2015 11:42 pm 
Offline

Joined: Wed Jan 14, 2015 11:36 pm
Posts: 1
VPS OS: CentOS 6

I added below lines in the "/etc/sysconfig/iptables"

Code:
-A INPUT -p udp --dport 500 -j ACCEPT
-A INPUT -p udp --dport 4500 -j ACCEPT
-t nat -A POSTROUTING -s 10.12.0.0/24 -o eth0 -j MASQUERADE
-A FORWARD -s 10.12.0.0/24 -j ACCEPT


Then the command "service iptables restart" said:
iptables: Setting chains to policy ACCEPT: security raw nat[ OK ]filter
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
iptables: Applying firewall rules: iptables-restore: line 3 failed
[FAILED]


It seem that the POSTROUTING line encountered errors.
Would you please help me check this issue and give me some suggestion on it?


Top
   
PostPosted: Fri Jan 16, 2015 1:25 am 
Offline
Senior Member
User avatar

Joined: Sun Jan 18, 2009 2:41 pm
Posts: 830
-t nat is not valid syntax for iptables-restore. You need to find the *nat section in /etc/sysconfig/iptables and add your rule there. Something like this:
Code:
...
# Completed on Fri Aug 29 13:05:29 2014
# Generated by iptables-save v1.3.5 on Fri Aug 29 13:05:29 2014
*nat
:PREROUTING ACCEPT [22068:3016900]
:POSTROUTING ACCEPT [38126:2628174]
:OUTPUT ACCEPT [38390:2644260]
-A POSTROUTING -s 10.12.0.0/24 -o eth0 -j MASQUERADE
COMMIT
...


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group