Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 23 Aug 2014, 13:25
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Connecting two Puppy laptops by eth0 or wlan0 without router
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 2 [26 Posts]   Goto page: Previous 1, 2
Author Message
Karl Godt


Joined: 20 Jun 2010
Posts: 3964
Location: Kiel,Germany

PostPosted: Tue 27 May 2014, 18:31    Post subject:  

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/2011/04/how-to-connect-two-linux-machines-via.html
was the only site I had found that described a simple usable connection .

So on the one machine I ran
Code:
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:
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:
/sbin/route add -host 192.168.0.1 eth409

1. machine next was
Code:
route add -host 192.168.0.9 eth0


Then I started ftp server on both machines :
2.
Code:
tcpsvd -vE 192.168.0.9 21 ftpd /

1.
Code:
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:
udpsvd -vE 192.168.0.51 69 tftpd /

Code:
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:
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:
#!/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

#=============================================================================
Back to top
View user's profile Send private message Visit poster's website 
rcrsn51


Joined: 05 Sep 2006
Posts: 9042
Location: Stratford, Ontario

PostPosted: Tue 27 May 2014, 21:40    Post subject:  

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.
Back to top
View user's profile Send private message 
Geoffrey


Joined: 30 May 2010
Posts: 1352
Location: Queensland Australia ɹǝpu∩uʍop

PostPosted: Tue 27 May 2014, 21:51    Post subject: Re: Connecting two Puppy laptops by eth0 or wlan0 without router  

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

_________________
Carolina: Recent Repository Additions
Create strikethrough text HERE
Back to top
View user's profile Send private message 
jamesbond

Joined: 26 Feb 2007
Posts: 2110
Location: The Blue Marble

PostPosted: Thu 29 May 2014, 11:04    Post subject:  

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 Smile. 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 Smile (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, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3255
Location: Ontario

PostPosted: Thu 29 May 2014, 18:19    Post subject:  

A PDF book about Samba explains how to transfer a file

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

________________________________
Quote:

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
Back to top
View user's profile Send private message 
gcmartin

Joined: 14 Oct 2005
Posts: 4220
Location: Earth

PostPosted: Thu 29 May 2014, 18:46    Post subject:  

The BENEFIT @Don570 shows is that the SAMBA server ONLY NEEDS TO BE STARTED ON THE DHCP server OR one of your static IP machines. Assuming you are using PUPs or almost EVERY Linux/MAC/Windows they have built-in (OOTB) stuff (clients) to access shared directories.

@Rcrsn51, @JamesBond, @Don570 are all steering you to the same very simple solution with NO changes required on ANY other PC except the one in the picture, below, marked "DHCP Server".

Simple, clean, no questions, little to no debug, no hassles, changes made on ONLY 1 PC.

_________________
Get ACTIVE Create Circles; Do those good things which benefit people's needs!
We are all related ... Its time to show that we know this!
3 Different Puppy Search Engine or use DogPile
Back to top
View user's profile Send private message 
wyzguy

Joined: 13 Oct 2012
Posts: 11

PostPosted: Thu 29 May 2014, 19:18    Post subject:  

Can you show the output from each computer for the device in question.

lspci -nnvv | egrep -i "^0|kernel"
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3964
Location: Kiel,Germany

PostPosted: Sat 31 May 2014, 14:53    Post subject:  

jamesbond wrote:
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 ordering of the code seems a little wrong :
Code:
 #!/bin/sh

essid=`dmidecode -t1 | grep -iE 'Manufacturer|Product Name' | awk -F':' '{print $2}'`
essid=`echo $essid`
echo "essid='$essid'"
test "$essid" || essid="localhost-ran-$RANDOM"

ifconfig wlan0 down
iwconfig wlan0 mode ad-hoc
#http://murga-linux.com/puppy/viewtopic.php?p=780052#780052
echo a
pidof wpa_supplicant && killall wpa_supplicant #conf

echo b
ifconfig wlan0 up
echo c
iwconfig wlan0 mode ad-hoc
#c
#Error for wireless request "Set Mode" (8B06) :
#    SET failed on device wlan0 ; Device or resource busy.
#d
echo d
iwconfig wlan0 essid "$essid" # choose your own
echo e
iwconfig wlan0 channel 2          # choose your own
echo f
#ifconfig wlan0 192.168.1.x        # x=1 for machine 1, x=2 for machine 2, etc etc
ifconfig wlan0 192.168.1.1


gives me
Code:
ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 00:C1:13:41:1C:55 
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::2c1:13ff:fe41:1c55/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:162 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:21735 (21.2 KiB)

iwconfig wlan0
wlan0     IEEE 802.11bgn  ESSID:"GREATWALL U310" 
          Mode:Ad-Hoc  Frequency:2.417 GHz  Cell: AA:1C:67:BC:B9:B3   
          Tx-Power=0 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off


iwlist scan finds both machines :
Itself :
Code:
          Cell 03 - Address: AA:1C:67:BC:B9:B3
                    Channel:2
                    Frequency:2.417 GHz (Channel 2)
                    Quality=70/70  Signal level=0 dBm 
                    Encryption key:off
                    ESSID:"GREATWALL U310"
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              9 Mb/s; 12 Mb/s; 18 Mb/s
                    Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                    Mode:Ad-Hoc
                    Extra:tsf=0000000000000000
                    Extra: Last beacon: 1078014ms ago
                    IE: Unknown: 000E475245415457414C4C2055333130
                    IE: Unknown: 010882040B160C121824
                    IE: Unknown: 030102
                    IE: Unknown: 06020000
                    IE: Unknown: 32043048606C
                    IE: Unknown: DD070050F20200010

The notebook :
Code:
          Cell 06 - Address: 0C:47:3D:1E:4C:0C
                    Channel:3
                    Frequency:2.422 GHz (Channel 3)
                    Quality=70/70  Signal level=-35 dBm 
                    Encryption key:off
                    ESSID:"ASUSTeK Computer INC. 1005HAG"
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              9 Mb/s; 12 Mb/s; 18 Mb/s
                    Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                    Mode:Ad-Hoc
                    Extra:tsf=00000163d69a5b94
                    Extra: Last beacon: 988ms ago
                    IE: Unknown: 001D4153555354654B20436F6D707574657220494E432E2031303035484147
                    IE: Unknown: 010882040B160C121824
                    IE: Unknown: 030103
                    IE: Unknown: 06020000
                    IE: Unknown: 32043048606C
                    IE: Unknown: DD070050F202000100


No Luck until now : ping does not work on / from both machines .
Back to top
View user's profile Send private message Visit poster's website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3964
Location: Kiel,Germany

PostPosted: Sat 31 May 2014, 15:05    Post subject:  

wyzguy wrote:
Can you show the output from each computer for the device in question.
lspci -nnvv | egrep -i "^0|kernel"

The one machine
http://www.gadgets-reviews.com/great-wall-computer-keyboard.html
with 4GB RAM and 500GB HDD has
if that helps :
Code:
elspci -l
02:00.0 028000 1814:5390 <rt2800pci>
01:00.0 020000 10EC:8136 <r8169>
lspci -nm
01:00.0 "Class 0200" "10ec" "8136" -r02 "8136" "0123"
02:00.0 "Class 0280" "1814" "5390" "5390" "5390"
lspci -m
01:00.0 "Ethernet controller" "Realtek Semiconductor Co., Ltd." "RTL8101E/RTL8102E PCI Express Fast Ethernet controller" -r02 "Realtek Semiconductor Co., Ltd." "0123"
02:00.0 "Network controller" "Ralink corp." "RT5390 Wireless 802.11n 1T/1R PCIe" "Ralink corp." "RT5390 Wireless 802.11n 1T/1R PCIe"
lspci -nnvv
01:00.0 Class 0200: 10ec:8136 (rev 02)
02:00.0 Class 0280: 1814:5390

Ethernet on bus 01:00.0 is OK .
Back to top
View user's profile Send private message Visit poster's website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3964
Location: Kiel,Germany

PostPosted: Sat 31 May 2014, 17:11    Post subject:  SOLVED CELL ID must be the same  

Here found the answer :
http://superuser.com/questions/576661/how-to-join-an-ad-hoc-wireless-network-in-linux
Quote:
you use iwconfig correctly, as you said the problem is that they don't get the same cell ID. On ad-hoc mode, MAC address is assigned as cell ID. You can force wifi devide to use a predefined cell ID by executing sudo iwconfig eth1 ap B6:D6:92:5D:E5:E4 ( e.g., after sudo iwconfig eth1 essid 'my wlan').

Code:
#!/bin/sh

essid=`dmidecode -t1 | grep -iE 'Manufacturer|Product Name' | awk -F':' '{print $2}'`
essid=`echo $essid`
echo "essid='$essid'"

test "$essid" || essid="localhost-ran-$RANDOM"

pidof wpa_supplicant && killall wpa_supplicant #conf

ifconfig wlan0 down
iwconfig wlan0 mode ad-hoc
iwconfig wlan0 ap FF:FF:01:01:F1:F1     #must be the same on both machines

#http://murga-linux.com/puppy/viewtopic.php?p=780052#780052
iwconfig wlan0 essid "$essid" # choose your own
iwconfig wlan0 channel 2          # choose your own

#ifconfig wlan0 192.168.1.x        # x=1 for machine 1, x=2 for machine 2, etc etc
ifconfig wlan0 192.168.2.1 up

iwconfig wlan0
ifconfig wlan0
echo
ifconfig


bash-3.2# ftpget 192.168.2.2 wlan_testfile /root/.xinitrc
bash-3.2# ls
abc dir With SPACE new_file new_file3 wlan_testfile
caller.sh iwlist-HOME-GW310-2014-05-31.txt new_file2 new_file4
Back to top
View user's profile Send private message Visit poster's website 
jamesbond

Joined: 26 Feb 2007
Posts: 2110
Location: The Blue Marble

PostPosted: Sun 01 Jun 2014, 00:35    Post subject:  

Karl Godt wrote:
The ordering of the code seems a little wrong :

Haha, yeah. It worked on my machines, both of them (very different machines), but apparently the official way to do that is you down wlan0 first, set mode, then up it again before setting essid and channel/freq.

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 2 [26 Posts]   Goto page: Previous 1, 2
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1281s ][ Queries: 12 (0.0042s) ][ GZIP on ]