LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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
 
LinkBack Search this Thread
Old 04-23-2005, 12:40 PM   #1
no_names_left
LQ Newbie
 
Registered: Dec 2004
Posts: 19

Rep: Reputation: 0
Iptables command won't work


Hi,

I have iptables installed but the command "iptables" doesn't do anything. All I get is bash: iptables: command not found, which seems a little odd to me.

I am sure that I have iptables installed and have tried to configure it will webmin but I think something went wrong. Can anyone help me recover this please?

Thanks,

James
 
Old 04-23-2005, 01:02 PM   #2
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
Hi James,

Bash is telling you it couldn't find iptables. So, or if it is not installed or it is not on your path. Iptables is generally installed on /usr/sbin; if you are trying to execute it from a normal user, probably you won't find it.

Good luck!

Osvaldo.
 
Old 04-23-2005, 01:02 PM   #3
Ephracis
Senior Member
 
Registered: Sep 2004
Location: Sweden
Distribution: Ubuntu, Debian
Posts: 1,109

Rep: Reputation: 49
What kernel are you using?

iptables should be in /usr/sbin/iptables, have you checked with whereis iptables? You may need to modprobe iptables if you have it compiled as a module and it does not load on boot.
 
Old 04-23-2005, 01:10 PM   #4
no_names_left
LQ Newbie
 
Registered: Dec 2004
Posts: 19

Original Poster
Rep: Reputation: 0
Hi guys,

Thanks for your quick responses. I tried #whereis iptables and got iptables: /sbin/iptables /lib/iptables /usr/share/man/man8/iptables.8.gz

I am a newbie to this area of linux and don't understand what you mean by

"You may need to modprobe iptables if you have it compiled as a module and it does not load on boot."

Could it be that I have made a mess of the configuration files and now it won't start?

thanks,

James
 
Old 04-23-2005, 01:12 PM   #5
no_names_left
LQ Newbie
 
Registered: Dec 2004
Posts: 19

Original Poster
Rep: Reputation: 0
also. I am using Fedora Core 2 which I think it kernel 2.4. Is there a shell command to tell this?
 
Old 04-23-2005, 01:21 PM   #6
Ephracis
Senior Member
 
Registered: Sep 2004
Location: Sweden
Distribution: Ubuntu, Debian
Posts: 1,109

Rep: Reputation: 49
Do this /sbin/iptables -h
That should work. You have iptables in /sbin/ which is not in your $PATH, it shouldn't be if you are not root. Are you sure that you have been root when you have been trying to access iptables? Cause iptables requires root access.
 
Old 04-23-2005, 01:39 PM   #7
no_names_left
LQ Newbie
 
Registered: Dec 2004
Posts: 19

Original Poster
Rep: Reputation: 0
Just tried /sbin/iptables -h and it displayed a list of instructions Now I have /sbin/ in front of the commands it seems to work. The /sbin/iptables command and /sbin/iptables --list command work.

Should I update my $PATH and if so do you know how I should do this?

thanks,

James
 
Old 04-23-2005, 05:39 PM   #8
Ephracis
Senior Member
 
Registered: Sep 2004
Location: Sweden
Distribution: Ubuntu, Debian
Posts: 1,109

Rep: Reputation: 49
Are you sure that you are root when trying? Because here is the thing. /sbin is "super-user bin" and it is a dir with programs only for root, therefor root should have it in $PATH but a regular user should not. Whoever you are you can check you $PATH with echo $PATH.

Here is how you change $PATH.
Edit /root/.bashrc and add this line:
Code:
export PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH
This line adds three sbin-dirs and at last the original path, to path. The reason we put it into the /root/.bashrc file is because now it will be updated every time you login as root.
 
Old 04-23-2005, 07:06 PM   #9
no_names_left
LQ Newbie
 
Registered: Dec 2004
Posts: 19

Original Poster
Rep: Reputation: 0
I am certain that I am the su. Firstly if says root and second there is # which I assume also means root.

So on echo $path I got nothing at all. just a blank line. Should i be worried?

Anyhow I will try you code to change this.

James
 
Old 04-23-2005, 07:53 PM   #10
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
Hi James,

If you're doing from kde and maybe gnome, you won't have /sbin and /usr/sbin in your path. It would be different in text mode.

Osvaldo.

P.S. PATH must be in upper case letters.

Last edited by osvaldomarques; 04-23-2005 at 07:55 PM.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
An error occured getting IPtables status from the command /etc/rc.d/init.d/iptables s CrazyMAzeY Linux - Newbie 10 08-12-2010 05:25 AM
iptables command/iptables GUI? basketkase999 Linux - Security 5 04-12-2005 02:43 PM
[IPTABLES] FTP doesnt work with ls command narmida Linux - Networking 3 03-11-2005 12:51 PM
IPTABLES command netguy2000 Linux - Security 5 02-20-2004 09:02 AM
Iptables command ThePlague Linux - Networking 6 02-16-2004 04:51 PM


All times are GMT -5. The time now is 10:59 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration