packet forwarding using IPtables
Hi,
I have 2 Ubuntu boxes sitting in the same subnet; server 1 [130.15.6.68] and server 2 [130.15.6.69]
What I am trying to achieve here is the following:
server 1 act as a gateway or proxy to server 2, meaning that server 1 is exposed to the Internet and all traffic to server 2 should go though it (i hope!).
server 2 act as application server and I don't want a direct access to it from the internet. I want all the inbound traffic comes through server 1.
for testing purposes, i will limit the traffic to simple http or port 80
in server 1, i have done the following settings:
iptables -t nat -A PREROUTING -p tcp -i eth0 -d 130.15.6.68 --dport 80 -j DNAT --to 130.15.6.69:80
iptables -A FORWARD -p tcp -i eth0 -d 130.15.6.69 --dport 80 -j ACCEPT
Also,
In server 1, I've edited the value of net.ipv4.ip_forward to equal 1 (uncomment that line in /etc/sysctl.conf)
Currently, both server 1 and server 2 has its own apache2 servers with different index.html files.
the problem is, when i browse to server 1, I am still seeing its index page rather than being forwarded to the index page of server 2.
how can i achieve the traffic forwarding from server 1 to server 2 when my browser pointing to server 1?
So, simply:
Internet -> server 1 (130.15.6.68) -> server 2 (130.15.6.69)
Thank you in advance
|
Recent comments
1 day 14 min ago
1 day 5 hours ago
1 day 9 hours ago
1 day 11 hours ago
2 days 1 hour ago
2 days 1 hour ago
2 days 6 hours ago
2 days 13 hours ago
2 days 14 hours ago
2 days 15 hours ago