Cheatography
https://cheatography.com
All the imported flags & arguments you need to configure your firewall with iptables. Also a small list of common ports & protocols.
This is a draft cheat sheet. It is a work in progress and is not finished yet.
Ports
Protocol |
Description |
Port |
TCP/UDP |
FTP |
File Transfer Protocol |
20,21 |
TCP |
SSH |
Secure Shell |
22 |
TCP |
SMTP |
Simple Mail Transfer Protocol |
25 |
TCP |
HTTP |
Hypertext Transfer Protocol |
80 |
TCP |
DNS |
Domain Name System |
53 |
TCP/UDP |
DHCP |
Dynamic Host Configuration Protocol |
67,68 |
UDP |
OSPF |
Open Shortest Path First |
89 |
IP |
POP3 |
Post Office Protocol version 3 |
110 |
TCP |
NTP |
Network Time Protocol |
123 |
UDP |
IMAP |
Internet Message Access Protocol |
143 |
TCP |
BGP |
Border Gateway Protocol |
179 |
TCP |
IS-IS |
Intermediate System to Intermediate System |
149 |
IP |
SNMP |
Simple Network Management Protocol |
161 |
UDP |
HTTPS |
HTTP Secure |
443 |
TCP |
SMB |
Server Message Block |
445 |
TCP/UDP |
L2TP |
Layer 2 Tunneling Protocol |
1701 |
UDP |
PPTP |
Point-to-Point Tunneling Protocol |
1723 |
TCP |
RTMP |
Real Time Messaging Protocol |
1935 |
UDP |
NFS |
Network File System |
2049 |
TCP/UDP |
RDP |
Remote Desktop Protocol |
3389 |
TCP/UDP |
SIP |
Session Initiation Protocol |
5060 |
UDP/TCP |
IGMP |
Internet Group Management Protocol |
N/A |
IP |
RTP |
Real-time Transport Protocol |
N/A |
UDP |
|
|
Basic Commands
Description |
Description |
Insert |
iptables -I <chain> [rule-number] [selection] |
Replace |
iptables -R <chain> <rule-number> |
Delete |
iptables -D |
Append |
iptables -A |
List |
iptables -L |
Policy (Set policy) |
iptables -P <chain> <policy> |
Zero (Reset Counters in Chain) |
iptables -Z [chain [rule]] |
Flush (Delete all rules in chain) |
iptables -F [chain] |
New (Create user-defined chain) |
iptables -N <chain-name> |
Rename (Rename user-defined chain) |
iptables -R <chain> <new-chain-name> |
Help |
iptables -h |
[Optional Parameter]; <Required Parameter>; "selection" is composed of one or more package selectors
Selectors
Description |
Selector |
Values |
Protocol |
-p <protocol> |
tcp/udp/icmp |
Src Address |
-s <ip4 address[/Mask]> |
Source IP4 Address |
Dest Address |
-d <ip4 address[/Mask]> |
Destination IP4 Address |
Network Interace |
-i <Interface> |
(e.g. eth0, wildcard: +) |
Src Port |
--sport |
Source Port |
Dest |
--dport |
Destination Port |
Goto |
-g <chain> |
Chain name |
Jump |
-j <target> |
ACCEPT, DROP, REJECT |
|