# Make the two computers talk

## kluh

I set up my two gentoo computers on a friend's network.  I had everything going--SAMBA, SSH, everything worked between the two computers.  They were hooked up to a hub, which in turn was hooked up to a router (we had a lot of computers on the network).  Now these two computers are in my house, with no internet connection--no connection to the outside.   How do I make the two computers talk to each other (i.e. SAMBA and SSH) when they are simply hooked up to a hub (no router, no outside connection)?  I know this has probably been brought up before somewhere, but every search I do all I find is how to network computers already hooked up to the outside.  If someone could at least point me to a tutorial or howto, I'd be very thankful.

----------

## puggy

Err, the fact that they are now on a network with no internet connection should have no effect on their operation on the LAN unless you did something very wrong when you set them up.

ssh would just be ssh 192.168.0.5 (or whatever the IP address of the computer your sshing too)

Puggy

----------

## BradN

If the computers were getting DHCP addresses before, you'll have to manually set IP addresses (192.168.0.x netmask 255.255.255.0 is usually good, with x>0) and then either specify IP addresses when needed or set your own hostnames for everything in /etc/hosts.

----------

## r0cket-

 *kluh wrote:*   

> I set up my two gentoo computers on a friend's network.  I had everything going--SAMBA, SSH, everything worked between the two computers.  They were hooked up to a hub, which in turn was hooked up to a router (we had a lot of computers on the network).  Now these two computers are in my house, with no internet connection--no connection to the outside.   How do I make the two computers talk to each other (i.e. SAMBA and SSH) when they are simply hooked up to a hub (no router, no outside connection)?  I know this has probably been brought up before somewhere, but every search I do all I find is how to network computers already hooked up to the outside.  If someone could at least point me to a tutorial or howto, I'd be very thankful.

 

Well, your systems don't need any sort of internet connection in order to share files, but if you were using a router previously, it may have been doing DHCP for you, in which case you probably need to set up static IPs on your network. Please post the output of 'ifconfig -a' when you get a chance.

----------

## splooge

Well you probably had a DHCP server handing out IP addresses on your friends network.  Since you don't on your network, you'll need to give each machine an IP address by editing your /etc/conf.d/net file.

Make one machine's IP address 192.168.0.1 and the other 192.168.0.2.

You should be able to ping each others IP address at that point.  good luck =)

----------

## kluh

That was it.  The router was doing dhcp for me.  Just took out iface_eth0 = dhcp and now I can at least ping one to another.  Thx for your help.  I was stuck and afraid I was gonna get flamed for such a simple question, but you guys offered genuine help.  Gentoo peeps are the best  :Very Happy: 

Samba works and life just got easier.

I guess I only have one more question.  My one computer is slow and is basically just my mp3 server.  It doesn't have a gui.  Simply command line.  It has a modem that I have been able to raise from the dead (it's ISA so I can't stick it in the other computer)  Is there a way to take that modem connection on my slow computer and pipe it to my fast computer with Gnome on it, so I can browse the web graphically (lynx only goes so far   :Smile: 

----------

## r0cket-

 *kluh wrote:*   

> I guess I only have one more question.  My one computer is slow and is basically just my mp3 server.  It doesn't have a gui.  Simply command line.  It has a modem that I have been able to raise from the dead (it's ISA so I can't stick it in the other computer)  Is there a way to take that modem connection on my slow computer and pipe it to my fast computer with Gnome on it, so I can browse the web graphically (lynx only goes so far  

 

You would need to set up routing or briding between the two systems.

----------

## adumare

Basically what you want to do is make your old machine a nat router.  Look up on the internet for how to make a box to nat translation with IPTABLES there's lots of good howtos out there.

----------

## kluh

ok.  I configured my kernel for NAT.  I emerged iptables.  

I typed:

iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

I still can't, for instance open a webpage on the new computer while the old one's dialed up.  I have found some howtos, but I must be doing something wrong.

----------

## r0cket-

 *kluh wrote:*   

> ok.  I configured my kernel for NAT.  I emerged iptables.  
> 
> I typed:
> 
> iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
> ...

 

Well, you'll need to set the default gateway on the new system to point to the IP of the ethernet adapter on the old one, and also plug in the DNS IPs for your connection into it.

----------

## kluh

So, I would just type

```
route add default gw <old computer's IP> eth0
```

on my new computer? Correct?  

And how do I "plug in" my DNS IP's?

Sorry I'm such a noob.

----------

## r0cket-

 *kluh wrote:*   

> So, I would just type
> 
> ```
> route add default gw <old computer's IP> eth0
> ```
> ...

 

There should be something about a default gateway in /etc/conf.d/net and you can put the old system's IP in there. You may need to 'rc-update add net.eth0 default' after that too. I'm kinda new at this myself, don't have too much of it memorized.  :Razz:  Anyway, that puts it into the startup scripts, so you have that route in there on each boot. 

For testing, though, you can do 'route add -net default gw <IP of old computer> netmask 0.0.0.0 metric 1' and make sure everything works before putting anything in /etc/conf.d/net. You may need to delete whatever your current default route is, though, as one was probably set when you initially installed Gentoo.

As far as DNS goes, as long as you have the IPs, you would edit /etc/resolv.conf and add the following lines:

```
nameserver ip.goes.in.here

nameserver ip.goes.in.here

```

And that should give you domain name resolution, provided you have a route to the internet.

----------

## kluh

Thanks.  You've made my day.  I was running back and forth between different computers trying to get my connection working.  Now I can just sit at my new computer and search away.

Now to go back and make my connection a little more secure... hehe  :Twisted Evil: 

----------

## olivierl

 *kluh wrote:*   

> Now to go back and make my connection a little more secure... hehe 

 

read the IP_Masquerading_HOWTO, it's at many location on the net. It's an easy to follow document. Try the simple firewall first and then move to the stronger one.

Basically your old machine will end up loading iptables rules when your ppp link is activated (ip-up file) and unloading these when stopping the connection (ip-down file). 

This should give you a decent setting. "gentoo-security.xml" seems to have another rule set for an even stronger firewall.

Olivier

----------

