secinfo26
(usa Ubuntu)
Enviado em 15/07/2013 - 10:18h
ta ai amigo:
root@secinfor:/home/secinfor# echo "1" > /proc/sys/net/ipv4/ip_forward
root@secinfor:/home/secinfor# iptables -t nat -A POSTROUTING -o eth1 -s 10.1.240.9/22 -j SNAT --to 192.168.1.1
root@secinfor:/home/secinfor#
root@secinfor:/home/secinfor# iptables -L -nv
Chain INPUT (policy ACCEPT 40931 packets, 19M bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 41851 packets, 23M bytes)
pkts bytes target prot opt in out source destination
root@secinfor:/home/secinfor# iptables -L -nv -t nat
Chain PREROUTING (policy ACCEPT 314 packets, 26353 bytes)
pkts bytes target prot opt in out source destination
Chain INPUT (policy ACCEPT 129 packets, 16208 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 55 packets, 7597 bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 55 packets, 7597 bytes)
pkts bytes target prot opt in out source destination
0 0 SNAT all -- * eth1 10.1.240.0/22 0.0.0.0/0 to:192.168.1.1
root@secinfor:/home/secinfor# iptables -L -nv -t mangle
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
root@secinfor:/home/secinfor# route -n
Tabela de Roteamento IP do Kernel
Destino Roteador MáscaraGen. Opções Métrica Ref Uso Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth1
10.1.240.0 0.0.0.0 255.255.252.0 U 1 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth1
192.168.1.0 0.0.0.0 255.255.255.0 U 1 0 0 eth1
root@secinfor:/home/secinfor#