General Question

linuxgnuru's avatar

How do you use iptables to route using private IP networks?

Asked by linuxgnuru (207points) November 28th, 2010

Ok here’s the situation; I have a private lan (10.0.5.0 network) but I need to do some testing without messing up my lan. I have network B (192.168 network) and on my linux server (DNS, squid, httpd) I added a simple alias network (ifconfig eth0:1 192.168.blah) now, how can I use iptables to route anything coming from eth0:1 to the normal network? Should I use NAT?

Observing members: 0 Composing members: 0

1 Answer

koanhead's avatar

You can use the “ip route” command or the “route” command to accomplish this assuming that the 10.0.5.0 network is attached to a separate interface from the 192.168 interface. The interfaces can be separate but the same device afaik, in other words something like

route add -net 192.168.0.0 netmask 255.255.255.0 gw eth0:1

ought to work.

So, now I’ve googled it, this link:

http://serverfault.com/questions/66571/using-ip-alias-and-route-to-visit-a-site-through-assigned-ip-address

indicates that I’m wrong (maybe) and the route command does not recognize interface aliases but the “ip route” command does. Frankly I prefer the “ip” command anyway, but I used route because it’s more widespread.

Answer this question

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther