Help - Search - Members - Calendar
Full Version: Routing multiple IP addresses (iptables)
Linuxhelp > Support > Technical Support
Termina
Let's assume I have 3 static IP addresses.

I'd like to have 3 IP addresses on one interface (either all on eth0, or split it up using eth0:0, eth0:1, eth0:2, etc.) and then an extra NIC for each static IP, in order to forward it to diffrent computers.

I have something like this so far, not sure if it works. Has anyone done this before, or know of a good place to look?

CODE
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i eth0 -p ICMP -j DROP
iptables -A INPUT -i eth1 -j ACCEPT
iptables -A INPUT -i eth2 -j ACCEPT
iptables -A INPUT -i eth3 -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
iptables -A FORWARD -i eth2 -o eth0 -j ACCEPT
iptables -A FORWARD -i eth3 -o eth0 -j ACCEPT
iptables -A FORWARD -i eth0 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i eth0 -o eth2 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i eth0 -o eth3 -m state --state ESTABLISHED,RELATED -j ACCEPT
#example IPs below
iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source 216.170.248.162
iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source 216.170.248.163
iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source 216.170.248.164
Termina
Bump? smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.