WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Working with RasPi-0W and gadgets  (Read 8275 times)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11591
Re: Working with RasPi-0W and gadgets
« Reply #15 on: November 25, 2017, 02:32:51 PM »
Hi kmhill
This is the basic script used by Tinycore to create a static IP:
Code: [Select]
#!/bin/sh
pkill udhcpc
ifconfig eth0 192.168.1.30 netmask 255.255.255.0 broadcast 192.168.1.255 up
route add default gw 192.168.1.1
echo nameserver 68.237.161.12 > /etc/resolv.conf
echo nameserver 71.243.0.12 >> /etc/resolv.conf

Offline kmhill

  • Jr. Member
  • **
  • Posts: 64
Re: Working with RasPi-0W and gadgets
« Reply #16 on: November 25, 2017, 04:10:09 PM »
Thanks Rich for the reference. I saved that as startusb.sh, then changed the reference to eth0 to usb0. In trying to run the code I received:

> sudo sh startusb.sh
route: SIOCADDRT: File exists

So I commented out the call to route. I'm not sure what's supposed to happen at this point that might be different.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: Working with RasPi-0W and gadgets
« Reply #17 on: November 26, 2017, 06:08:16 AM »
You said you gave the raspi the IP address 192.168.4.2. You need to give the host an IP address on the same network, on the host's usb interface, so that they can communicate.
The only barriers that can stop you are the ones you create yourself.

Offline kmhill

  • Jr. Member
  • **
  • Posts: 64
Re: Working with RasPi-0W and gadgets
« Reply #18 on: November 27, 2017, 12:53:53 AM »
Thanks for your note curaga. I think I missed out on how to do that... On the Win7 netbook I did find a setting for the virtual adapter IP address, but despite that the results were the same. I'll try again with another Win7 machine. Not sure how to do that on Ubuntu Linux. Any pointers, please?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11591
Re: Working with RasPi-0W and gadgets
« Reply #19 on: November 27, 2017, 08:29:34 AM »
Hi kmhill
If the machines you are using to communicate with the PI have a 192.168.1.xx IP address then the PI should also have a 192.168.1.xx
IP address.

> sudo sh startusb.sh
route: SIOCADDRT: File exists
That's harmless. It means that routing information already exists.


Offline kmhill

  • Jr. Member
  • **
  • Posts: 64
Re: Working with RasPi-0W and gadgets
« Reply #20 on: November 27, 2017, 06:41:26 PM »
Hi Rich;

Here's a puzzle, I've connected the Pi to a Win7 machine, I've gone into the network and sharing center and assigned the virtual adapter the IP value 192.168.1.20, then when I open a Win7 CLI and try to ping that IP address, ping says the network is not reachable. Then for the status I see that the virtual adapter has an IP address like 169.254.130.13. Ping does respond with the 169.254 address.

I'm at work, the IP address for the Win7 ethernet adapter looks like 137.49.xx.xx, so I don't know where the 169.254 address came from...

Krista


Offline kmhill

  • Jr. Member
  • **
  • Posts: 64
Re: Working with RasPi-0W and gadgets
« Reply #21 on: November 27, 2017, 06:56:33 PM »
Just came across a reference to a Win feature called "Automatic Private IP Addressing," or APIPA... One site says that having a 169.254.x.x IP address, "is almost as good as having no IP address."

Offline kmhill

  • Jr. Member
  • **
  • Posts: 64
Re: Working with RasPi-0W and gadgets
« Reply #22 on: November 27, 2017, 08:31:26 PM »
Just made some sense of Win7 Internet Connection Sharing (ICS). The help page describes it as being similar to IP masquerading, in that one machine called the ICS host provides a connection to the Internet and a second network adapter on the host serves a private network.

In this case the USB host machine serves as the ICS host and the virtual adapter connects to the private network, which is just point-to-point to the RasPi-0W. The help page say that there should not be a DHCP server, which is fine in this case.

I don't fully understand things and I'm a bit suspicious, but so far so good...

Krista

Offline kmhill

  • Jr. Member
  • **
  • Posts: 64
Re: Working with RasPi-0W and gadgets
« Reply #23 on: November 27, 2017, 09:24:12 PM »
Just to add, by the prior comment, "there should not be a DHCP server" I meant to say is that there should not be a DHCP server inside the private network.

Offline kmhill

  • Jr. Member
  • **
  • Posts: 64
Re: Working with RasPi-0W and gadgets
« Reply #24 on: December 03, 2017, 10:07:40 PM »
Hello folks, I'm just checking in.

I'm finding that setting up a connection between Win7 and a RasPi-0W using Internet Connection Sharing is fairly solid. For the USB host I'm using the default IP 192.168.137.1 with netmask 255.255.255.0 and assign a static IP address 192.168.137.2 to the RasPi-0W.

I suspect that having a randomly selected MAC address is causing some issues as the connection with the ethernet LAN and rest of the world is somewhat iffy. When the connection is there, the RasPi-0W can access the TinyCore repository, which is nice. Quite often Win7 makes a new network, I'm not sure what that's about. Two times I noticed that if I unshare the ethernet adapter and then reshare it, the external connection is restored.

Please, any ideas will be appreciated.
Krista