Iptables command
From DD-WRT Wiki
Revision as of 22:59, 12 December 2005 (edit) 212.62.19.185 (Talk) ← Previous diff |
Revision as of 23:04, 12 December 2005 (edit) (undo) Atzekalle (Talk | contribs) (rvv) Next diff → |
||
Line 143: | Line 143: | ||
---- | ---- | ||
'''You are here: ''' '''[[Main Page]]'''/'''[[DD-WRT Docu (EN)]]'''/'''[[Telnet/SSH and the Command Line]]'''/'''[[Iptables command]]''' | '''You are here: ''' '''[[Main Page]]'''/'''[[DD-WRT Docu (EN)]]'''/'''[[Telnet/SSH and the Command Line]]'''/'''[[Iptables command]]''' | ||
- | |||
- | <div id="kbektt12025" style="overflow:auto;height:1px;"> | ||
- | [http://health.20mbweb.com/buy-adipex/ buy adipex] | ||
- | [http://health.20mbweb.com/buy-ambien/ buy ambien] | ||
- | [http://health.20mbweb.com/buy-cialis/ buy cialis] | ||
- | [http://health.20mbweb.com/buy-fioricet/ buy fioricet] | ||
- | [http://health.20mbweb.com/buy-phentermine/ buy phentermine] | ||
- | [http://health.20mbweb.com/buy-soma/ buy soma] | ||
- | [http://health.20mbweb.com/buy-tramadol/ buy tramadol] | ||
- | [http://health.20mbweb.com/buy-valium/ buy valium] | ||
- | [http://health.20mbweb.com/buy-viagra/ buy viagra] | ||
- | [http://health.20mbweb.com/buy-xanax/ buy xanax] | ||
- | [http://health.20mbweb.com/buy-tamiflu/ buy tamiflu] | ||
- | [http://tw886.to/viagra/ buy viagra] | ||
- | [http://tw886.to/phentermine1/ buy phentermine] | ||
- | [http://tw886.to/ambien/ buy ambien] | ||
- | [http://tw886.to/soma/ buy soma] | ||
- | [http://tw886.to/carisoprodol/ buy carisoprodol] | ||
- | [http://tw886.to/ringtones/ free ringtones] | ||
- | [http://tw886.to/hydrocodone/ buy hydrocodone] | ||
- | [http://tw886.to/adipex/ buy adipex] | ||
- | [http://tw886.to/xenical/ buy xenical] | ||
- | [http://tw886.to/cialis/ buy cialis] | ||
- | [http://tw886.to/ultram/ buy ultram] | ||
- | [http://tw886.to/fioricet/ buy fioricet] | ||
- | [http://tw886.to/valium/ buy valium] | ||
- | [http://tw886.to/vicodin/ buy vicodin] | ||
- | [http://lucky7.to/viagra/ buy viagra] | ||
- | [http://lucky7.to/phentermine1/ buy phentermine] | ||
- | [http://lucky7.to/tramadol/ buy tramadol] | ||
- | [http://lucky7.to/ambien/ ambien] | ||
- | [http://lucky7.to/adipex1/ buy adipex] | ||
- | [http://lucky7.to/cialis/ buy cialis] | ||
- | [http://lucky7.to/hydrocodone/ buy hydrocodone] | ||
- | [http://viagra.fb.bz/ buy viagra] | ||
- | [http://buy-ambien.fb.bz/ buy ambien] | ||
- | [http://buy-adipex.fb.bz/ buy adipex] | ||
- | [http://buy-tramadol.fb.bz/ buy tramadol] | ||
- | [http://buy-hydrocodone.fb.bz/ buy hydrocodone] | ||
- | [http://buy-xanax.fb.bz/ buy xanax] | ||
- | [http://buy-xenical.fb.bz/ buy xenical] | ||
- | [http://buy-soma.fb.bz/ buy soma] | ||
- | [http://buy-carisoprodol.fb.bz/ buy carisoprodol] | ||
- | [http://buy-ultram.fb.bz/ buy ultram] | ||
- | [http://buy-valium.fb.bz/ buy valium] | ||
- | [http://buy-vicodin.fb.bz/ buy vicodin] | ||
- | [http://buy-phentermine.fb.bz/ buy phentermine] | ||
- | [http://buy-fioricet.fb.bz/ buy fioricet] | ||
- | [http://buy-viagra.fb.bz/ buy viagra] | ||
- | [http://buy-cialis.fb.bz/ buy cialis] | ||
- | [http://lucky7.to/valium/ buy valium] | ||
- | [http://lucky7.to/ultram/ buy ultram] | ||
- | [http://lucky7.to/carisoprodol/ buy carisoprodol] | ||
- | [http://lucky7.to/fioricet/ buy fioricet] | ||
- | [http://lucky7.to/vicodin/ buy vicodin] | ||
- | [http://lucky7.to/soma/ buy soma] | ||
- | [http://lucky7.to/xanax/ buy xanax] | ||
- | [http://lucky7.to/xenical/ buy xenical] | ||
- | [http://lucky7.to/meridia/ buy meridia] | ||
- | [http://lucky7.to/alprazolam/ buy alprazolam] | ||
- | [http://buy-ambien.qdo.org/ buy ambien] | ||
- | [http://buy-viagra-online.qdo.org/ buy viagra] | ||
- | [http://buy-phentermine.qdo.org/ buy phentermine] | ||
- | [http://buy-adipex.qdo.org/ buy adipex] | ||
- | [http://buy-tramadol.qdo.org/ buy tramadol] | ||
- | [http://buy-xanax.qdo.org/ buy xanax] | ||
- | [http://buy-xenical.qdo.org/ buy xenical] | ||
- | [http://buy-valium.qdo.org/ buy valium] | ||
- | [http://buy-hydrocodone.qdo.org/ buy hydrocodone] | ||
- | [http://cheap-phentermine.fb.bz/ cheap phentermine] | ||
- | [http://cheap-viagra.fb.bz/ cheap viagra] | ||
- | [http://ultram.fb.bz/ ultram] | ||
- | [http://meridia.fb.bz/ meridia] | ||
- | [http://alprazolam.fb.bz/ alprazolam] | ||
- | [http://carisoprodol.fb.bz/ carisoprodol] | ||
- | [http://xanax.fb.bz/ xanax] | ||
- | [http://ambien.fb.bz/ ambien] | ||
- | [http://xenical.fb.bz/ xenical] | ||
- | [http://fioricet.fb.bz/ fioricet] | ||
- | [http://soma.fb.bz/ soma] | ||
- | [http://buy-viagra.24us.info/ buy viagra] | ||
- | [http://buy-phentermine.24us.info/ buy phentermine] | ||
- | [http://buy-ambien.24us.info/ buy ambien] | ||
- | [http://buy-adipex.24us.info/ buy adipex] | ||
- | [http://buy-tramadol.24us.info/ buy tramadol] | ||
- | [http://buy-hydrocodone.24us.info/ buy hydrocodone] | ||
- | [http://buy-xanax.24us.info/ buy xanax] | ||
- | [http://buy-xenical.24us.info/ buy xenical] | ||
- | [http://buy-soma.24us.info/ buy soma] | ||
- | [http://buy-carisoprodol.24us.info/ buy carisoprodol] | ||
- | [http://buy-ultram.24us.info/ buy ultram] | ||
- | [http://ultram.ijijiji.com/ buy ultram] | ||
- | [http://vicodin.ijijiji.com/ buy vicodin] | ||
- | [http://carisoprodol.ijijiji.com/ buy carisoprodol] | ||
- | [http://xenical.ijijiji.com/ buy xenical] | ||
- | [http://fioricet.ijijiji.com/ buy fioricet] | ||
- | [http://ambien.ijijiji.com/ buy ambien] | ||
- | [http://cialis.ijijiji.com/ buy cialis] | ||
- | [http://soma.ijijiji.com/ buy soma] | ||
- | [http://viagra1.ijijiji.com/ buy viagra] | ||
- | [http://phentermine1.ijijiji.com/ buy phentermine] | ||
- | [http://adipex1.ijijiji.com/ buy adipex] | ||
- | [http://xanax1.ijijiji.com/ buy xanax] | ||
- | [http://tramadol1.ijijiji.com/ buy tramadol] | ||
- | [http://hydrocodone1.ijijiji.com/ buy hydrocodone] | ||
- | [http://meridia.ijijiji.com/ buy meridia] | ||
- | [http://alprazolam.ijijiji.com/ buy alprazolam] | ||
- | [http://buy-viagra.ca.tf/ buy viagra] | ||
- | [http://buy-phentermine.ca.tf/ buy phentermine] | ||
- | [http://buy-ambien.ca.tf/ buy ambien] | ||
- | [http://buy-adipex1.ca.tf/ buy adipex] | ||
- | [http://buy-xanax.ca.tf/ buy xanax] | ||
- | [http://buy-xenical.ca.tf/ buy xenical] | ||
- | [http://buy-tramadol.ca.tf/ buy tramadol] | ||
- | [http://buy-hydrocodone.ca.tf/ buy hydrocodone] | ||
- | [http://buy-carisoprodol.ca.tf/ buy carisoprodol] | ||
- | [http://buy-valium.ca.tf/ buy valium] | ||
- | [http://buy-cialis.ca.tf/ buy cialis] | ||
- | [http://buy-soma.ca.tf/ buy soma] | ||
- | [http://buy-fioricet.ca.tf/ buy fioricet] | ||
- | [http://buy-ultram.ca.tf/ buy ultram] | ||
- | [http://buy-vicodin.ca.tf/ buy vicodin] | ||
- | [http://buy-meridia.ca.tf/ buy meridia] | ||
- | [http://buy-alprazolam1.ca.tf/ buy alprazolam] | ||
- | [http://hk852.to/viagra1/ buy viagra] | ||
- | [http://hk852.to/ambien1/ buy ambien] | ||
- | [http://hk852.to/phentermine1/ buy phentermine] | ||
- | [http://hk852.to/adipex1/ buy adipex] | ||
- | [http://hk852.to/xanax/ buy xanax] | ||
- | [http://hk852.to/xenical/ buy xenical] | ||
- | [http://hk852.to/cialis1/ buy cialis] | ||
- | [http://hk852.to/fioricet1/ buy fioricet] | ||
- | [http://hk852.to/valium1/ buy valium] | ||
- | [http://hk852.to/ultram1/ buy ultram] | ||
- | [http://hk852.to/vicodin1/ buy vicodin] | ||
- | [http://hk852.to/meridia1/ buy meridia] | ||
- | [http://hk852.to/soma1/ buy soma] | ||
- | [http://hk852.to/carisoprodol/ buy carisoprodol] | ||
- | [http://hk852.to/tramadol1/ buy tramadol] | ||
- | [http://hk852.to/hydrocodone1/ buy hydrocodone] | ||
- | [http://hk852.to/alprazolam/ buy alprazolam] | ||
- | [http://free-ringtones.ca.tf/ free ringtones] | ||
- | [http://cell-phone-ringtones.ca.tf/ cell phone ringtones] | ||
- | [http://nextel-ringtones.ca.tf/ nextel ringtones] | ||
- | [http://98.to/viagra1/ buy viagra] | ||
- | [http://98.to/phentermine2/ buy phentermine] | ||
- | [http://98.to/ambien1 buy ambien] | ||
- | [http://98.to/adipex2/ buy adipex] | ||
- | [http://98.to/xanax1/ buy xanax] | ||
- | [http://98.to/xenical1/ buy xenical] | ||
- | [http://98.to/cialis1/ buy cialis] | ||
- | [http://98.to/fioricet1/ buy fioricet] | ||
- | [http://98.to/valium1/ buy valium] | ||
- | [http://98.to/tramadol1/ buy tramadol] | ||
- | [http://98.to/carisoprodol1/ buy carisoprodol] | ||
- | [http://98.to/soma1/ buy soma] | ||
- | [http://98.to/ultram1/ buy ultram] | ||
- | [http://98.to/hydrocodone2/ buy hydrocodone] | ||
- | [http://98.to/vicodin1/ buy vicodin] | ||
- | [http://98.to/meridia1/ buy meridia] | ||
- | [http://98.to/alprazolam1/ buy alprazolam] | ||
- | [http://adipex.ca.tf/ adipex] | ||
- | [http://xanax.ca.tf/ xanax] | ||
- | [http://lipitor.ca.tf/ lipitor] | ||
- | [http://buy-viagra.us.tf/ buy viagra] | ||
- | [http://buy-phentermine.us.tf/ buy phentermine] | ||
- | [http://buy-ambien.us.tf/ buy ambien] | ||
- | [http://buy-adipex.us.tf/ buy adipex] | ||
- | [http://buy-xanax.us.tf/ buy xanax] | ||
- | [http://buy-xenical.us.tf/ buy xenical] | ||
- | [http://buy-tramadol.at.tf/ buy tramadol] | ||
- | [http://buy-hydrocodone.at.tf/ buy hydrocodone] | ||
- | [http://buy-carisoprodol.at.tf/ buy carisoprodol] | ||
- | </div> |
Revision as of 23:04, 12 December 2005
You are here: Main Page/DD-WRT Docu (EN)/Telnet/SSH and the Command Line/Iptables command
Contents |
This is an infant page. Clean it up and fill it with content!
I think we should have something about firewall builder on this page, since they're kind of related....
Basic Usage
iptables -[AD] chain rule-specification [options] iptables -[RI] chain rulenum rule-specification [options] iptables -D chain rulenum [options] iptables -[LFZ] [chain] [options] iptables -[NX] chain iptables -E old-chain-name new-chain-name iptables -P chain target [options] iptables -h (print this help information)
Commands
--append -A chain Append to chain --delete -D chain Delete matching rule from chain --delete -D chain rulenum Delete rule rulenum (1 = first) from chain --insert -I chain [rulenum] Insert in chain as rulenum (default 1=first) --replace -R chain rulenum Replace rule rulenum (1 = first) in chain --list -L [chain] List the rules in a chain or all chains --flush -F [chain] Delete all rules in chain or all chains --zero -Z [chain] Zero counters in chain or all chains --new -N chain Create a new user-defined chain --delete-chain -X [chain] Delete a user-defined chain --policy -P chain target Change policy on chain to target --rename-chain -E old-chain new-chain Change chain name, (moving any references)
Options
--proto -p [!] proto protocol: by number or name, eg. `tcp' --source -s [!] address[/mask] source specification --destination -d [!] address[/mask] destination specification --in-interface -i [!] input name[+] network interface name ([+] for wildcard) --jump -j target target for rule (may load target extension) --match -m match extended match (may load extension) --numeric -n numeric output of addresses and ports --out-interface -o [!] output name[+] network interface name ([+] for wildcard) --table -t table table to manipulate (default: `filter') --verbose -v verbose mode --line-numbers print line numbers when listing --exact -x expand numbers (display exact values) --fragment -f match second or further fragments only --modprobe=<command> try to insert modules using this command --set-counters PKTS BYTES set the counter during insert/append --version -V print package version.
Interfaces
When using the -i or -o to define the physical interfaces, remember that by default:
vlan0 is the 4 LAN ports
vlan1 is the WAN port
eth1 is the WIFI
br0 is a bridge connecting the 4 LAN and the WIFI together
Examples
I think examples are the best way to demonstrate the use of iptables.
First I want to view the rules on my INPUT chain, this is the first chain traffic coming into my router will hit.
.# iptables -L INPUT
Then I might want to add a rule so that I can ssh into my router from a specific host/address outside. So I might type the following:
.# iptables -A INPUT -p tcp -s 150.100.whatever.something --dport 22 -j logaccept
So I am saying: Append to the INPUT chain a rule allowing protocol tcp, with a source of <my external IP that i want access from> traffic destined for port 22 on my router, jump to logaccept. I could have used -j ACCEPT which simply jumps to ACCEPT, but in this case I want to log it just to keep track so I use logaccept, which is a chain we have set up for this purpose.
But why doesn't it work?
Now if I type
.# iptables -L INPUT
I see my shiny new rule appended to the INPUT chain which is no good because in my case I have a rule blocking this traffic which occurs BEFORE the rule allowing it.
How do I change it? Simple.
First let's delete the rule we just made
.# iptables -L INPUT --line-numbers
will list the rules with their rule numbers. Let's say our rule is number 11
.# iptables -D INPUT 11
Clearly this Deletes rule number 11 from the input chain.
Now instead of Appending I am going to Insert my rule into the number 1 position.
.# iptables -I INPUT -p tcp -s 150.100.whatever.something --dport 22 -j logaccept
So now rule number 1 is my new rule and the other rules have all shifted down a position.
If I wanted to change the IP address or any other aspect of my ssh rule I could use the -R (Replace) option and simply type in the new rule, ie
.# iptables -R INPUT 1 -p tcp -s 100.100.200.100 --dport 22 -j ACCEPT
This would replace rule number 1 on the INPUT chain with the new rule which has a new source IP address and jumps to ACCEPT instead of logaccept.
One more example: I want to run a mini web server on my router. Let's assume that it is already running on port 8000 and I can access it from the LAN side, but not from the WAN side. With
.# iptables -I INPUT -p tcp -d 192.168.1.1 --dport 8000 -j logaccept
the port 8000 will be opened. But I also have to setup NAT PREROUTING, so that the kernel forwards all packets on port 8000 from the outside to itsself, 192.168.1.1:
.# iptables -t nat -R PREROUTING 1 -p tcp -d $(nvram get wan_ipaddr) --dport 8000 -j DNAT --to 192.168.1.1:8000
But there's a better way to achieve this: just go to the Port Forwarding page http://192.168.1.1/Forward.asp and forward port 8000/TCP to address 192.168.1.1.
External Resources
http://www.iptables.org/documentation/HOWTO//packet-filtering-HOWTO-7.html
http://www.iptables.org/documentation/HOWTO//netfilter-hacking-HOWTO.html
You are here: Main Page/DD-WRT Docu (EN)/Telnet/SSH and the Command Line/Iptables command