Jump to content

Kali Linux not saving IPTables rules


NightStalker

Recommended Posts

I am using Kali 1.05 and for some reason when I enter an IPTables rule such as below it does not save or show up when I list the rules:

===========================================================================

root@kali:~# iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 10000

root@kali:~# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination

===========================================================================

Just for giggles I did try with the sudo command but still nothing. Am I missing something stupid?
Thanks in advance.
Link to comment
Share on other sites

It does show running and the funnier part is when I do an iptables-save I see the line in the config:

===========================================================================

root@kali:~# iptables-save
# Generated by iptables-save v1.4.14 on Fri Jan 3 10:38:42 2014
*nat
:PREROUTING ACCEPT [1:52]
:INPUT ACCEPT [1:52]
:OUTPUT ACCEPT [8:1016]
:POSTROUTING ACCEPT [8:1016]
-A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 10000
COMMIT
# Completed on Fri Jan 3 10:38:43 2014
# Generated by iptables-save v1.4.14 on Fri Jan 3 10:38:43 2014
*filter
:INPUT ACCEPT [392:37336]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [252:46598]
COMMIT
# Completed on Fri Jan 3 10:38:43 2014

===========================================================================

Link to comment
Share on other sites

Well I knew it was going to be stupid, probably my more lack of knowledge of IPTables. I noticed when I added something to the INPUT chain it showed and when I did the iptables-save command I saw the NAT there. So I searched more and found that PREROUTING was just hidden in the iptables -L command. When I changed it to include the NAT:

===========================================================================

root@kali:~# iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 10000
root@kali:~# iptables -t nat --list
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
REDIRECT tcp -- anywhere anywhere tcp dpt:http redir ports 10000
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
root@kali:~#

===========================================================================

Hopefully this will help someone else with the same lack of knowledge I had :)
NightStalker
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...