Linux system as a router

Linux system as a router

am 07.04.2009 22:13:18 von DAVID.A.KIRKWOOD

How do I set up iptables to make the linux system function as a router?
I think I need to set forwarding between the two interfaces, but I don't
understand the syntax of the command.

Thanks,

David A. Kirkwood


--
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: Linux system as a router

am 07.04.2009 22:33:35 von Uwe Kiewel

Kirkwood, David A. wrote:
> How do I set up iptables to make the linux system function as a router?
> I think I need to set forwarding between the two interfaces, but I don't
> understand the syntax of the command.

echo "1" > /proc/sys/net/ipv4/ip_forward

Maybe you will need masqerading

HTH,
Uwe

--
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: Linux system as a router

am 07.04.2009 22:35:33 von Richard Nairn

If you are doing NATting at the router you need a rule such as
iptables -t nat -I POSTROUTING -o eth0 -j MASQ if you have a dynamic address, or
iptables -t nat -I POSTROUTING -o eth0 -j SNAT --to-source 1.2.3.4 if you have a static address

you also need net.ipv4.ip_forward=1 in /etc/sysctl.conf

Then have your default route go out your WAN interface.

On Tue, 07 Apr 2009 14:13:18 -0600, Kirkwood, David A. wrote:

> How do I set up iptables to make the linux system function as a router?
> I think I need to set forwarding between the two interfaces, but I don't
> understand the syntax of the command.
>
> Thanks,
>
> David A. Kirkwood
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html