iptables

ipTables blocking memcached

I have one server running memcached and another server that should be able to connect to the memcached server. memcached is set up to listen to 0.0.0.0:5666 This allows for anyone to connect to it so i want to block the port 5666 for everyone except the other server. I thought this would do it: iptables -A INPUT -p tcp --dport 5666 -j...

Lipipq(iptables) . How do I redirect captured packet to another address with iptables queue?

Hi Developers, I don't know how to solve my problem. Is it possible to redirect captured packet with ipq_set_verdict()? I want to redirect unauthorized users to login page. Please see my code: The packets are accepted and my browser opens requested page(not changed destination address) void main() { struct ipq_handle* h; i...

Revert IP Lever port redirection

Hello, i would like to find a way, to revert ip level rooting i have done on a server of mine. A friend helped me with the following commands, to redirect traffic from 80 to 8080. Nevertheless, it needs to be rerun after server is restarted. Now i will go for standart apache2 configuration. How could i revert that ip redirection? The co...

iptables block all and allow only few classes

Hello How to block all incoming on port 80,22,21 for all ips and allow only 3 classes 212.162.128.0/19 212.215.128.0/17 213.5.168.0/21 Thanks in advance ...

How can one filter LOCAL ADS for LOCAL CUSTOMERS.

I run a local blog, and I would like to offer advertisers the ability to buy ads knowing all of the impressions will be from the local community. For everyone else I want it to show typical google ads. My questions are: How feasible is this? Is there any readily available code or service that can do something like this? The cheaper t...

Converting subnet mask "/" notation to Cisco 0.0.0.0 standard

Hi there, I've searched SO for help but could'nt find a answer to my question. Situation: I need to convert a "/NN" subnet mask notation (think IPTABLES) to a 0.0.0.0 cisco notation. NN are the number of "1" in the submask, from the lowest octet to the higher. Each octet are 8 bit integers. Possible solution: Make a array of 32 "0"...

Why does Capistrano lock up when executing a specific iptables command?

I'm trying to remotely open a port in a iptables firewall using Capistrano. Here's my task: desc "Open up a port in the firewall" task :open_port, :roles => :all do port = variables[:port] || nil if (!port) puts "You must specify the port number" next end run "#{sudo} /sbin/iptables -I RH-Firewall-1-INPU...

My memcache is timing out. Does anyone know why?

I am using memcached and python-memcache. On my cache server, iptables is set perfectly, and it's allowed: ACCEPT all -- dev anywhere The process is this: /usr/local/bin/memcached -d -u root -m 3900 -p 11211 I do this in Django but it's not working. It times out at cache.set. cache.set("test","laa",333) prin...

DNS problem - dig resolves but curl cannot connect to host

I have recently created a Rackspace cloud server instance using CentOS 5.5. I have used yum to install the "Web Server" group (it includes Apache, etc.), added www.booztrakr.com as the ServerName in httpd.conf, made sure iptables allows on port 80. I had registered this domain with Go-Daddy and changed their name servers to the Rackspa...

iptables redirect local cennections

Hi, I used iptables -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-ports 8085 to redirect all http requests to jboss server on port 8085. This works fine if packets come from outside. If I try to open from the same machine it doesnt work. Telnet gives connection refused. How do I redirect local connections? Working on ce...

Prevention from entire website downloading?

There is one IP (from China) which is trying to download my entire website. It downloads all my pages and loads the server significantly (I have more than 500 000 pages). Looking at the access logs I can tell it's definitely not a Google bot or any other search engine bot. Temporarily I've banned it (using iptables rules), but it's not ...

iptables utility on andrid sdk emulator avd

I am trying to learn android os. My aim is to learn security part. I am trying to find iptables utility in file system hierarchy. Do you know where is it? Also there is no too like find or "ls -laR" or grep. I am using anroid sdk and emulator avd with android os 2.2 API8 ...

iptables : what is wrong with this iptables rule?

I am running this command : iptables -A http_flood -m hashlimit --hashlimit 1/sec --hashlimit-burst 3 --hashlimit-mode dstip,dstport,srcport --hashlimit-name hosts -j MARK --set-mark 0xf100 And getting this error: iptables: Unknown error 4294967295 Any suggestions? ...

iptables blocking DNS server

I'm trying to configure my server to allow incoming DNS queries. The default server, as setup by the hosting company, permits traffic on ports 443, 80 and 22. I have modified the iptables file to try to permit requests on port 53, but I am not getting any response from BIND. Turning off the firewall permits the DNS request to go through...

iptables flush issue

I am using iptables to change the ip address of a snmptrap packet so it looks like it came from different device. I wrote a PERL script that I pass flags to and it sends the simulated traps but I ran into a issue when trying to send a trap for one IP and then immediately trying to send another trap for a different IP. If I don't wait 3...

Iptables: Two IP-Adresses, allow Port 3306 just for one

my server has two ip's: # IP one: 192.168.45.1 (allow MYSQL on Port 3306) # IP two: 192.168.45.2 (disallow MYSQL on Port 3306) . how can i configure iptables, to drop incoming connections for a specific IP and allow it to the other? . # # Allow MYSQL-Port only for 192.168.45.1! # /sbin/iptables -A INPUT -p tcp 192.168.45.1 --dpor...

Flush iptables on ubuntu

The following entries are used to flush the iptable rules: /sbin/iptables --policy INPUT ACCEPT /sbin/iptables --policy OUTPUT ACCEPT /sbin/iptables --policy FORWARD ACCEPT /sbin/iptables -F Is it possible to place the above in any file(/etc/iptables.rules) so that I can use iptables-apply -t 60 /etc/iptables.rules to avoid m...

How can I invoke /sbin/iptables from a Perl CGI under taint mode?

When I invoke "sudo /sbin/iptables ..." in my Perl CGI scripts, I get the error: Insecure dependency in system while running with -T switch at usr/lib/perl5/vendor_perl/5.8.8/IPC/Run3.pm line 403 I tried to add "/sbin:/etc/sysconf:/etc/init.d" in $ENV{'PATH'} but still no success. Anybody has any idea? ...

UDP MITM by adding rules to iptables.

In http://stackoverflow.com/questions/3878303/c-udp-socket-port-multiplexing, I found that using DNAT PREROUTING, I can redirect the packets for a particular UDP port and listen to packets being received on it. iptables -t nat -A PREROUTING -i <iface> -p <proto> --dport <dport> -j REDIRECT --to-port <newport> Unfortunately this w...

IPtables rules to forward all traffic to and from a port to a new port on the same machine.

Please tell if the following iptables rules are correct. I need to forward all traffic to and from port 5060, to port 56789 on the same machine. iptables -t nat -A PREROUTING -p udp --dport 5060 -j REDIRECT --to-port 56789 iptables -t nat -A PREROUTING -p udp --sport 5060 -j REDIRECT --to-port 56789 iptables -t nat -A OUTPUT -p udp --...