здравствуйте, передо мной стоит задача реализовать переброс исходящего http трафика к 1.1.1.1 на 192.168.80.1!
другими словами моя виртуальная машина при со единении к 1.1.1.1 должна получать контент от 192.168.80.1
пробовал реализовать с помощью iptables пока не получается!
iptables -t nat -A PREROUTING -s 1.1.1.1 -p tcp --dport 80 -j DNAT --to-destination 192.168.80.1:8088
root@host:~# iptables-save
# Generated by iptables-save v1.4.14 on Tue Apr 14 14:15:52 2015
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -d 127.0.0.0/8 ! -i lo -j REJECT --reject-with icmp-port-unreachable
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7
-A INPUT -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -j REJECT --reject-with icmp-port-unreachable
-A OUTPUT -j ACCEPT
COMMIT
# Completed on Tue Apr 14 14:15:52 2015
# Generated by iptables-save v1.4.14 on Tue Apr 14 14:15:52 2015
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A PREROUTING -s 1.1.1.1/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.80.1:8088
COMMIT
# Completed on Tue Apr 14 14:15:52 2015
root@host:~# sysctl -a|grep ip_forward
net.ipv4.ip_forward = 1
root@host:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:21:65:12
inet addr:192.168.80.130 Bcast:192.168.80.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe21:6512/64 Scope:Link