# share internet with a Slack or Arch linux

## vladimir1986

Well, my problem is this:

I have my laptop, getting internet via wifi in my home, and i have it connected via crossover cable wit a old PIII that has Slack 13.1 installed on it. I use wicd (so dhcpcd) to connect in my wlan0 device (i don't know if this is relevant)

I am thinking on installing Arch on the old computer (no, i DON'T want to compile a full gentoo system with 455 mhz), or in case of saving Slack, at least update some programs i need, without moving physically the computer to a router.

I tried with ifconfig, assigning a static ip on both of them, a mask, and broadcast. I tried the same as it has the laptop (with internet working) too. I tried in the laptop also to assign the same values for eth0 that wlan0, in a hope that would bridge the wifi card with the lan card. No results (at least i can ssh the 2 computers).I don't know what more to do. I searched google, but what i found is how to do it with the connection manager of puppy or ubuntu, but i am not using anything more than my terminals (i want to learn how it works and how to do it!). I am not using iptables, so at least i don't have to create firewall rules.

Anyone can help me? Is not urgent, but i really want to know how it work, and how to do it. Thanks in advance   :Wink: 

----------

## NeddySeagoon

vladimir1986,

There are two ways to do this.  Set up your laptop as a router, follow the Gentoo Home Router Guide

This is written as if you set up a deicated PC as a router but you can add it to your laptop.

This is well documented, just works, and allows you to connect a large number of machines to the internet via your laptop.

The alternative is to use PPP on the link between your laptop and Slack install. Both kernels need PPP support and you need a script to set up PPP on the laptop.   The downsides  are,

a) needing to run the script to get the link up

b) at most one system can be on the end of a PPP link.

I have a script you can build on if you want to go this way.  Its written to do  PPP over USB but it should be easy to change.

----------

## vladimir1986

I would love to try bot ways. The PPP way would work maybe for my first computer (Pentium I, with pcmcia dial-up modem), so if you post the script, that would be really nice. I have custom kernels in both computers, so i have the fearing part in the .configs done. As for day to day, i think i would use the handbook way. Seriously, i am stunned on how many documentation is aviable for Gentoo. Thanks for everything.

----------

## NeddySeagoon

vladimir1986,

Here is the script,

```
#!/bin/bash

#

# ipaqnet       Control script for iPAQ USBNet connection

#

# Author: Michel Stempin

# Creation: 11/08/2002

# additional comments and minor tweaks

# Roy Bamford 6 Dec 2003

PC_ADDR=192.168.100.201

IPAQ_ADDR=192.168.100.202

IPAQ_NET=192.168.100.0/24

# WARNING:usb0 is hard coded in some places

UPLINK_IF=usb0

start() {

    # load the usb networking module

    /sbin/modprobe usbnet

    

    # bring up the PC end of the link with IP addr PC_ADDR

    # exit if it fails for some reason

    /sbin/ifconfig usb0 inet $PC_ADDR up

    if [ $? -ne 0 ]; then

        echo "Could not set up usb0"

        echo "Is the iPaq connected and switched on?"

        exit 1

    fi

 

    # set up proxy_arp for our usb interface 

    echo "1" >/proc/sys/net/ipv4/conf/usb0/proxy_arp

    UPLINK=`/sbin/ifconfig $UPLINK_IF >/dev/null 2>&1`

    # exit if it fails for some reason

    if [ $? -ne 0 ]; then

        echo "Could not set up proxy_arp for usb0"

        exit 1

    fi

 

    # set up proxy_arp for eth0, so this better be our

    # internet connection

    echo "1" >/proc/sys/net/ipv4/conf/eth0/proxy_arp

    # turn on IP forwarding

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

    # delete the unwanted route via usb0

    # its wrong anyway

    /sbin/route del -net $IPAQ_NET dev usb0

    # add the route we really want

    /sbin/route add $IPAQ_ADDR dev usb0

}

stop() {

    /sbin/ifconfig usb0 down

    # rmmod -r usbnet

}

case "$1" in

    start|add)

        start

        ;;

    stop|remove)

        stop

        ;;

    *)

        echo $"Usage: $0 {start|stop|add|remove}"

        exit 1

esac
```

You need to change the 

```
PC_ADDR=192.168.100.201

IPAQ_ADDR=192.168.100.202

IPAQ_NET=192.168.100.0/24
```

lines and the interface name usb0 wherever it occurs.

You can change the usb0 to a var and define it with the others, it looks like that work was started.

This script runs on the system with the internet connection.

----------

## vladimir1986

Hello, and thanks for the reply.

I did all you tell, but have some doubts:

IPAQ_ADDR, IPAQ_NET... are the ip of the guest system?

And what i do on the guest after executing the script on the host?

As far from the handbook... i have to adapt a bit, as they are thinking of two net cards... i have only one, and the wifi card communicating with the router. I assume is not very different.

I cant do anything untill tomorrow anyway, so i will post the results tomorrow.

Thanks!

----------

## NeddySeagoon

vladimir1986,

 *vladimir1986 wrote:*   

> IPAQ_ADDR, IPAQ_NET... are the ip of the guest system? 

 

Yes, thats right.  IPAQ_ADDR must be a static IP in the same subnet as your laptop.  It will get assigned to your slackware box.

IPAQ_NET is the subnet mask.  Thats the same as the subnet mask for your laptop.

After you run the script, your should have an interface on slackware called ppp0, which just works.

The slackware kernel needs to support PPP.

----------

