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

new to iptables



Hello, I have a network set up at home, using a modem/router and 2 linux 
clients+1 linux server connected to that modem through a switch.

The problem is that I cannot configure my modem to route to different machines 
(ISP related), so I wanted my server to route (using iptables) some traffic 
to my pc and port 23 (telnet) back to the modem (cuz it doesn't accept 
incoming telnet requests). So basicly I want my server to forward certain 
ports to address a and certain ports to address b and respond itself to all 
the rest.

I made a script using this site: 
http://www.siliconvalleyccie.com/iptables-intro.htm

but the test script didn't work. What am i doing wrong ?? Oh yeah, I only have 
one network interface in my server but that shouldn't be a problem or am I 
wrong ??

#!/bin/bash

# NAT module

modprobe iptable_nat

# Turn On Routing

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

# Forwarding:

iptables -t nat -A PREROUTING -p tcp -i eth0 -d 10.0.0.151 --dport 80 --sport 
1024:65535 -j DNAT --to 10.0.0.150:80

# Accept Connections:

iptables -A FORWARD -p tcp -i eth0 -o eth0 -d 10.0.0.150 --dport 80 --sport 
1024:65535 -m state --state NEW -j ACCEPT
iptables -A FORWARD -t filter -i eth0 -m state --state ESTABLISHED,RELATED -j 
ACCEPT



Reply to: