[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: cable modem and LAN



matt garman wrote:

> I originally thought that using dhcp would be simpler.  Anyway, I went
> ahead and entered 192.168.0.2 as my roommate's IP address and rebooted his
> computer.  But I still can't even ping my linux box (ping 198.168.0.1)
> from my roommate's windows box (the ping times out).

You need to set the default route on each box that will share the
connection so that it points to your internet connected machine. So on
your roommate's computer, you need to do something like this to bring up
the interface:

ifconfig eth0 192.168.0.2 up
route add default gw 192.168.0.1  (points to internet connected machine)

I'm doing the same thing that you want to do except that I only have two
machines - but it's done exactly the same way. Ethan is correct in that
you should not bother trying to run the dhcp server to assign IP
addresses to the other machines - just assign static IP addresses. Then
if your cable modem setup requires dhcp to obtain an IP address, just
install the Debian dhcpcd package which is the dhcp client. So I would
remove the dhcp package. That's the server which you don't need.

To set up the machines completely, you'll want to edit some files on
them to assign hostnames, a network name etc. I'll give you the contents
of my files as examples.

I call my network 'home' which has a network address of 192.168.1.0
I call my internet box 'newdebian' with IP address 192.168.1.1
I call my other box 'olddebian' with IP address 192.168.1.2

So I have newdebian.home and olddebian.home

1) Here's the contents of my files on newdebian.home (connected to
internet)

/etc/hostname:
newdebian

/etc/networks:
localnet 127.0.0.0
home 192.168.1.0

/etc/hosts:
127.0.0.1     localhost
192.168.1.1   newdebian.home  newdebian 
192.168.1.2   olddebian.home  olddebian 

To bring the interface up:
ifconfig eth0 192.168.1.1 netmask 255.255.255.0 up
route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0

Note: route command not needed here with kernel 2.2.XX

2) Here's the other box (olddebian) which shares the internet
connection:

/etc/hostname:
olddebian

/etc/networks:
localnet 127.0.0.0
home 192.168.1.0

/etc/hosts:
127.0.0.1     localhost
192.168.1.1   newdebian.home  newdebian 
192.168.1.2   olddebian.home  olddebian 

To bring the interface up:
ifconfig eth0 192.168.1.2 netmask 255.255.255.0 up
route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0
route add default gw 192.168.1.1  (OR: route add default gw newdebian)

Note: the first route command not needed with kernel 2.2.XX

To bring the network up automatically on boot, you can put the ifconfig
and route commands in /etc/init.d/network. In potato, you can still use
/etc/init.d/network, but the new way to do it is to use
/etc/network/interfaces.

Tom


Reply to: