Jump to content



Photo

iptables if not ip?


  • Please log in to reply
7 replies to this topic

#1 Original Poster

Original Poster

    Systems Developer

  • Tech Issues Solved: 1
  • Joined: 15-July 08
  • Location: my room
  • OS: windows 7/8, Kali, ubuntu, OSx 10.9
  • Phone: Android

Posted 11 August 2014 - 09:20

hey!

 

I am just setting up an IP tables rule ( i really need a good book suggestion for iptables because I cant keep asking you guys/budman all the time)

where if the ip address is not 192.168.0.1 then follow a certain rule I already have the rule I want to be followed in place I just do not know how to do this if ip rule ;(

 

any help? links etc?




#2 Xahid

Xahid

    Anokha Neowinian

  • Tech Issues Solved: 1
  • Joined: 04-November 01
  • OS: Windows 7 Ultimate

Posted 11 August 2014 - 09:27

If you know basic firewall rules and have basic understanding how firewall works, you can easily setup IPTables.

use vuurmuur to configure IPTables, its GUI or more like TUI for IPTables.

seeing is believing.

http://www.vuurmuur....ots#Screenshots



#3 OP Original Poster

Original Poster

    Systems Developer

  • Tech Issues Solved: 1
  • Joined: 15-July 08
  • Location: my room
  • OS: windows 7/8, Kali, ubuntu, OSx 10.9
  • Phone: Android

Posted 11 August 2014 - 09:36

If you know basic firewall rules and have basic understanding how firewall works, you can easily setup IPTables.

use vuurmuur to configure IPTables, its GUI or more like TUI for IPTables.

seeing is believing.

http://www.vuurmuur....ots#Screenshots

I understand the logic just not the code D: I would honestly rather script it than use a GUI, GUIs are for when I can use the command line and have the right to be lazy :p



#4 Xahid

Xahid

    Anokha Neowinian

  • Tech Issues Solved: 1
  • Joined: 04-November 01
  • OS: Windows 7 Ultimate

Posted 11 August 2014 - 10:01

GUI will make thing easier, you don't have to remember the context of the code for each command.



#5 +BudMan

BudMan

    Neowinian Senior

  • Tech Issues Solved: 100
  • Joined: 04-July 02
  • Location: Schaumburg, IL
  • OS: Win7, Vista, 2k3, 2k8, XP, Linux, FreeBSD, OSX, etc. etc.

Posted 11 August 2014 - 12:30

The ! is how you invert something, this is standard across most anything not jut iptables. if you want your rule to be if the IP is not 192.168.0.1 then it would be be ! 192.168.0.1. if you want to say everything but a specific interface then something like !eth1

Have you looked at the man even?
http://linux.die.net/man/8/iptables

Here is good ref
http://shop.oreilly....780596005696.do

hint.. maybe if you google for that there would be links to find it pdf.. just saying that might happen if you google..

#6 OP Original Poster

Original Poster

    Systems Developer

  • Tech Issues Solved: 1
  • Joined: 15-July 08
  • Location: my room
  • OS: windows 7/8, Kali, ubuntu, OSx 10.9
  • Phone: Android

Posted 11 August 2014 - 12:39

The ! is how you invert something, this is standard across most anything not jut iptables. if you want your rule to be if the IP is not 192.168.0.1 then it would be be ! 192.168.0.1. if you want to say everything but a specific interface then something like !eth1

Have you looked at the man even?
http://linux.die.net/man/8/iptables

Here is good ref
http://shop.oreilly....780596005696.do

hint.. maybe if you google for that there would be links to find it pdf.. just saying that might happen if you google..

I went crazy googling :p I do google before I ask here I just dont know what to search half the time...

 

this is what I used in the end

 

A PREROUTING -i eth0 -d ! 192.168.0.1 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128



#7 +BudMan

BudMan

    Neowinian Senior

  • Tech Issues Solved: 100
  • Joined: 04-July 02
  • Location: Schaumburg, IL
  • OS: Win7, Vista, 2k3, 2k8, XP, Linux, FreeBSD, OSX, etc. etc.

Posted 11 August 2014 - 12:44

so you did this ?
http://lmgtfy.com/?q...invert iptables
 

:shiftyninja: If you google the book I linked too, I don't know it might be available all over the place as a pdf for free - somethings are like that on the internet, free and everywhere is all I am saying ;)



#8 OP Original Poster

Original Poster

    Systems Developer

  • Tech Issues Solved: 1
  • Joined: 15-July 08
  • Location: my room
  • OS: windows 7/8, Kali, ubuntu, OSx 10.9
  • Phone: Android

Posted 11 August 2014 - 12:58

so you did this ?
http://lmgtfy.com/?q...invert iptables
 

:shiftyninja: If you google the book I linked too, I don't know it might be available all over the place as a pdf for free - somethings are like that on the internet, free and everywhere is all I am saying ;)

I know it is free over the web and easy to find lol but everything i searched for this problem just kept coming up with things I did not need :( and besides I am still learning :D it helps me more if it is my own question atleast I wont have to ask this question again. when this is all over I might have to write a full squid guide lol with loads of different angles this system is menttaalll