LinuxQuestions.org
Visit Jeremy's Blog.
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-25-2004, 01:02 AM   #1
Pres
Member
 
Registered: Jun 2002
Location: Australia
Distribution: Slack 9.1
Posts: 232

Rep: Reputation: 30
masquerade problem (internet sharing)


The situation is, two boxes, both running slack 9.1. One is called "Frank" and one is called "Iridium". Frank is running 2.4.24 kernel, Iridium is running 2.6.4.

Frank connects to the internet using a dial up modem and I want to access the internet using both machines. They are connected with a crossover cable from eth0 to eth0.

A few details.

Frank :

eth0 Link encap:Ethernet HWaddr 00:C0:26:15:72:CD
inet addr:192.168.1.127 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:9 Base address:0x6400

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:100 (100.0 b) TX bytes:100 (100.0 b)

ppp0 Link encap:Point-to-Point Protocol
inet addr:203.194.10.148 P-t-P:203.194.30.5 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:20656 errors:63 dropped:0 overruns:0 frame:0
TX packets:21052 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:2658661 (2.5 Mb) TX bytes:4229582 (4.0 Mb)

that is a dynamic ip address from my ISP there in ppp0.

Module Size Used by Not tainted
ipt_MASQUERADE 1272 1 (autoclean)
iptable_nat 15928 1 (autoclean) [ipt_MASQUERADE]
ip_conntrack 18120 1 (autoclean) [ipt_MASQUERADE iptable_nat]
iptable_filter 1644 1 (autoclean)
ip_tables 12288 5 [ipt_MASQUERADE iptable_nat iptable_filter]
ppp_async 7552 0 (autoclean)
ppp_generic 15452 0 (autoclean) [ppp_async]
slhc 5040 0 (autoclean) [ppp_generic]
uhci 24496 0 (unused)
usbcore 58400 1 [uhci]
ne2k-pci 5504 1
8390 6000 0 [ne2k-pci]
crc32 2880 0 [8390]
ide-scsi 9424 0

Frank looks good to go. I run this script to get him routing :

#!/bin/sh
#
# /etc/rc.d/rc.local: Local system initialization script.
#
# Put any local setup commands in here:

iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain

iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE
iptables --append FORWARD --in-interface eth0 -j ACCEPT

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

All seems well. No problems, listing iptables shows these entries. The ip_forward is verified as set to 1. Should be good. Over to Iridium :

eth0 Link encap:Ethernet HWaddr 00:E0:4C:E8:22:3C
inet addr:192.168.1.98 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:59 errors:0 dropped:0 overruns:0 frame:0
TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6792 (6.6 Kb) TX bytes:4007 (3.9 Kb)
Interrupt:5 Base address:0xd800

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:100 (100.0 b) TX bytes:100 (100.0 b)

Looks fine. Frank and Iridium can see each other no problem, ftp, ssh, ping. I can get internet through ssh forwarding X even. They talk. I make a gateway entry for Iridium.

root@iridium:~# route add default gw 192.168.1.127

This goes into the routing table. At this point I expect things to work, but, there is no routing. Where did I drop the ball ?
 
Old 04-25-2004, 01:19 AM   #2
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
Looks quite fine.

Those rules should allow you to send packages behind the firewall doing nat. Problem is that packages recieved back are not accepted. Rule
Code:
iptables --append FORWARD --in-interface ppp0 -m state --state ESTABLISHED,RELATED -j ACCEPT
should do it.
 
Old 04-25-2004, 08:51 AM   #3
Pres
Member
 
Registered: Jun 2002
Location: Australia
Distribution: Slack 9.1
Posts: 232

Original Poster
Rep: Reputation: 30
Thanks for the reply ToniT.

Alas, adding this rule did not change the situation (my default policy is accept for all my filter chains ... ). It's a strange one. The first time I did it it seemed to work too, I typed in the bits and pieces and it worked (I may just be losing my grip on reality though). Fine, I say to myself, I'll script this and everything will be great. But no.
 
Old 04-25-2004, 09:27 AM   #4
Pres
Member
 
Registered: Jun 2002
Location: Australia
Distribution: Slack 9.1
Posts: 232

Original Poster
Rep: Reputation: 30
All solved. I had failed to add nameserver entries to /etc/resolv.conf silly me. I was duped into thinking everything was ok the first time because after the setup, I yanked the modem from iridium, my main box, and plugged it into frank, dialled up with frank and it was working - because kppp had entered nameserver info temporarily to my /etc/resolv.conf on iridium from the earlier dial up, which obviously did not happen subsequently. Thanks again ToniT for having a stab.
 
Old 04-27-2004, 09:24 AM   #5
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 22.04
Posts: 2,169

Rep: Reputation: 73
Looks all dastardly linuxy, I've sent it to myself to try out: BUT: it seems to me that dchp is the more elegant solution, as, given I get it working, I can add a pc or laptop, tell it to respond to dchp, and that was it. So my Linux User mag.
So, any tips on dchp?
And I would be interested to know how you see say, Iridium from Frank? Mounted under Iridium, or how do you actually see it. I presume you have a fairly similar set up on both pcs.
Thanks Peter
 
  


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
problem sharing internet... lingeek Fedora 1 09-02-2005 06:42 PM
Internet Sharing : IP Masquerade Xing Linux - Networking 7 08-10-2005 07:14 AM
Internet sharing problem Pirahna Linux - Networking 2 12-06-2004 10:56 AM
Sharing internet problem johnlittlepeap Linux - Networking 1 10-24-2004 12:32 AM
Internet sharing problem matux Linux - Networking 6 07-14-2004 08:06 AM

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

All times are GMT -5. The time now is 12:57 PM.

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