LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-08-2003, 06:51 PM   #1
devscripts
LQ Newbie
 
Registered: Apr 2003
Posts: 1

Rep: Reputation: 0
Unhappy IPTables and a failing forwarding


OK here's the setup I've got:

Linux PC (Router)
ppp0 - Connected to Internet (81.86.something)
eth0 - Internal Network (192.169.0.3)

Linux Laptop
eth0 - Internal Network (192.168.0.2)
gateway 192.168.0.3

Windows XP
eth0 - Internal Network (192.168.0.1)
gateway 192.168.0.3

OK I've set up the PC via a hub. All PC's can see, and ping each other.

Linux PC can access web and ping external IP's and resolve domain names.

Linux Laptop and XP can ping internally but not externally.

I've borrowed a rc.firewall script off a mate who has a similar setup and it's working perfectly, but my forwarding isn't working for some reason.

Here's the output when I do iptables -L

Code:
[root@linux etc]# iptables -L
Chain INPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  192.0.0.0/8          anywhere
drop-log   all  --  192.0.0.0/8          anywhere
ICMP_FILTER  icmp --  anywhere             81-86-114-166.dsl.pipex.com
ACCEPT     all  --  anywhere             81-86-114-166.dsl.pipex.comstate RELATED,ESTABLISHED
SERVICES   all  --  anywhere             anywhere
TRUSTED    all  --  anywhere             anywhere
ACCEPT     tcp  --  anywhere             anywhere           tcp spt:bootpc dpt:bootps
ACCEPT     udp  --  anywhere             anywhere           udp spt:bootpc dpt:bootps
drop-log   all  --  anywhere             anywhere

Chain FORWARD (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere           state RELATED,ESTABLISHED
drop-log   all  --  anywhere             anywhere

Chain OUTPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  81-86-114-166.dsl.pipex.com  192.0.0.0/8
ACCEPT     all  --  192.0.0.0/8          192.0.0.0/8
drop-log   all  --  anywhere             192.0.0.0/8
ACCEPT     all  --  81-86-114-166.dsl.pipex.com  anywhere
ACCEPT     tcp  --  192.0.0.0/8          255.255.255.255    tcp spt:bootps dpt:bootpc
ACCEPT     udp  --  192.0.0.0/8          255.255.255.255    udp spt:bootps dpt:bootpc
drop-log   all  --  anywhere             anywhere

Chain ICMP_FILTER (1 references)
target     prot opt source               destination
ACCEPT     icmp --  anywhere             anywhere           icmp echo-request limit: avg 2/sec burst 5
REJECT     icmp --  anywhere             anywhere           icmp echo-request reject-with icmp-port-unreachable
ACCEPT     icmp --  anywhere             anywhere           icmp echo-reply
ACCEPT     icmp --  anywhere             anywhere           icmp destination-unreachable
ACCEPT     icmp --  anywhere             anywhere           icmp time-exceeded

Chain SERVICES (1 references)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere           state NEW tcp dpt:pop3
ACCEPT     tcp  --  anywhere             anywhere           state NEW tcp dpt:pop3s
ACCEPT     tcp  --  anywhere             anywhere           state NEW tcp dpt:imap
ACCEPT     tcp  --  anywhere             anywhere           state NEW tcp dpt:imap3
ACCEPT     tcp  --  anywhere             anywhere           state NEW tcp dpt:imaps
ACCEPT     tcp  --  anywhere             anywhere           state NEW tcp dpt:domain
ACCEPT     tcp  --  anywhere             anywhere           state NEW tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere           state NEW tcp dpt:https
ACCEPT     tcp  --  anywhere             anywhere           state NEW tcp dpt:smtp
ACCEPT     tcp  --  anywhere             anywhere           state NEW tcp dpt:ntp
ACCEPT     udp  --  anywhere             anywhere           udp dpt:pop3
ACCEPT     udp  --  anywhere             anywhere           udp dpt:pop3s
ACCEPT     udp  --  anywhere             anywhere           udp dpt:imap
ACCEPT     udp  --  anywhere             anywhere           udp dpt:imap3
ACCEPT     udp  --  anywhere             anywhere           udp dpt:imaps
ACCEPT     udp  --  anywhere             anywhere           udp dpt:domain
ACCEPT     udp  --  anywhere             anywhere           udp dpt:ntp
REJECT     tcp  --  anywhere             anywhere           tcp dpt:auth reject-with tcp-reset
ACCEPT     udp  --  anywhere             anywhere           udp dpts:1025:65535
ACCEPT     udp  --  anywhere             anywhere           udp dpt:ntp

Chain TRUSTED (1 references)
target     prot opt source               destination
ACCEPT     all  --  192.168.0.0/24       anywhere

Chain drop-log (5 references)
target     prot opt source               destination
DROP       udp  --  anywhere             anywhere           udp dpts:netbios-ns:netbios-dgm
LOG        all  --  anywhere             anywhere           LOG level info
DROP       all  --  anywhere             anywhere
Dunno if that helps, but it might show you guys why it's not working lol

Anyone got any idea's on how I can get my internal network on the internet??

Any idea's gratefully received.

:Pengy:
 
Old 04-08-2003, 09:00 PM   #2
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
Your going to need to setup ip masquerading. There are some how-tos here:
http://www.tldp.org/HOWTO/IP-Masquerade-HOWTO
http://www.netfilter.org

But your going to need to add a couple of lines to iptables.
In the nat table add:
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

In the filter take out that universal forwarding line and add:
iptables -A FORWARD -i ppp0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth0 -o ppp0 -j ACCEPT

Make sure to set the default policies for the postrouting and forward chains like:
iptables -P FORWARD DROP
iptables -P POSTROUTING DROP

Also unless I'm reading you iptables rules wrong, your INPUT chain is wide-open. The first rule listed in INPUT is allowing everything through, which is not recommended. You might want to rework your rules so that you're allowing only the traffic you want.

HTH

Last edited by Capt_Caveman; 04-08-2003 at 09:08 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
IPtables failing to load: unknown ruleset bureado Linux - Software 3 06-19-2008 10:32 PM
IPCHAINS port forwarding and IPTABLES port forwarding ediestajr Linux - Networking 26 01-14-2007 07:35 PM
help with iptables and forwarding laclac01 Linux - Networking 1 10-23-2005 07:16 AM
Iptables Forwarding Help!! jglazner Linux - Networking 2 10-20-2003 05:04 PM
IP forwarding through iptables harshalupatel Linux - Networking 0 06-18-2003 01:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration