IPTABLES syntax

Once it works, it works...but how to get it working

Moderator: EvLwMn

IPTABLES syntax

Postby cudaman » Mon Nov 08, 2004 5:06 am

ok, I have a slight problem that i think is with my IPTABLES configuration. I have a web server on port 81... on the external IP (eth1) i can veiw the page on the internal network (eth0)... using its external IP #... however, when I try a computer outside the internal network, it doesnt load (I believe it times out)... I think I have the port blocked externally and when i go to add a rule to allow it I get this:

Code: Select all
iptables -A input -s 0/0 -dport 81 -j ACCEPT
Bad argument `81'
Try `iptables -h' or 'iptables --help' for more information.


I have my syntax wrong i think... and its late so that might be part of the problem... but what is the right syntax for doing what i want done here?
  • 2.53 P4 533 fsb
  • Abit IT7 MAX2 v2
  • 1 GB PC2700
  • Gainward FX5600
  • 180 GB (2x30GB, 120GB)
  • Live! card
  • Gentoo 2.6.8-r1 dev kernel
User avatar
cudaman
Eating Encyclopedias
 
Posts: 902
Joined: Fri Apr 25, 2003 5:25 pm
Location: o HI o

Postby Peter » Wed Nov 10, 2004 7:15 am

iptables -A INPUT -i eth0 -p tcp --dport 81 -j ACCEPT
or something...I guess... :roll: :wink:
Peter
Site Admin
Site Admin
 
Posts: 1355
Joined: Sat Mar 23, 2002 12:20 pm
Location: Germany

Postby cudaman » Wed Nov 10, 2004 4:55 pm

wierd..... that i have to use -i and cant use -s ...... :?

nvm.... i guess i missed a dash next to the dport... it needs 2
  • 2.53 P4 533 fsb
  • Abit IT7 MAX2 v2
  • 1 GB PC2700
  • Gainward FX5600
  • 180 GB (2x30GB, 120GB)
  • Live! card
  • Gentoo 2.6.8-r1 dev kernel
User avatar
cudaman
Eating Encyclopedias
 
Posts: 902
Joined: Fri Apr 25, 2003 5:25 pm
Location: o HI o

Postby EvLwMn » Wed Nov 10, 2004 8:57 pm

Wow - sorry I missed this one. So did you get it working?
Which reminds me why I want to start working on a beowulf-on-a-backplane design: I want to be the one to write the program called "clusterfsck."
-- Adam J. Thornton, a.s.r.
User avatar
EvLwMn
Linux Queen
Linux Queen
 
Posts: 6258
Joined: Sun Sep 22, 2002 8:16 pm
Location: The Linux Lounge

Postby cudaman » Fri Nov 12, 2004 6:22 am

ya i didnt double dash the dport option

--dport NOT -dport

i think they need to say that somewhere :?
  • 2.53 P4 533 fsb
  • Abit IT7 MAX2 v2
  • 1 GB PC2700
  • Gainward FX5600
  • 180 GB (2x30GB, 120GB)
  • Live! card
  • Gentoo 2.6.8-r1 dev kernel
User avatar
cudaman
Eating Encyclopedias
 
Posts: 902
Joined: Fri Apr 25, 2003 5:25 pm
Location: o HI o

Postby EvLwMn » Tue Nov 16, 2004 2:10 pm

Oh yeah - those double dashes are a PITA sometimes. I forget them all the time myself - and I definitely know better.

Glad you got it working now dude :D
Which reminds me why I want to start working on a beowulf-on-a-backplane design: I want to be the one to write the program called "clusterfsck."
-- Adam J. Thornton, a.s.r.
User avatar
EvLwMn
Linux Queen
Linux Queen
 
Posts: 6258
Joined: Sun Sep 22, 2002 8:16 pm
Location: The Linux Lounge

Postby cuchumino81 » Tue Nov 30, 2004 2:28 pm

kay dudes, well as you know, i have succesfully installed gentoo, and now i want to run my bittorrent client on here, but i think i am overlooking the linux's firewall. It may have to do with the iptables. I don't really know much bout configging them on the terminal screen cuz i was a fedora user, and all i had to do to enable a port is look for the security tab in the startup panel, and put in the port address.

actually, i could prolly pull this off myself if i knew where the iptables script is located....

Any help appreciated

edit: as of, i have downloaded some front ends for iptables, firestart, and gtk-iptables, but i don't know the first thing bout iptables, so any help i can get is welcome
remember that death is not the end, only a transition
User avatar
cuchumino81
Living Library
 
Posts: 1346
Joined: Thu Mar 18, 2004 10:36 pm
Location: NYC, NY

Postby cudaman » Wed Dec 01, 2004 9:21 am

If you didnt compile certain things in your kernel, it isnt even running.

however, here is some good reading:

http://www.linuxguruz.com/iptables/howto/iptables-HOWTO.html (HJ gave that to me)

http://www.gentoo.org/doc/en/home-router-howto.xml (has SOME iptables info including that bittorrent port and stuff)

http://www.iptables.org/ (and ofcourse iptables.org)

terminal isnt too bad, just a lot of typing. thats the only way that I have set it up.

HJ wrote:As always with Linux...I highly recommend the How-To
http://www.linuxguruz.com/iptables/howt ... HOWTO.html


At the console type this:

IPTABLES -A FORWARD DENY
IPTABLES -A INPUT DENY
IPTABLES -A OUTPUT DENY

This will cause your machine to stop recieving any net traffic what so ever through TCP.

IPTABLES -D FORWARD DENY
IPTABLES -D INPUT DENY
IPTABLES -D OUTPUT DENY

This will remove them with the -D command if you want to test...
You can choose Source IP addresses...Destination addresses...
You can remove all traffic from your system except a single Port...

Its quite useful.


also IPTABLES SAVE will now save all that precious typing to a file that it will reload on startup
  • 2.53 P4 533 fsb
  • Abit IT7 MAX2 v2
  • 1 GB PC2700
  • Gainward FX5600
  • 180 GB (2x30GB, 120GB)
  • Live! card
  • Gentoo 2.6.8-r1 dev kernel
User avatar
cudaman
Eating Encyclopedias
 
Posts: 902
Joined: Fri Apr 25, 2003 5:25 pm
Location: o HI o

Postby cuchumino81 » Wed Dec 01, 2004 10:26 am

yea i got it running. To make things easier, i downloaded a frontend firewall called firestarter :).


It is very simple and i know that it doesn't take advantage of the ip tables at 100% but it is somethig, and i am downloading
:)
remember that death is not the end, only a transition
User avatar
cuchumino81
Living Library
 
Posts: 1346
Joined: Thu Mar 18, 2004 10:36 pm
Location: NYC, NY

Postby cudaman » Thu Dec 02, 2004 9:34 am

congrats, and good luck. I've heard of that program before. hopefully you get it going soon 8)
  • 2.53 P4 533 fsb
  • Abit IT7 MAX2 v2
  • 1 GB PC2700
  • Gainward FX5600
  • 180 GB (2x30GB, 120GB)
  • Live! card
  • Gentoo 2.6.8-r1 dev kernel
User avatar
cudaman
Eating Encyclopedias
 
Posts: 902
Joined: Fri Apr 25, 2003 5:25 pm
Location: o HI o

Postby cuchumino81 » Wed Dec 15, 2004 3:28 pm

well, when i actually thought i had the firewall config my bit torrent port on, it wasn't. Im still getting a NAT error when i test the port on Azureus. Im gonna read up and see what i can find.
remember that death is not the end, only a transition
User avatar
cuchumino81
Living Library
 
Posts: 1346
Joined: Thu Mar 18, 2004 10:36 pm
Location: NYC, NY

Postby cudaman » Thu Dec 16, 2004 9:11 am

hrm.... check and see what order all the rules are in

if a block 0-1200 is before an accept 120 the 120 will not work.

also make sure the protocol is right udp tcp etc.....
  • 2.53 P4 533 fsb
  • Abit IT7 MAX2 v2
  • 1 GB PC2700
  • Gainward FX5600
  • 180 GB (2x30GB, 120GB)
  • Live! card
  • Gentoo 2.6.8-r1 dev kernel
User avatar
cudaman
Eating Encyclopedias
 
Posts: 902
Joined: Fri Apr 25, 2003 5:25 pm
Location: o HI o


Return to Linux OS

Who is online

Users browsing this forum: No registered users and 0 guests

cron