# Sharing a modem connection.  :(

## dalek

I built a computer for my mom and was hoping to have DSL when she learned enough to surf the net.  Well, the phone guy has not showed up yet and she wants to surf.

I have two machines, one is smoker and it has the modem, the other is pokey and it is connected by ethernet.  I can do the ping stuff.  No problems there but no internet stuff at all that I can find.

Info about smoker first:

```
root@smoker / # route

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

nosp2.datasync. *               255.255.255.255 UH    0      0        0 ppp0

192.168.0.0     *               255.255.255.0   U     0      0        0 eth0

loopback        localhost       255.0.0.0       UG    0      0        0 lo

default         nosp2.datasync. 0.0.0.0         UG    0      0        0 ppp0

You have new mail in /root/

root@smoker / #
```

```
root@smoker / # ifconfig

eth0      Link encap:Ethernet  HWaddr 00:01:53:81:D5:D3

          inet addr:192.168.0.1  Bcast:192.168.0.25  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:28634 errors:0 dropped:0 overruns:0 frame:0

          TX packets:28492 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:7049772 (6.7 Mb)  TX bytes:1903720 (1.8 Mb)

          Interrupt:11 Base address:0xd000

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:34638 errors:0 dropped:0 overruns:0 frame:0

          TX packets:34638 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:2385736 (2.2 Mb)  TX bytes:2385736 (2.2 Mb)

ppp0      Link encap:Point-to-Point Protocol

          inet addr:209.205.159.33  P-t-P:204.251.0.19  Mask:255.255.255.255

          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1

          RX packets:178 errors:4 dropped:0 overruns:0 frame:0

          TX packets:184 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:3

          RX bytes:125311 (122.3 Kb)  TX bytes:47032 (45.9 Kb)

root@smoker / #     
```

Now for a bit about pokey:

```
pokey root # route

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.0.0     *               255.255.255.0   U     0      0        0 eth0

loopback        localhost       255.0.0.0       UG    0      0        0 lo

default         smoker.net      0.0.0.0         UG    0      0        0 eth0

pokey root #
```

```
pokey root # ifconfig

eth0      Link encap:Ethernet  HWaddr 00:C0:F0:46:DD:7A

          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:28941 errors:0 dropped:0 overruns:0 frame:0

          TX packets:29262 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:1935730 (1.8 Mb)  TX bytes:7181118 (6.8 Mb)

          Interrupt:10

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:248 errors:0 dropped:0 overruns:0 frame:0

          TX packets:248 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:17592 (17.1 Kb)  TX bytes:17592 (17.1 Kb)

pokey root #
```

```
pokey root # cat /etc/hosts

# /etc/hosts:  This file describes a number of hostname-to-address

#              mappings for the TCP/IP subsystem.  It is mostly

#              used at boot time, when no name servers are running.

#              On small systems, this file can be used instead of a

#              "named" name server.  Just add the names, addresses

#              and any aliases to this file...

# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/hosts,v 1.8 2003/08/04 20:12:25 azarah Exp $

#

127.0.0.1       localhost

192.168.0.1     smoker.net

# IPV6 versions of localhost and co

::1 ip6-localhost ip6-loopback

fe00::0 ip6-localnet

ff00::0 ip6-mcastprefix

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

ff02::3 ip6-allhosts

pokey root #
```

I prolly missed something real simple, usually do.  How do I get this to work?  I suspect a route problem myself.

Thanks

 :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy: 

Oh, I can also ssh as root @pokey.net.  <inserted a space so it wouldn't be a linky thing >  I assume the hosts file is OK.

----------

## dalek

Well, any ideas??

BUMP, mostly.

I found some stuff about bridging but I can't find anything on how to "bridge" the thing.

Little help here please.

 :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy: 

----------

## befa

i think that you got a problem on smoker....

i got the same configuration here...and here is what i have :

```
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

193.253.160.3   0.0.0.0         255.255.255.255 UH    0      0        0 ppp0

[b]192.168.100.0   0.0.0.0         255.255.255.0   U     0      0        0 eth1[/b]

192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

0.0.0.0         195.253.160.110   0.0.0.0         UG    0      0        0 ppp0

```

maybe it's not that problem.....

it's an usb modem? or ethernet one?

have active the forwarding?

like 

 [code]

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

if you don't have the 1 that mean that you don't forward inet packet into your local network...

p.s: sorry for my bad english...i try my best! hope you'll understand!  :Wink: 

----------

## dalek

 *befa wrote:*   

> 
> 
> it's an usb modem? or ethernet one?

 

Actually it is a serial dial-up modem.  I don't have broadband yet.    :Crying or Very sad:   :Crying or Very sad:   :Crying or Very sad: 

I assume it would have to "connect" from pokey to smoker then to ppp which goes to the internet.

I can ping all the way around the local part but I can only ping the internet from smoker.

That help any??  Thanks.

 :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy: 

Oh, I just walked up the road.  No telephone trucks yet.    :Crying or Very sad:   :Crying or Very sad: 

----------

## befa

look in the /etc/resolv.conf on pokey

```

nameserver xxx.xxx.xxx.xxx

nameserver xxx..xxx.xxx.xxx

```

you have to put the dns from your provider...

you got some message like host name not found check your dns (or something like that) on your browser?

----------

## dalek

They were there.  I tried that before I started the thread.  

If it helps, when I try to ping say google.com, it just sits there for a while then gives me this:

```
pokey linux # ping google.com

ping: unknown host google.com

pokey linux #
```

I'm in the middle of a compile right now so I can't tell if it tries to go over the network or not.  I'm doing the compile over ssh from smoker.

Any more ideas?  It look like it needs something to point to smoker or something to tell smoker to forward the traffic on to the net.  I'm not sure which though.

Thanks

 :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy: 

hmmmm.  Looks like Arafat is about gone.  It's on the news.  You hear the same thing over there?

----------

## befa

i think it's a routing problem...or an ipforwarding problem....check your route once more....

p.s: in fact, for the death of Arafat, if they don't know where to dig his grave (i dunno if you'll understand...) they consider he's alive...even if he's dead....so i think that he's dead bout 5 days...

----------

## dalek

This is route from pokey:

```
pokey linux # route

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.0.0     *               255.255.255.0   U     0      0        0 eth0

loopback        localhost       255.0.0.0       UG    0      0        0 lo

default         smoker.net      0.0.0.0         UG    0      0        0 eth0

pokey linux #
```

the net file from pokey:

```
iface_eth0="192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0"

gateway="eth0/192.168.0.1"
```

Why does the route show 192.168.0.0 as the gateway?  Should that be a 1 on the end instead of a 0??

I think you are right about Arafat.  I think they are using machines to keep him alive till they can figure out what to do.  Could get messy too.

Thanks for the help.  What you think about that difference though?

 :Very Happy:   :Very Happy:   :Very Happy: 

----------

## befa

[quote="dalek"]This is route from pokey:

pokey linux # route

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.0.0     *               255.255.255.0   U     0      0        0 eth0

loopback        localhost       255.0.0.0       UG    0      0        0 lo

default         smoker.net      0.0.0.0         UG    0      0        0 eth0

pokey linux #

the net file from pokey:

```
iface_eth0="192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0"

gateway="eth0/192.168.0.1"
```

make a 

```
 route del default gw smoker.net
```

replace it by 

```
 route add default gw 192.168.0.1
```

the route i underlined, is not important because it's not a default gateway...

p.s de nada for the help, i'll more happy if that could work!! :Laughing: 

we're agree bout Arafat!  :Wink: 

----------

## dalek

```
pokey linux # route del default gw smoker.net

pokey linux # route add default gw 192.168.0.1

pokey linux # ping google.com

ping: unknown host google.com

pokey linux #

```

 :Crying or Very sad:   :Crying or Very sad:   :Crying or Very sad: 

The smoke got out.  No workey.

edit:

```
pokey linux # route

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.0.0     *               255.255.255.0   U     0      0        0 eth0

loopback        localhost       255.0.0.0       UG    0      0        0 lo

default         smoker.net      0.0.0.0         UG    0      0        0 eth0

pokey linux #
```

Huh?  Looks the same.

Any more ideas?

 :Very Happy:   :Very Happy:   :Very Happy: 

----------

## befa

try that 

```
 ping 216.239.59.104
```

 it's the google's ip!

if it's good, it's a dns problem...

tell us what you have...

----------

## dalek

Looks like the problem is with smoker.  When I do that ping I can see the ping go over the ethernet.  I used ethreal to capture the thing.  It appears that smoker is not passing the traffic on to the ppp thing.

This is route from smoker:

```
root@smoker /usr/src/linux # route

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

nosp2.datasync. *               255.255.255.255 UH    0      0        0 ppp0

192.168.0.0     *               255.255.255.0   U     0      0        0 eth0

loopback        localhost       255.0.0.0       UG    0      0        0 lo

default         nosp2.datasync. 0.0.0.0         UG    0      0        0 ppp0

You have new mail in /root/

root@smoker /usr/src/linux # 
```

I can't help but notice that I don't have a 192.168.0.0 and it shows it above.  That the problem you think???

 :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy: 

----------

## befa

i think i got it!! make 

```
 route dell default gw localhost
```

then check in the route-table if the default gw from localhost has disappeared..

----------

## dalek

On smoker I presume???

 :Very Happy:   :Very Happy:   :Very Happy: 

----------

## befa

yup you presume good!  :Wink: 

----------

## dalek

Well that pissed it off real good.

```
root@smoker /usr/src/linux # route del default gw localhost

SIOCDELRT: No such process

root@smoker /usr/src/linux # 
```

Oh, it is still there.  Isn't that lo.  We really want to delete that?

Still wondering about that 192.168.0.0.  Pokey is 192.168.0.2 and smoker is 192.168.0.1 if that helps any.

Thanks again.  At least we know pokey is accessing the network now.  Just need to beat some sense into smoker.

 :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy: 

----------

## befa

i got the same config as you...here is my route on my gateway

```

Destination     Gateway                 Genmask               Flags Metric Ref    Use Iface

193.253.160.3   0.0.0.0                 255.255.255.255 UH    0      0          0 ppp0

192.168.100.0   0.0.0.0                 255.255.255.0     U       0      0          0 eth1

192.168.0.0       0.0.0.0                 255.255.255.0     U       0      0          0 eth0

0.0.0.0               196.253.160.19   0.0.0.0                 UG     0      0          0 ppp0

```

i got no lo in my route and it works properly....

you have something like a firewall? smoothwall or iptables or something like that?

----------

## dalek

 *befa wrote:*   

> 
> 
> you have something like a firewall? smoothwall or iptables or something like that?

 

Firewall:  nope

Smoothwall:  nope

iptables:  I dunno.  How do i find out?  I think I see that go by when I compile my kernel.  Not sure it is using them though.  If they are there, it is default.  I didn't mess with it.

I did try some different route commands but all it did was lock me out of ssh until I deleted them.  They work again now but no internet.

I'm going to take a nap.  Me sleepy.  I'll work on it some more later.  I wish I had DSL.  I think it would be a lot easier.

Thanks again.

 :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy: 

----------

## befa

have you tried the the first command i give you?

```
 nano -w /proc/sys/net/ipv4/ip_forward
```

if you find a 0 replace it by a 1 !

sleep good ttyl  :Wink: 

----------

## romano

Look at  http://gentoo-wiki.com/HOWTO_Iptables_for_newbies

----------

## befa

oh i don't ask if iptables was running....

----------

## dalek

Where do I put this?:

```
#!/bin/bash

 IPTABLES='/sbin/iptables'

# Set interface values

 EXTIF='ppp0'

 INTIF1='eth1'

 INTIF2='eth2'

# enable ip forwarding in the kernel

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

# flush rules and delete chains

 $IPTABLES -F

 $IPTABLES -X

# enable masquerading to allow LAN internet access

 $IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE

# forward LAN traffic from $INTIF1 to Internet interface $EXTIF

 $IPTABLES -A FORWARD -i $INTIF1 -o $EXTIF -m state --state NEW,ESTABLISHED -j ACCEPT

# forward LAN traffic from $INTIF2 to Internet interface $EXTIF

 $IPTABLES -A FORWARD -i $INTIF2 -o $EXTIF -m state --state NEW,ESTABLISHED -j ACCEPT

 #echo -e "       - Allowing access to the SSH server"

 $IPTABLES -A INPUT --protocol ssh --dport 22 -j ACCEPT

 #echo -e "       - Allowing access to the HTTP server"

 $IPTABLES -A INPUT --protocol tcp --dport 80 -j ACCEPT

# block out all other Internet access on $EXTIF

 $IPTABLES -A INPUT -i $EXTIF -m state --state NEW,INVALID -j DROP

 $IPTABLES -A FORWARD -i $EXTIF -m state --state NEW,INVALID -j DROP

```

I was going to copy it over put don't know where to put it.

I had to take medicine so I'm going back to bed.  Makes me sleepy, and hungry.  Going to raid the fridge first.    :Wink:    Being disabled sucks, big time.

I did also emerge iptables.  It won't start until I put those rules somewhere.  I beginning to wonder if I can share this slow modem connection though.

Thanks.

 :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy: 

----------

## befa

you can cpoy that in a script like /usr/bin/firewall.sh

the to launch it you make 

```
sh /usr/bin/firewall.sh
```

i duno if i understood the post....b/c i'm french... :Laughing: 

----------

## dalek

Well I was looking at this how to:

http://gentoo-wiki.com/HOWTO_Iptables_for_newbies

It has that in it but never said where I was supposed to put it.  I had to reboot smoker.    :Crying or Very sad:    My CPU sensors stop working after a couple days of uptime.  I put them as modules this time so I can unload and reload them.

Still no ping though.  Going to try that script now.  Back later.

 :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy: 

----------

## dalek

It works now.  I can actually get to the net with Mozilla on pokey.

Wooooooo Ooooooooooo

Now I have to teach my mom how to surf the web.  I think she's got the mouse figured out though.  Move mouse forward and the pointer goes up the screen.  That took her a bit though.    :Laughing:   :Laughing:    Not talking about the clicking thing though.    :Embarassed: 

Thanks for the help.

Oh, I couldn't get that script to run so I just copy and pasted the commands in and then saved them with /etc/init.d/iptables save.  That seemed to work.

Thanks again.

 :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy: 

----------

