# IP addresses and NFS.

## chatgris

I am trying to set up a network between two linux machines, and after reading this forum and other documents it appears that NFS is the way to go.

Currently however, I have two machines hooked up through a hub to dhcp cable internet, and I would also like to share two files between these machines at much higher speeds than my cable allows over ftp.

The question I have is with the ip addresses..  I guess my question can be split up as thus.

I know that I need to somehow assign ip addresses to each of these machines..  all the examples I have seen suggest 192.168.0.x.

If assign these ip addresses to my computer will this cause my internet to stop working?  Do I need to take my machines offline to network them together (they only have one network card each) and then put them back online or can I assign them those "Magical" ip addresses above and it will work?

Basically I'm asking for some sort of explanation of ip addresses..  is it safe to use the above ip address is it somehow special for networks?  Do  I need to find out the ip address that I got assigned via dhcp and use that?  do I need to make up something else?

Thanks.

Josh.

----------

## sa

I have a simmilar setup, how does your boxes get their ip addresses now? through dhcp? or did you edit /etc/conf.d/net. either way you can find out your ip address from running `ifconfig` and then putting that address into /etc/hosts mine looks like: (im not using dhcp)

```
127.0.0.1   localhost

11.0.0.1    c8.l   c8

11.0.0.2    j.l     j

11.0.0.3    t.l     t

11.0.0.4    l.l     l
```

and then in /etc/exports it looks like:

```
 /usr/portage/distfiles      l.l(rw,no_root_squash,async) t.l(rw,no_root_squash,async)
```

if you are using dhcp on your boxes it might be trickier, the best way to do this is to configure your router to give you the same ip address every time. Or if thats not possible, just dont run dhcpd on your box but edit /etc/conf.d/net so that it request a address that is in your dhcp address pool. but this way isnt failsafe, because if the requested ip is allready in use then your network wont work...

hopefully this makes sense.

sa

----------

## chatgris

Well, I'm at home and on cable, and my cable company assigns me 2 dhcp address (two to be exact, I have signed up for two ip addresses).

I don't have any control over what ip addresses get assigned to me, nor do I have any idea what my dhcp address pool contains.

Should I just put my dynamically assigned dhcp address in /etc/hosts every time i boot up?

Josh.

----------

## kashani

There is an easier method though it maybe a tad harder to automate.

Each machine boots and get's it's DHCP address. Now we'll want to add secondary IPs to each ether interface.

machine 1:

ifconfig eth0:0 10.13.13.11 netmask 255.255.255.0 broadcast 10.13.13.255

machine 2:

ifconfig eth0:0 10.13.13.12 netmask 255.255.255.0 broadcast 10.13.13.255

Now both machines are local to each other on your internal IP space, they don't need to hit layer 3 for data transfers, IP addresses stay the same, and don't interfere with the DHCP addresses.

I think you can put this into /etc/conf.d/local.start but don't quote me. Obviously you can edit your /etc/hosts file as appropiate. 

kashani

----------

## sa

ahh, i thought you only had one ip address assigned by your isp and were running nat or something...  let us know how kashani's idea works out. Im curious.

----------

## chatgris

I am a little confused at this part..

 *Quote:*   

> Each machine boots and get's it's DHCP address. Now we'll want to add secondary IPs to each ether interface.
> 
> machine 1:
> 
> ifconfig eth0:0 10.13.13.11 netmask 255.255.255.0 broadcast 10.13.13.255
> ...

 

Are you saying that

Machine 1 has a dynamically allocated ip address of 10.13.13.12

Machine 2 has a dynamically allocated ip address of 10.13.13.11

and then I make a new interface eth0:0 which has the other machines ip addresses?

Or are you saying that i should directly use those two ip's you gave me  (10.13.13.11 and 10.13.13.12) NOT the ones that are dynamically allocated?

And also, from what you said I don't really need NFS right?  I can just use ftp transfer at network speeds?

Josh.

----------

## chatgris

does anyone have an idea of what the answer to my last question would be?

Josh.

----------

## kashani

 *chatgris wrote:*   

> 
> 
> Are you saying that
> 
> Machine 1 has a dynamically allocated ip address of 10.13.13.12
> ...

 

The answer to questions in order are:

1. No.

2. No. Let's say your machines gets the following IP's from you broadband provider

machine1    eth0   24.193.213.45

machine2    eth0   24.193.214.96

after dhcp has assigned the machines these IP's, we add the secondary IP to eth0 by creating the virtual interfeace eth0:0.

machine1    eth0:0 10.13.13.11

machine2    eth0:0 10.13.13.12

so a ifconfig would show

eth0 24.193.213.45

eth0:0 10.13.13.11

lo    127.0.0.1

By using the 10 net IP's you avoid

a. routing through layer3

b. dynamically assinged IP addresses... at least for your local network.

c. DNS issues cause you can put both machines in the host file.

3. You can use NFS or any other technology since it has no affect on the networking. The problem was how to keep any such data transfer on layer 2 vs layer 3. By using the secondary IP's which are on the same subnet and statically assigned you do that.

make sense?

kashani

----------

## chatgris

Ahh yes it does make a lot of sense =).

And to keep myself in the second layer, I can use any ip address in the 10.x spectrum..

Thanks a lot for your help!

Josh.

----------

## splooge

 *Quote:*   

> Basically I'm asking for some sort of explanation of ip addresses.. is it safe to use the above ip address is it somehow special for networks? Do I need to find out the ip address that I got assigned via dhcp and use that? do I need to make up something else?

 

Assuming that you know very little about IP (since you're asking..) let me start off with some basics that should help your thought process:

-- You can have more than 1 IP address per ethernet card.

-- The "magical" numbers you're talking about are IP addresses that are reserved for private networks.  These numbers (10.x.x.x, 172.16.x.x, and 192.168.0.x) will *never* *ever* be used on the internet.

Knowing that, let me suggest to you that you take a look at your /etc/init.d/net.eth0 files on both of your PC's.  You'll notice there's an "alias" line in there.  If my understanding of this line is correct, you can add a 2nd ip address to this line and Gentoo will automagically configure it for you the next time you reboot your computer.

What is being suggested to you is the following:

Add an IP address to each machine.  eg: 10.1.1.1 and 10.1.1.2 .  If they're both on the same hub you'll be able to 'ping' these ip addresses without going through your cable modem.

HTH!

Edit: I am a little too late you posted before I did =)

 *Quote:*   

> And to keep myself in the second layer, I can use any ip address in the 10.x spectrum.. 

 

Not to confuse you, but IP addresses are layer 3 on the OSI, MAC addresses are layer 2.  And while a 10.x.x.x network _is_ a class A address, you can only use any number in the spectrum if your subnetmask is 255.0.0.0.  For reference:

Network 10.1.1.0 with subnetmask of 255.0.0.0 = nnn.hhh.hhh.hhh

Network 10.1.1.0 with subnetmask of 255.255.0.0 = nnn.nnn.hhh.hhh

Network 10.1.1.0 with subnetmask of 255.255.255.0 = nnn.nnn.nnn.hhh

(where n=network, h=host)

So to play it safe, even though it's not required, it's easier to remember your ip addresses if you keep the first 3 octets the same.  Might as well have 10.1.1.1 and 10.1.1.2 instead of 10.192.104.231 and 10.92.241.154Last edited by splooge on Mon Dec 02, 2002 1:02 am; edited 1 time in total

----------

## chatgris

Thank you!!!

The first one I knew actually, I was aware of multiple ip's for one network card..

but the reservation of ip's that will never appear on the internet, that was where all my confusion was stemming from...  

Thanks a lot everyone, I will be attempting this at home and will post my results (As requested earlier) probably tomorrow =)

Thanks everyone.

Josh.

----------

## chatgris

IT WORKS!!!  Beautifully..  I used ncftp to connect to 10.13.13.11 From my machine which had eth0:0 of 10.13.13.12 I got 1.03 MB/s transferring a file that was 73kb.

Thanks!!!

----------

## MacMasta

Just use nfs, bucko - 12 megs/sec is a lot more fun that 1 meg/sec.

(Based on 100mbit ethernet)

~Mac~

----------

## chatgris

 *MacMasta wrote:*   

> Just use nfs, bucko - 12 megs/sec is a lot more fun that 1 meg/sec.
> 
> (Based on 100mbit ethernet)
> 
> ~Mac~

 

I only got a 10Mb/s hub.

----------

