jueves, 28 de febrero de 2013

Listar reglas de nat en iptables


Linux: Iptables List and Show All NAT Tables Rules Command

by  on FEBRUARY 27, 2013 · 0 COMMENTS· last updated at FEBRUARY 27, 2013
Iam using /sbin/iptables -L -v -n | more command. However, I am unable to list NAT rules. How do I use iptables to view or list NAT rules stored in NAT tables? How do I see all the rules in NAT tables under CentOS / RHEL based server?
/sbin/iptables command for IPv4 packet filtering and NAT. Network address translation (NAT) imodifyies IP address information in IP packet headers while in transit across a routing device.
Tutorial details
DifficultyEasy (rss)
Root privilegesYes
RequirementsNone
To see NAT rules type:
iptables -t nat -L
iptables -t nat -L -n -v | grep 'something'
iptables -t nat -L -n -v
Sample outputs:
Chain PREROUTING (policy ACCEPT 867 packets, 146K bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 DROP       all  --  vlan2  *       0.0.0.0/0            192.168.1.0/24
Chain POSTROUTING (policy ACCEPT 99 packets, 6875 bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 MASQUERADE  all  --  *      vlan2   0.0.0.0/0            0.0.0.0/0
Chain OUTPUT (policy ACCEPT 99 packets, 6875 bytes)
 pkts bytes target     prot opt in     out     source               destination
Chain WANPREROUTING (0 references)
 pkts bytes target     prot opt in     out     source               destination
root@tswitch:/tmp/home/root#

Say hello netstat-nat

The netstat-nat command display the natted connections on a Linux iptable firewall:
# netstat-nat -n
To display SNAT connections, run:
# netstat-nat -S
To display DNAT connections, type:
# netstat-nat -D

No hay comentarios:

Publicar un comentario