# IPTABLES?......or.....forwarding just not happening

## Netdale

Ok..........

I can ping server(gentoo) --> client(xp), client --> server.....yet I cannot ping from client --> internet.  I have ip_forward set to 1, and have reviewed numerous HOWTO's.

In the config script I specified 

iptables INPUT ACCEPT

iptables INPUT

iptables OUTPUT ACCEPT

etc, etc, etc.......

yet I still cannot ping the outside network....in this case the internet.

Any suggestions....I've tried masq, yet have decided to keep the script as basic as possible until I see some forwarding.  What is the base requirments of a script for clients to access the outside internet.  

Thanks for all your head in advance....Gentoo rocks...

Dale

----------

## delta407

Is client set up to use server as a gateway?

----------

## delta407

Also, are you doing real routing (i.e. one public block to another) or do you only have one IP? (You can't use ip_forward for that, you need to set up network address translation.)

----------

## sulu

Hi

Forwarding is easy to activate.

#Enable forwarding in kernel

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

#Masquerade from Internal Net to External Net

/sbin/iptables -A POSTROUTING -t nat -o eth0 -j MASQUERADE

Note. you may use another interface to your ISP than etho so replace with the apropriate.

cya

Sulu

----------

## Netdale

Got it working..................thanks to the forums and some rechecking....

dale

----------

## jtmace

dale, i'm sorry to bother, but i have the same prob..  what did you do to fix it..  was it on the client side or the server side??

----------

## hamletmun

gateway would be 192.168.0.1, but DNS server address???

Just check your /etc/resolv.conf to get the numbers,

and put them in your TCP/IP Protocol properties.

----------

## Advocate

Whenever I try the iptables nat thang I get this error message....

bash-2.05a# /sbin/iptables -A POSTROUTING -t nat -o eth1 -j MASQUERADE

modprobe: Can't locate module ip_tables

iptables v1.2.6a: can't initialize iptables table `nat': iptables who? (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

Please help!!!

----------

## xming

check your kernel, you have enable iptables AND NAT in your kernel config, recompile, install and reboot 

xming

----------

## Advocate

I've tried that without success.... I've posted the options in https://forums.gentoo.org/viewtopic.php?t=10469 that thread if you wouldn't mind having a look and telling me which ones I need/don't need

thanks

----------

## xming

turn off

[*] IP: fast network address translation

and somewhere like "fast switching between interfaces"

and turn on 

< > Packet filtering 

Make sure you boot the right kernel (I know this sounds stupid) or try make make iptables support as modules, then you can modprobe/insmod the modules

xming

----------

## Advocate

thanks mate am trying that now...

once I've done that will the gentoo box act as a dhcp server or will I need to assign each pc an ip address?

----------

## Advocate

AT LAST iptables is compiled into the kernel...  :Very Happy:  :Very Happy: 

Now what else do I need to do to use the Gentoo box as a gateway?

----------

## xming

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

/sbin/iptables -A POSTROUTING -t nat -o eth1 -j MASQUERADE

----------

