Forwarding and masquerding
Alexey Fadyushin
fab at s-tunnel.com
Fri Jan 28 12:27:37 UTC 2005
Connect your internal network (which is to be masqueraded) to one
interface (for exapmle, eth1) and line to outer network to another
interface (eth0).
To use masquerading, put the following lines into iptables configuration
(/etc/sysconfig/iptables):
Into table nat, chain POSTROUTING put the following string
-A POSTROUTING -s <internal network address space> -j SNAT --to-source
<address of gateway's external interface>
This will do the masquerading. Then allow the forwarding of packets
between internal and external addresses (table 'filter' chain FORWARD):
-A FORWARD -s <internal network address space> -j ACCEPT
Or simply set the default rule of FORWARD chain to ACCEPT.
Then reload iptables rules:
service iptables restart
Then switch on the forwarding in the kernel
echo 1 > /proc/sys/net/ipv4/ip_forward
And put appropriate line into /etc/sysctl.conf so the forwarding will be
switched on after each reboot:
net.ipv4.ip_forward = 1
Also I recommend to switch on the use of iptales helpers for at least
FTP protocol. The list of helpers to be loaded at iptables restart is in
file /etc/sysconfig/iptables-config, parameter IPTABLES_MODULES.
Than you should configure all computers in the internal network to use
you gateway (address of its network card connected to the internal
network) as a default gateway.
Alexey Fadyushin.
Brainbench MVP for Linux.
http://www.brainbench.com
Marcos Osorio wrote:
> Hi, i installed a Red Hat Enterprise Edition 3 and i want to use this
> server as a gateway, so, my quiestion is:
> How can i forward and do masquerading of the others pcs, i have to nics,
> eth0 and eth1, so is there any aplication or script?
> thanks.
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Redhat-install-list mailing list
> Redhat-install-list at redhat.com
> https://www.redhat.com/mailman/listinfo/redhat-install-list
> To Unsubscribe Go To ABOVE URL or send a message to:
> redhat-install-list-request at redhat.com
> Subject: unsubscribe
More information about the Redhat-install-list
mailing list