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

Re: What to change for eth0 (Direct PC connection)



On Wed, Dec 04, 2002 at 08:46:52PM -0800, Shawn Lamson wrote:
> 
> --- Michelle Storm <jade@storms-elite.net> wrote:
> > I want to be able to transfer a LOT of data from my linux box to a
> > friends WinXP box. I have a cross-over cable. I need to know what I
> > have
> > to change on my computer (if anything) so that they can see each
> > other.
> > Even if I just ftp to an IP assigned on his box.
> > 
> > What's the easiest way?
> ifconfig eth0 down
> ifconfig 192.168.0.2 255.255.255.0 eth0 up
> instead of using 192.xxx.etc.??? use whatever would be compatible with
> the XP machine... then you should be able to directly ftp...  you may
> be better up setting up NFS (network filesystem) to transfer a huge
> amount though.

I'm suprised nobody has brought up virtual interfaces (though I don't
know how the 'ip' command sent by Nathan Norman does -- it might be the
same).  You have eth0 as your primary interface.  You can bring up
eth0:n as virtual interfaces (different network configuration
piggybacking on your primary hardware).  This works with any interface.
ppp0 is hooked to your modem, ppp0:0 will put another IP on that
interafce, etc.  This does need to be enabled in the kernel, but I can't
find the option in the 2.4.18 kernel and I don't remember it.  Maybe
it's only optional in older kernels.  

anyway...

Add the following lines to /etc/network/interfaces
iface eth0:0 inet static
        address 192.168.0.34
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.255.255.255

then 
# ifup eth0:0
run ifconfig to verify that it was added.  

before:
orange:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:04:76:6E:A4:A8  
          inet addr:12.0.0.34  Bcast:12.255.255.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:29108 errors:0 dropped:0 overruns:0 frame:0
          TX packets:22170 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:16560524 (15.7 MiB)  TX bytes:1909031 (1.8 MiB)
          Interrupt:11 Base address:0xec00 

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:56 errors:0 dropped:0 overruns:0 frame:0
          TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:2572 (2.5 KiB)  TX bytes:2572 (2.5 KiB)

after:
orange:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:04:76:6E:A4:A8  
          inet addr:12.0.0.34  Bcast:12.255.255.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:29145 errors:0 dropped:0 overruns:0 frame:0
          TX packets:22197 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:16568961 (15.8 MiB)  TX bytes:1912045 (1.8 MiB)
          Interrupt:11 Base address:0xec00 

eth0:0    Link encap:Ethernet  HWaddr 00:04:76:6E:A4:A8  
          inet addr:192.168.0.34  Bcast:192.255.255.255  Mask:255.0.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:11 Base address:0xec00 

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:56 errors:0 dropped:0 overruns:0 frame:0
          TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:2572 (2.5 KiB)  TX bytes:2572 (2.5 KiB)


Add the line "auto eth0:0" before the interface spec in
/etc/network/interfaces to have it automatically come up on boot.  

If you don't want to muck with /etc/network/interfaces, and just want to
load the virtual interface this once, run

ifconfig eth0:0 192.168.0.34 up

This will  bring up the interface, but not save any of the info anywhere
so when you reboot it won't come back.


There is another solution as well, completely separate from the idea of
adding new IPs.

Change your routes so that the other machine's IP is considered local.

lets say that the linux box is 10.1 and the win box is 11.2

route add -host 11.2 eth0

This will have the effect of saying "if you want to send a packet to
11.2, send it directly instead of going to the gateway."

after adding something like this, my routing table looks like:
orange:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.10.20.2      *               255.255.255.255 UH    0      0        0 eth0
12.0.0.0        *               255.255.255.0   U     0      0        0 eth0
10.0.0.0        *               255.0.0.0       U     0      0        0 eth0
0.0.0.0         12.0.0.1        0.0.0.0         UG    0      0        0 eth0


The lines mean:
1) send info destined for 10.10.20.2 directly to it, out eth0
2) send info for 12.0.0.x directly, out eth0
3) send info for 10.x.x.x directly, out eth0
4) send info for anything not yet covered to 12.0.0.1 which will relay it for me
(yes, I'm using 12.x as my local network.  No, this is not a good idea.)


Have fun...

-ben

-- 
Ben Hartshorne     benAThartshorneDOTnet     http://ben.hartshorne.net
PGP keyserver:pgp.dtype.org          Please encrypt all communications

Attachment: pgpAAwjYsnaCN.pgp
Description: PGP signature


Reply to: