Connecting two Puppy laptops by eth0 or wlan0 without router

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

Connecting two Puppy laptops by eth0 or wlan0 without router

#1 Post by Karl Godt »

After searching the net and compiling various packages

so I have dnsmasq, brctl, hostapd, iw, iptables and various other tools available ,

I would like the idea to connect two machines without router, since I don't have a router .


Anybody ever succeeded in this using the command line ?


All I find uses network-manager
or ifupdown /etc/network/interfaces
or systemd init start of ubuntu ,
or other unknown to PUPPY GUI tools .


Links or experiences muchly appreciated .

HW:
Machine 1 :

Code: Select all

eth405    Link encap:Ethernet  HWaddr E0:CB:4E:1A:0E:FA  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:0 overruns:0 carrier:4
          collisions:0 txqueuelen:1000 
          RX bytes:1072160 (1.0 MiB)  TX bytes:78 (78.0 B)

wlan90    Link encap:Ethernet  HWaddr 00:25:D3:E5:0C:EE  
          inet addr:169.0.0.1  Bcast:169.0.255.255  Mask:255.255.0.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
with ath9k driver


Machine 2 :
eth0 similar
wlan0 similar with rt2800pci driver

Machine 1 runs a funny udev version that greps IFACE from persistent.rules files and adds one onto each triggering / boot and writes the next number into the .rules file :lol:
Last edited by Karl Godt on Sat 31 May 2014, 21:14, edited 1 time in total.

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#2 Post by Flash »

You use one of those funny orange Ethernet crossover cables, don't you?

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#3 Post by Karl Godt »

I have a normal ethernet cable and wikipedia claims that recent RJ-45 ports would manage things correctly without need for crossover cable .

My HW is from around 2009/2010 but might still use old port interfaces ( to lower production costs ) .

Today is Monday, will look for a crossover cable .

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#4 Post by rcrsn51 »

You can also buy a crossover adapter that plugs into the end of a regular Ethernet cable. Then you can't get confused about which cable is which. :wink:

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#5 Post by Karl Godt »

Funny , that's what I did ( bought an in the middle converter block 2,90€ )
and bought additionally a second normal ethernet cable ( 1m 3,99€ )
for the other side of the converter .


But it turned out , that the ethernet cable I bought long time ago at an 1€ TEDI-Markt store is either damaged inside or the joints at the ends are not fitting well .
My ports don't need a crossover .

The new cable's joints also fit much more tightly .


So I was able to start dhcpd daemon at one machine and dhcpcd client on the other and it received immediately an IP address .

I started dhcpd as

Code: Select all

dhcpd -d -cf /etc/dhcp/dhcpd.conf eth0
with a simple conf file I found on the net :

Code: Select all

#http://www.linuxhelp.net/forums/Setup_Simple_Dhcp_Server_t4052.html
    ddns-update-style interim;
     ignore client-updates;

     subnet 192.168.0.0 netmask 255.255.255.0 {
       option routers                  192.168.0.1; #Default Gateway
       option subnet-mask              255.255.255.0;
       option domain-name              "home.local";
       option domain-name-servers      192.168.0.2;
       option netbios-name-servers     192.168.0.2; #WINS Server
    range dynamic-bootp 192.168.0.51 192.168.0.100;  #DHCP Range to assign
       default-lease-time 43200;
       max-lease-time 86400;
}
and the debug output in the terminal while dhcpcd from the other machine was running is quite satisfying .


But now I need further steps to reach actually the other machine from the another
to wget files or ssh into .

sshd -d
with conf file entries as
ListenAddress 192.168.0.51
ListenAddress 192.168.0.0

seems not to work - I can ssh 192.168.*.* into the current machine but not into the other for example .

"No route to host" or "Network unreachable" is what I'm getting .

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#6 Post by jamesbond »

Karl, if both machines have wireless, they can be configured to talk directly, no router needed. But since you already bought that cable, may as well use it (it's faster over the cable).

Secondly, you don't need dhcp daemon at all. "ifconfig eth0 up" both machines, then "ifconfig eth0 192.168.100.1" for the first one and "ifconfig eth0 192.168.100.2" on the second machine. But since you already get it dhcp going as well, then may as well use it.

Now for actually transferring the files, you can do this:

Code: Select all

cd /path/where/you/want/to/receive
nc -lp 1234 | tar -x
And on the sending side, you do this:

Code: Select all

cd /path/to/send
tar -c file1 file2 path/file3 path2/file* etc-you-get-the-idea | nc receiving-machine's ip 1234
If you want to be more fancy, run ftpd (I have pure-ftpd here in Fatdog, I reckon Puppy uses the same). I think pure-ftpd should be pre-configured on Puppy (you can check that on the menu) but in case it is not, run it like this: "pure-ftpd -EbBADH" on one of the machine and you can use gftp on the other machine to access the files. User/password is root with the usual puppy password.

If you need to control your other machine from your first machine (so you don't have to go back and forth between them), start x11vnc on that machine and access it from vncviewer from your machine (I recall that both of these utilities are standard and is pre-configured within puppy - don't need to bother with other things).

Good luck.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#7 Post by Karl Godt »

Hi James !

I am am using busybox

Code: Select all

udpsvd -vE 192.168.0.0 69 tftpd
on one machine and

Code: Select all

tftp -g -r /usr/abc.txt 192.168.0.0 69
tftp: using blksize 512
using server '192.168.0.0:69', remote_file '/usr/abc.txt', local_file 'abc.txt'
sending 29 bytes
00 01 2f 75 73 72 2f 61 62 63 2e 74 78 74 00 6f 63 74 65 74 00 74 73 69 7a 65 00 30 00
tftp: sendto: Permission denied


and such ... :cry:

So the dhcp server running machine has 192.168.0.0 IP
and the dhcp client received IP from the dhcp server is 192.168.0.51 :

Code: Select all

dhcpcd -d -L eth408
Info, eth408: dhcpcd 3.1.8 starting
Info, eth408: hardware address = e0:cb:4e:1a:0e:fa
Info, eth408: DUID = 00:01:00:01:1b:0b:3a:b2:00:25:d3:e5:0c:ee
Info, eth408: broadcasting for a lease
Debug, eth408: sending DHCP_DISCOVER with xid 0xd7f399f
Debug, eth408: waiting on select for 20 seconds

Debug, eth408: got a packet with xid 0xd7f399f
Info, eth408: offered 192.168.0.51 from 192.168.0.0
Debug, eth408: sending DHCP_REQUEST with xid 0xd7f399f
Debug, eth408: waiting on select for 20 seconds
Debug, eth408: got a packet with xid 0xd7f399f
Info, eth408: checking 192.168.0.51 is available on attached networks
Debug, eth408: sending ARP probe #1
Debug, eth408: sending ARP probe #2
Debug, eth408: sending ARP probe #3
Debug, eth408: sending ARP claim #1
Debug, eth408: sending ARP claim #2
Info, eth408: leased 192.168.0.51 for 43200 seconds
Debug, eth408: renew in 21600 seconds
Debug, eth408: rebind in 37800 seconds
Info, eth408: adding IP address 192.168.0.51/24
Info, eth408: adding default route via 192.168.0.1 metric 0
Debug, eth408: writing /etc/resolv.conf
Debug, eth408: writing /var/lib/dhcpcd/dhcpcd-eth408.info
Debug, eth408: exec "/etc/dhcpcd.sh" "/var/lib/dhcpcd/dhcpcd-eth408.info" "new"
Debug, eth408: forking to background


NO ping or anything other program to connect further .

Will have to look into /etc/resolv.conf .

Of course being online now had to change /etc/resolv.conf :?:
pppd is a *#*!*@* -- sometimes rewrites /etc/resolv.conf and many times not ..

gcmartin

#8 Post by gcmartin »

Hello @Karl Godt. Sorry I'm late to this game, but, I'm in travel status.

There is an obvious question which doesn't seemed to answered here. Do you have a ethernet hub/switch? 5port/8port/16port/???

There is no need for a cross-over when there is one of these. Further as you have already shared, there is no need for a cross-over in most/many modern PC motherboards as they have the technology built-in to detect the presence of device on the other end and if it, too , is modern they will work together without the need for crossover.

If you do not have a router, you can use dnsmasq to be a LAN based DHDP service so that any/all PCs on your LAN can get its IP personality from your PC with dnsmasq.

Otherwise, if you want to manage IP personalities, manually for each and every PC, you can set static IPs for all devices into the same subnet and it will work too.

dnsmasq is by far the easiest and I believe @JamesBond has a write-up somewhere on this package, IIRC.

Here to help

User avatar
Ted Dog
Posts: 3965
Joined: Wed 14 Sep 2005, 02:35
Location: Heart of Texas

#9 Post by Ted Dog »

I would be interested in a peer setup for Fatdog for 3 wifi machines. tried the gui but not able... to setup using peer menu.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#10 Post by Karl Godt »

Do you have a ethernet hub/switch? 5port/8port/16port/???
No.

Have tried to bring /etc/rc.d/rc.firewall stop AND cleanup down but no luck until now .


What I still have know about is what Gateway, Mask, Subnet and others mean ...


Also tried commands like

ip route add *

with no success though it shows in route command output .

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#11 Post by don570 »

Why don't you use samba tng server. If you don't like a GUI , Samaba has
various built-in commands to be used by the terminal program.

For instance I've transferred individual files over an ethernet cable
with a simple command.

BTW only very old machines need a crossover ethernet cable since
ethernet interface was improved to sense the direction of flow and
the switching is done automatically in modern machines.

___________________________________________

gcmartin

#12 Post by gcmartin »

Karl Godt wrote:So the dhcp server running machine has 192.168.0.0 IP
You should probably assign your DHCP server another IP address other than 192.168.0.0. This is one of 2 IP address on the subnet you should NEVER manually assign as the ethernet standard has other uses for both 192.168.0.0 and 192.168.0.255. Choose any other IP address for your server and restart your server.

Good choice on your use of a DHCP server. This will give no change in your future should you acquire a ethernet switch/hub. I have seen 5 port switches as low as $5(ca). Cables can be made or acquired from local friends/shops/TV repair shops or anyone who has the crimping tool to make or fix cables..

Questions
  • which PUP distros are you using for this setup?
  • How is your DHCP server getting to the Internet, today?
  • Will you be using a PCI or USB for WiFi connection to your DHCP server?
Let us know so that we can help you arrive at a good setup for your DHCP to satisfy broadcast from your client PCs in your home LAN.

Here to help
Last edited by gcmartin on Tue 27 May 2014, 01:45, edited 3 times in total.

mcewanw
Posts: 3169
Joined: Thu 16 Aug 2007, 10:48
Contact:

#13 Post by mcewanw »

I've done this often in the past on a couple of old machines using, as others have suggested above, an ethernet crossover cable (since old machines they did need cross over cable). I have never bothered with dhcp in such a simple conifiguration, but instead, as gcmartin suggests, used static ip addresses for the eth card on each end.

As far as I remember Puppy internet connection wizards come with the option to add static ip addresses. If not going out on the Internet you can use a private address like 192.168.0.1 and 192.168.0.2 with netmasks 255.255.255.0

Alternatively, instead of using dhcp to automatically assign ip addresses to your eth cards, you can manually at a console just set up the ip addresses with command:

ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up

(assuming eth0 is your ethernet card)
(If you ever wish to you can bring down the interface with: ifconfig eth0 down)

and similarly on the other machine. If all is well you should be able to ping 192.168.0.2 from the 192.168.0.1 machine. You don't need to enter any gateway address since the machines are directly connected here, so traffic between them doesn't need to be sent to a router (i.e. gateway) first. Some details here:

http://linux-ip.net/html/basic-changing.html

Note that if you have a second ethernet card inside one of the machines, you can also get onto the internet from either machines by configuring NAT and ip-forwarding on the machine with two internet cards (i.e. using it as a router, meaning gateway, onto the Internet), but that would require a few more steps including adding that 'router' address as a gateway onto the Internet by means of the 'route add' command. I gave commands for that here:

http://www.murga-linux.com/puppy/viewto ... 460#135460
It's a while since I used the route add command but I think it would be:

Code: Select all

route add default gw 192.168.0.1 netmask 255.255.255.0
where machine 192.168.0.1 is acting as the default gateway (router) for machine 192.168.0.2 onto the Internet. You would only need to this command to be run on the 192.168.0.2 machine, in this case, to tell it where to send Internet destined traffic.

Having said all the above, no reason why you dhcp couldn't be set up instead of relying on static addresses, I'd think.

William
Last edited by mcewanw on Tue 27 May 2014, 00:16, edited 2 times in total.

gcmartin

#14 Post by gcmartin »

@Karl Godt

@McEwanw is leaning, as I am, to help you do essentially the same thing. You started this thread titled "... without router". So we are offering some suggestions of taking one PC to be setup in the home as a LAN router for other ethernet devices in your home. Routers are essential as they facilitate LAN devices to access the Internet. 2 decades ago we were doing this using dial-up on a single PC.

Help us a little with the answers and we can give you several options for this and expanding it use in your home (one of which he has already given .. there are few others, too).

Here to help
Attachments
PC2PConnect_PC1plus4.jpg
Setup a PC to allow other PCs to get to the INternet
(24.53 KiB) Downloaded 775 times
Last edited by gcmartin on Tue 27 May 2014, 23:37, edited 1 time in total.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#15 Post by technosaurus »

http://forum.xda-developers.com/showthr ... ?t=2009381
has a nice tutorial for setting up an access point.
from there you could use jamesbond's netcat system (or busybox nc)
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#16 Post by Karl Godt »

Today fiddled around with static ip .

Of course console,
since I still am debugging net-setup.sh and wag-profiles.sh .
Mainly because of dhcpcd client does not get a response from some dhcpd server ,
it assigns a confusing 169.x.y.z IPV4LL address when not run with the -L option .

Don't know what IPV4LL is . LocalLow or what ..

http://h4helpersintheworld.blogspot.de/ ... s-via.html
was the only site I had found that described a simple usable connection .

So on the one machine I ran

Code: Select all

ifconfig eth0 192.168.0.1 up 

without the netmask parameter because I was using my limited brain and actually don't
know why netmask is needed when everywhere I see the netmask has 255.255.255.x values .

The second machine was

Code: Select all

ifconfig eth409 192.168.0.9 up
Again without that confusing netmask parameter .
NOTE : used «9» instead of «2» to avoid typos .


2. machine next was

Code: Select all

/sbin/route add -host 192.168.0.1 eth409
1. machine next was

Code: Select all

route add -host 192.168.0.9 eth0
Then I started ftp server on both machines :
2.

Code: Select all

tcpsvd -vE 192.168.0.9 21 ftpd /
1.

Code: Select all

tcpsvd -vE 192.168.0.1 21 ftpd /
And now nothing happened - because the firewall was running.
So on both machines /etc/rc.d/rc.firewall stop .

Now was able to ftpget files .
ftpget has disadvantage to strip the executable bits from files .
But is really fast and lightweight on both sides compared to

Code: Select all

udpsvd -vE 192.168.0.51 69 tftpd /

Code: Select all

tftp -g -r /etc/dhcp/dhcpd.conf 192.168.0.1 69
tftp keeps permissions and has better usage syntax IMO
but is sloooooooooooooooooooooooooooooooooooow.
A lot of debugging messages and no +d option
plus progressbar .
On small files up to 1MB quite well ,
but at a 160 MB puppy.iso the progressbar as telling me it would take three hours !
It transfers only 512 bytes at a time !
ftpget was using the whole 12MB / 100Mbit bandwidth as I could see in xosview .
Since I was using debugging options on the servers,
the shell consumed a lot of CPU .
But I am using sakura terminal emulator and switching to a non-active tab could reduce the CPU usage much .
.

So here is a script I wrote to transfer a bunch of files using ftpget :
It relies on a file called files.lst
produced by

Code: Select all

find "`pwd`" -maxdepth 1 -type f >files.lst
on the server side ,
and this script to run from a controlling terminal on the receiving machine:

Code: Select all

#!/bin/sh

#=============================================================================
PORT=21
IPV4ADDR=192.168.0.9

SLEEP_LOOP=1      #   1.200 files = 20 min
SLEEP_LOOP=0.1    #  12.000 files = 20 min
SLEEP_LOOP=0.01   # 120.000 files = 20 min

#=============================================================================
ME_PROG=`readlink -f "$0"`
ME_DIR=${ME_PROG%/*}
cd "$ME_DIR"

#=============================================================================
_usage()
{
RV=$1
shift
test "$RV" || RV=0

USAGE_MSG="
$0 [ PATH/TO/files.lst ]
--
$*
"

echo "$USAGE_MSG"
exit $RV

}

#=============================================================================
__usage()
{
RV=$1
shift
test "$RV" || RV=0

USAGE_MSG="
$0 [ PATH/TO/files.lst ]
--
$*
"

pidof X && { xmessage -bg red "$USAGE_MSG"; } || {
echo "$USAGE_MSG" >&2
}

exit $RV

}

#=============================================================================
if test ! "$*"; then
tty || __usage 1 "Need controlling terminal."
read -p "Enter /PATH/TO/files.lst file :" FILES_LIST_FILE

elif test "`echo "$*" | grep -iE 'help|\-h'`"; then
_usage 0

else
FILES_LIST_FILE="$*"
fi

#=============================================================================
_exit()
{
RV=$1
shift
test "$RV" || RV=0
echo "$*"
exit $RV
}

#=============================================================================
rm -f files.lst

ftpget -P $PORT $IPV4ADDR files.lst "$FILES_LIST_FILE" || {
_exit 1 "Error get '$FILES_LIST_FILE' -- check firewall, PORT or IPV4ADDR ."
}
sleep 1

#=============================================================================
while read oneLINE
do
test "$oneLINE" || continue

BASE_NAME_oneLINE=${oneLINE##*/}
test "$BASE_NAME_oneLINE" = 'files.lst' && continue
test "$BASE_NAME_oneLINE" = "${FILES_LIST_FILE##*/}" && continue

NEW_PREFIX=${oneLINE//\/usr\/games/}
NEW_PREFIX=${NEW_PREFIX%/*}
test -d "./$NEW_PREFIX" || mkdir -p "./$NEW_PREFIX"

if test -e "./$NEW_PREFIX/$BASE_NAME_oneLINE"; then
continue
#ftpget -c -P $PORT $IPV4ADDR "./$NEW_PREFIX/$BASE_NAME_oneLINE" "$oneLINE"

else
ftpget -P $PORT $IPV4ADDR "./$NEW_PREFIX/$BASE_NAME_oneLINE" "$oneLINE"

fi


sleep $SLEEP_LOOP
done<files.lst

#=============================================================================

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#17 Post by rcrsn51 »

don570 wrote:Why don't you use samba tng server.
I hooked up two machines with an ethernet cable, gave them static IP addresses and started a Samba server on one.

I transferred 200 MB of files between the machines in seconds.

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

Re: Connecting two Puppy laptops by eth0 or wlan0 without router

#18 Post by Geoffrey »

Karl Godt wrote:After searching the net and compiling various packages

so I have dnsmasq, brctl, hostapd, iw, iptables and various other tools available ,

I would like the idea to connect two machines without router, since I don't have a router .


Anybody ever succeeded in this using the command line ?

Maybe lanfile might be of some use Luigi's weird utilities
[b]Carolina:[/b] [url=http://smokey01.com/carolina/pages/recent-repo.html]Recent Repository Additions[/url]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#19 Post by jamesbond »

Karl,
karl wrote: 2. machine next was
Code:
/sbin/route add -host 192.168.0.1 eth409

1. machine next was
Code:
route add -host 192.168.0.9 eth0
is not needed when both machines are in the same network (which they are).
You only need to setup the static IP address which you already did.
IPV4LL is "local-loop" auto-configuration; it means exactly as it sounds - hands out reasonable non-conflicting IP addresses to machines on the same network in absence of a central DHCP server. All the IP addresses will start ato 169.254.x.y.

As for "nc" and "tar", as technosaurus said, they are both in busybox - so you could use them. Between my earlier post and this one, there are a lot of good input, you may want to try them. I think the basic problem is data transfer is a solved one.

Anyway, as it seems that you're exploring possibilities, I'll leave you to yourself :). Do ask for stuff when you are lost, we (still) have many resident experts here who may be able to answer your queries.

Ted Dog,
Ted wrote:I would be interested in a peer setup for Fatdog for 3 wifi machines. tried the gui but not able... to setup using peer menu.
No, you won't find this in the menu. You are a tinkerer, not an ordinary user; thus you won't find what you'd like in the menu/GUI otherwise the number of menu items and setups will overwhelm ordinary users who don't need these obscure options :) (80/20 rule, remember?).
To set this thing, on every machine
a) killall wpa_supplicant conf
b) ifconfig wlan0 up
c) iwconfig wlan0 mode ad-hoc
d) iwconfig wlan0 essid "your-essid" # choose your own
e) iwconfig wlan0 channel 2 # choose your own
f) ifconfig wlan0 192.168.1.x # x=1 for machine 1, x=2 for machine 2, etc etc
Good luck. The connections are not protected at all (others can sniff, spoof), use tinc or gvpe or the like if you want security.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#20 Post by don570 »

A PDF book about Samba explains how to transfer a file

http://oreilly.com/catalog/samba/chapter/book/appd.pdf

________________________________
smbclient put <local file name> [remote file name]

Copy the file called local file name from the machine running the client to the server. If specified, name the remote copy remote file name. Note that all transfers in smbclient are binary.

smbclient get <remote file name> [local file name]

Copy the file called remote file name from the server to the machine running the client. If specified, name the local copy local file name. Note that all transfers in smbclient are binary

Post Reply