Re: Using a CentOS 6 Machine as a gateway/router/home server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]




On 06/28/2015 03:20 PM, Alexander Dalloz wrote:
> Am 28.06.2015 um 20:50 schrieb Max Pyziur:
>
>
> Part of the firewall setup (iptables) is to configure masquerading.
> That's you issue, the missing masquerading of the traffic from the LAN
> hosts through the gateway.
>
>> I'm obviously overlooking some other configuration settings required for
>> machines inside the network being able to connect through the
>> gateway/router.
>>
>> Thanks for any advice in advance

as others have stated, you need to use nating; you won't actually be
routing traffic (unless you've been allocated a routable network.  
which is possible, but pretty unlikely).   the script I use (stolen from
some google search, I'm sure.   I can't give proper attribution if pressed):

iptables --flush            # Flush all the rules in filter and nat tables
iptables --table nat --flush
iptables --delete-chain
# Delete all chains that are not in default filter and nat table
iptables --table nat --delete-chain
# Set up IP FORWARDing and Masquerading
iptables --table nat --append POSTROUTING --out-interface eth2 -j MASQUERADE
iptables --append FORWARD --in-interface eth3 -j ACCEPT
# Enables packet forwarding by kernel
echo 1 > /proc/sys/net/ipv4/ip_forward

in this case eth3 would be your local, non-routed network (e.g. 10.* or
192.168.*) and eth2 would be your regular network interface (like the
one plugged into your cable modem or DSL connection)
it'd likely need to be customized for your environment and running it
would likely destroy any firewall rules you have setup, fair warning.

-- 
public gpg key id: AE60F64C


_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux