LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-13-2013, 06:28 PM   #1
user9876
LQ Newbie
 
Registered: Nov 2013
Posts: 3

Rep: Reputation: Disabled
What's wrong: -X requires a chain and a policy


What I'm doing is wrong?

I'm trying to deploy a simple set of iptables rules directly from a howto (Ubuntu 12.04, Linux 3.5.0-39-generic, iptables 1.4.12):

Code:
#clean rules table
sudo iptables -F
sudo iptables -P INPUT DROP
sudo iptables -P FORWARD DROP
sudo iptables -P OUTPUT DROP

#allow inbound www
sudo iptables -P OUTPUT -o eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
At this stage I get the following error:
Code:
iptables v1.4.12: -X requires a chain and a policy
What is wrong with the command and why does it mention -X whereas I didn't use it.
 
Old 11-14-2013, 07:05 PM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,804

Rep: Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224
The error message is mistakenly stating "-X" when it should be saying "-P". The "-P" action sets the policy for a chain and expects only the chain name and target as its two operands. For adding or inserting a new rule you should be using the "-A" or "-I" actions, respectively.
 
Old 11-17-2013, 05:23 PM   #3
user9876
LQ Newbie
 
Registered: Nov 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
The error message is mistakenly stating "-X" when it should be saying "-P". The "-P" action sets the policy for a chain and expects only the chain name and target as its two operands. For adding or inserting a new rule you should be using the "-A" or "-I" actions, respectively.
Thank you, silly me! Wrongly copied stuff.. but I'm just learning.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Configure my Redhat directory server password policy and account lockout policy arunplanet Linux - Newbie 4 10-06-2012 09:59 AM
Policy Routing - packets going out wrong device BRonkBMI Linux - Networking 1 09-26-2012 02:43 PM
Problem: Upgrading Firefox, it requires pangocairo, which requires pango with cairo supports murtuzanaqvi Linux - Newbie 1 08-27-2010 07:58 AM
iptables syn/fin dropping going to wrong chain b-neva Linux - Networking 13 02-03-2010 11:45 PM
Adobe Acrobate Reader Requires A Plugin-That Requires Open LDAP That Requires Berkely Old_Fogie Slackware 10 05-08-2006 06:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration