RedHat 7.1 iptables masquerade setup
I've been working for awhile trying to get an older machine I have to share my room's internet connection ( college-provided )
I used a simple set of commands to attempt this ( from yolinux.com ):
echo 1 > /proc/sys/net/ipv4/ip_forward - Enables packet
# Delete and flush. Default table is "filter". Others like "nat" must be explicitly stated.
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 eth0 -j MASQUERADE
iptables --append FORWARD --in-interface eth1 -j ACCEPT
After doing this, I *was* able to ping both internal machines, and they could ping eth1 ( the LAN card on the gateway ), but only the gateway machine could access the internet.
Is there anything I should have in 'netcfg', under the Routing tab?
Any other hints? ( so far I have eth0 set to DHCP, and eth1 set to no protocol, and I have enable routing, but not specified a default gateway )
I eventually want a stronger ruleset, but I need this working first.
Thanks.
|