All pastes #115679 Raw Edit

Leaf_

public text v1 · immutable
·published 2006-08-04 19:22 UTC
rendered paste body
forward.sh

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables --flush
iptables --delete-chain
iptables --table nat --flush
iptables --table nat --delete-chain
iptables -t nat -A POSTROUTING -o eth0 -s 10.40.56.168/32 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -s 10.40.56.170/32 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -s 10.40.56.175/32 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -s 10.40.56.178/32 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -s 10.40.56.176/32 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -s 10.40.56.177/32 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -s 10.40.56.179/32 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -s 10.40.56.182/32 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -s 10.40.56.183/32 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -s 10.40.56.193/32 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -s 10.40.56.195/32 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -s 10.40.56.81/32 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -s 10.40.56.191/32 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -s 10.40.56.181/32 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -s 10.40.56.18/32 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -s 10.40.56.19/32 -j MASQUERADE

iptables -I FORWARD -p udp -i eth0 -o eth1 -d 10.40.56.19 --dport 500 -j ACCEPT
iptables -t nat -A PREROUTING -d 10.40.56.19 -p udp --destination-port 500 -j DNAT --to-destination 10.40.56.19:500

iptables -t nat -A PREROUTING -d 10.40.56.19 -p 50 -j DNAT --to-destination 10.40.56.19
iptables -I FORWARD -p 50 -i eth0 -o eth1 -d 10.40.56.19 -j ACCEPT

iptables -I FORWARD -p udp -i eth0 -o eth1 -d 10.40.56.19 --dport 1701 -j ACCEPT
iptables -t nat -A PREROUTING -d 10.40.56.19 -p udp --destination-port 1701 -j DNAT --to-destination 10.40.56.19:1701

iptables -I FORWARD -p 51 -i eht0 -o eth1 -d 10.40.56.19 -j ACCEPT
iptables -t nat -A PREROUTING -d 10.40.56.19 -p 51 -j DNAT --to-destination 10.40.56.19

iptables -I FORWARD -p 47 -i eth0 -o eth1 -d 10.40.56.19 -j ACCEPT
iptables -t nat -A PREROUTING -d 10.40.56.19 -p 47 -j DNAT --to-destination 10.40.56.19


----------------------------------------------------------------------------------------------------------------------------
iptables -vnL;iptables -t nat -vnL	


Chain INPUT (policy ACCEPT 1245 packets, 121K bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 110K packets, 100M bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 ACCEPT     47   --  eth0   eth1    0.0.0.0/0            10.40.56.19
    0     0 ACCEPT     ah   --  eht0   eth1    0.0.0.0/0            10.40.56.19
    0     0 ACCEPT     udp  --  eth0   eth1    0.0.0.0/0            10.40.56.19         udp dpt:1701
    0     0 ACCEPT     esp  --  eth0   eth1    0.0.0.0/0            10.40.56.19
    0     0 ACCEPT     udp  --  eth0   eth1    0.0.0.0/0            10.40.56.19         udp dpt:500

Chain OUTPUT (policy ACCEPT 883 packets, 112K bytes)
 pkts bytes target     prot opt in     out     source               destination
Chain PREROUTING (policy ACCEPT 752 packets, 53870 bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 DNAT       udp  --  *      *       0.0.0.0/0            10.40.56.19         udp dpt:500 to:10.40.56.19:500
    0     0 DNAT       esp  --  *      *       0.0.0.0/0            10.40.56.19         to:10.40.56.19
    0     0 DNAT       udp  --  *      *       0.0.0.0/0            10.40.56.19         udp dpt:1701 to:10.40.56.19:1701
    0     0 DNAT       ah   --  *      *       0.0.0.0/0            10.40.56.19         to:10.40.56.19
    0     0 DNAT       47   --  *      *       0.0.0.0/0            10.40.56.19         to:10.40.56.19

Chain POSTROUTING (policy ACCEPT 65 packets, 5988 bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 MASQUERADE  all  --  *      eth0    10.40.56.168         0.0.0.0/0
    0     0 MASQUERADE  all  --  *      eth0    10.40.56.170         0.0.0.0/0
    0     0 MASQUERADE  all  --  *      eth0    10.40.56.175         0.0.0.0/0
    0     0 MASQUERADE  all  --  *      eth0    10.40.56.178         0.0.0.0/0
    0     0 MASQUERADE  all  --  *      eth0    10.40.56.176         0.0.0.0/0
    0     0 MASQUERADE  all  --  *      eth0    10.40.56.177         0.0.0.0/0
    0     0 MASQUERADE  all  --  *      eth0    10.40.56.179         0.0.0.0/0
    0     0 MASQUERADE  all  --  *      eth0    10.40.56.182         0.0.0.0/0
    0     0 MASQUERADE  all  --  *      eth0    10.40.56.183         0.0.0.0/0
    0     0 MASQUERADE  all  --  *      eth0    10.40.56.193         0.0.0.0/0
    0     0 MASQUERADE  all  --  *      eth0    10.40.56.195         0.0.0.0/0
    0     0 MASQUERADE  all  --  *      eth0    10.40.56.81          0.0.0.0/0
    0     0 MASQUERADE  all  --  *      eth0    10.40.56.191         0.0.0.0/0
    0     0 MASQUERADE  all  --  *      eth0    10.40.56.181         0.0.0.0/0
    0     0 MASQUERADE  all  --  *      eth0    10.40.56.18          0.0.0.0/0
    0     0 MASQUERADE  all  --  *      eth0    10.40.56.19          0.0.0.0/0

Chain OUTPUT (policy ACCEPT 8 packets, 516 bytes)
 pkts bytes target     prot opt in     out     source               destination