LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 12-31-2008, 03:00 AM   #1
please
Member
 
Registered: Apr 2007
Posts: 195

Rep: Reputation: 30
iptables


Hi

how can i configure in my iptables?
For Following

I want to allow for any access 10.10.10.10 to 22.22.22.22.
I want other 10.* can get access all except 22.22.22.22
I want 10.10.10.10 can all access
how can I do?

Please
Help me
 
Old 12-31-2008, 03:09 AM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by please View Post
how can i configure in my iptables?
For Following

I want to allow for any access 10.10.10.10 to 22.22.22.22.
I want other 10.* can get access all except 22.22.22.22
I want 10.10.10.10 can all access
how can I do?
This single command should do what it sounds like you want:
Code:
iptables -I INPUT -i eth0 -m iprange ! --src-range 10.10.10.10-22.22.22.21 -j DROP
But I'm not sure I properly understand what you've posted. This command would allow all packets coming from 10.10.10.10-22.22.22.21, which means packets from 22.22.22.22 would be filtered. If this wasn't what you were asking for then please rephrase your post.

Last edited by win32sux; 12-31-2008 at 03:28 AM.
 
Old 12-31-2008, 04:10 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
The 10/8 network is private. the others in the range aren't so what you want to do doesn't make sense from a security standpoint.
 
Old 12-31-2008, 04:57 AM   #4
please
Member
 
Registered: Apr 2007
Posts: 195

Original Poster
Rep: Reputation: 30
Hi sirs

I have 2 uplinks.
I got load balancing but not OK for fail over.
I found 1 script for fail over with ping command.Very good
But My ISP was denied ping for Dos virus attack.
So I need to replace ping with other command.
I found host command but the host command has not -I interface option as ping.

I thought if I use iptables for
example:
eth1=10.10.10.10(up link)
eth2=11.11.11.11(up link)
eth0=192.168.1.1

>host 22.22.22.22 when I type

I want listen this query eth1 to 22.22.22.22
not want listen from eth2
>host 33.33.33.33 when I type

I want listen this query eth2 to 33.33.33.33
not want listen from eth1
Is it can OK?
 
Old 12-31-2008, 08:36 AM   #5
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by please View Post
I want listen this query eth2 to 33.33.33.33
not want listen from eth1
Is it can OK?
If you don't want packets with a source address of 33.33.33.33 to ever be allowed into the box via eth1, you could do something like:
Code:
iptables -I INPUT -i eth1 -s 33.33.33.33 -j DROP
 
Old 12-31-2008, 11:05 AM   #6
please
Member
 
Registered: Apr 2007
Posts: 195

Original Poster
Rep: Reputation: 30
Hi sir
Thanks for your help

Next time If I have problem please again help me sir
 
Old 12-31-2008, 12:50 PM   #7
please
Member
 
Registered: Apr 2007
Posts: 195

Original Poster
Rep: Reputation: 30
Unhappy

Hi sirs

I am OK for your IPtables.
I used tcping
My script is auto delete gateway address when link down.
I used auto delete for fail over.
tcping can`t use when deleted gateway.
How can I use this tcping without gateway?
Please advice me sirs
Please
 
Old 12-31-2008, 02:04 PM   #8
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by please View Post
Hi sirs

I am OK for your IPtables.
I used tcping
My script is auto delete gateway address when link down.
I used auto delete for fail over.
tcping can`t use when deleted gateway.
How can I use this tcping without gateway?
Please advice me sirs
Please
AFAICT this is a completely different issue, and as such it belongs in its own thread.

Please open a thread for this new issue in the Networking forum. Thanks.
 
Old 01-01-2009, 01:53 AM   #9
please
Member
 
Registered: Apr 2007
Posts: 195

Original Poster
Rep: Reputation: 30
Hi sir

I posted New but

Please check again my iptables file

/etc/sysconfig/iptables
# Generated by iptables-save v1.3.7 on Thu Jan 1 06:35:21 2009
*filter
:INPUT ACCEPT [60:4288]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [36:13344]
-A INPUT -s 203.81.71.113 -d 10.241.177.51 -j ACCEPT
-A INPUT -s 203.81.71.119 -d 10.241.184.99 -j ACCEPT
-A INPUT -s 203.81.71.119 -d 10.241.177.51 -j DROP
-A INPUT -s 203.81.71.113 -d 10.241.184.99 -j DROP
-A INPUT -s 203.81.71.113 -i eth3 -j DROP
-A INPUT -s 203.81.71.119 -i eth3 -j DROP
COMMIT
# Completed on Thu Jan 1 06:35:21 2009

eth1=10.241.177.51
eth2=10.241.184.99
eth3=eth3


Now I tested with tcping
Result 1
==============
[root@server ~]#tcping 203.81.71.113 80 -t 2
203.81.71.113 port 80 user timeout.

[root@server ~]#tcping 203.81.71.119 80 -t 2
203.81.71.119 port 80 user timeout.

I got following result when I stopped iptables
==============================================
Result 2
=============

[root@server ~]#tcping 203.81.71.113 80 -t 2
203.81.71.113 port 80 open.

[root@server ~]#tcping 203.81.71.119 80 -t 2
203.81.71.119 port 80 open.


sometime I got if "119 port open ","113 port 80 user timeout" when running Iptables.
I should get as Result 1 when running Iptables.
Please check for me sir what wrong in My iptables?
 
Old 01-01-2009, 03:35 AM   #10
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
When executing that tcping command, 203.81.71.113 will be the destination address on the packet. Your iptables rules are looking for 203.81.71.113 as the source address on the packet.
 
Old 01-01-2009, 06:20 AM   #11
please
Member
 
Registered: Apr 2007
Posts: 195

Original Poster
Rep: Reputation: 30
HI

OK I will be change 203.81.71.113 to -d

If Not OK I will be come back

Thanks for supporting
 
Old 01-01-2009, 06:41 AM   #12
please
Member
 
Registered: Apr 2007
Posts: 195

Original Poster
Rep: Reputation: 30
hi I am OK with My Old Rules for other 2 NIC card PC.But not ok with my 3 NIC PC.

I can use tcping. how do you think?

Thanks
Please
 
Old 01-01-2009, 12:18 PM   #13
unixfool
Member
 
Registered: May 2005
Location: Northern VA
Distribution: Slackware, Ubuntu, FreeBSD, OpenBSD, OS X
Posts: 782
Blog Entries: 8

Rep: Reputation: 158Reputation: 158
Quote:
Originally Posted by jschiwal View Post
The 10/8 network is private. the others in the range aren't so what you want to do doesn't make sense from a security standpoint.
Actually it does, if this is an external interface. Spoof attacks use such IPs externally. You should block such incoming traffic from entering your LAN.
 
Old 01-02-2009, 06:00 PM   #14
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You said that you wanted to open up 10/8 to 22/8. That is a large range of addresses you want to trust, most of which are public internet addresses.

Quote:
any access 10.10.10.10 to 22.22.22.22
By the way, you can use the telnet client to test a connection instead of the ping command:

telnet hostname 22

If the ssh daemon is running and port 22 is open, you will get a prompt from the server. You don't get farther than that, but this even allows you to learn the version of ssh used, from the reply message. This can be even more useful than the ping command.
 
  


Reply



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
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 v1.2.9: Unknown arg `/sbin/iptables' Try `iptables -h' or 'iptables --help' Niceman2005 Linux - Security 4 12-29-2005 08:20 PM
IPtables Log Analyzer from http://www.gege.org/iptables/ brainlego Linux - Software 0 08-11-2003 06:08 AM
iptables book wich one can you pll recomment to be an iptables expert? linuxownt Linux - General 2 06-26-2003 04:38 PM
My iptables script is /etc/sysconfig/iptables. How do i make this baby execute on boo ForumKid Linux - General 3 01-22-2002 07:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 08:51 PM.

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