Skip to contentSkip to conversation

ip masqurade

DISCUSSION Gary Metcalf 2 participants 2 messages Jun 7, 2003 – Jun 8, 2003

lore
Share & tools
lore
#0 lore raw

I'm running Slackware 8.1 with kernel 2.4.18. I'm needing to have some computers on my LAN to gateway to the internet via my Linux Modem. My modem does connect to the internet ok and I can use it via my Linux system. What I don't know and have been reading the How-To's is how to set this thing up. I've un-remarked some lines in my rc.modules file that is supose to allow ipmasqurade when I boot. Now I have learned that I need to build some tables and this is where I get lost.
My Linux IP address is: 192.168.168.1 and one of my computers
(windows) on my lan is: 192.168.168.2
What lines do I need to input for iptables to set this up where it will allow browsing and mail for my windows computer and other computers on my lan which will fall in the ip range of 192.168.168.0/24. I've set up my windows to use Gateway to my linux ip.
Gary

#1 lore raw
Quoted 1 line

computers on my LAN to gateway to the internet via my Linux Modem. My

You use a modem, so I guess you have aa ppp internet interface and a dynamic IP address.
That's why we'll be using MASQUERADE. Otherwise use SNAT.

Quoted 1 line

my lan which will fall in the ip range of 192.168.168.0/24.

# First disable forwarding so that nothing will happen before your rules are set.
echo 0 > /proc/sys/net/ipv4/ip_forward

# Forward packets coming from your LAN to internet, DROP everything else.
# When not specifying a table, the filter table is assumed. iptables -P FORWARD DROP
iptables -A FORWARD -i <if_lan> -o <if_inet> -s 192.168.168.0/24 -j ACCEPT
iptables -t nat -A POSTROUTING -o <if_inet> -s 192.168.168.0/24 -j MASQUERADE

# Enable forwarding.
echo 1 > /proc/sys/net/ipv4/ip_forward

Gr,
Rob