GAP
Posts: 118
Joined: Thu Apr 12, 2018 9:18 am
Location: New South Wales Australia

(Solved) Share HDD with windows and Pi - See summary on Page 4

Fri Jun 22, 2018 6:19 am

Sorry if this has been asked before, I searched the net and could not find anything (more than likely I searched the wrong thing).

Is there a way for me to used an external HHD and have it accessible with both my Pi and a Win machine?

What I would like to do is store all my programs on the 1 HDD and open them from both machines ( I have programs that will only run on Win) without unplugging the HDD.
Last edited by GAP on Mon Aug 20, 2018 12:03 am, edited 3 times in total.

User avatar
topguy
Posts: 4864
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Share HDD with windows and Pi

Fri Jun 22, 2018 10:56 am

Possible yes.

But I am not clear which machine the HDD will be connected to, the Pi, the Windows machine or sometimes moved between them ?

I any case its about installing and setting up Samba ( aka: CIFS ) on the Pi.
- Either as a server for sharing the HDD to the Windows machine.
- Or as a client, getting access to the shared folder on the Windows machine.

User avatar
Z80 Refugee
Posts: 358
Joined: Sun Feb 09, 2014 1:53 pm

Re: Share HDD with windows and Pi

Fri Jun 22, 2018 1:25 pm

The easiest way would be to have a separate NAS connected to your network. Windows could access it as network-connected storage straight away, and I have no doubt the RPi could be configured to do the same. That way, access would only be reliant on the NAS being turned on, whereas a network share from either Windows or the RPi means both machines being turned on.

I suspect, however, that the OP wants a drive which connects to both machines simultaneously by USB - that is not possible.
Military and Automotive Electronics Design Engineer (retired)

For the best service: make your thread title properly descriptive, and put all relevant details in the first post (including links - don't make us search)!

fruitoftheloom
Posts: 17487
Joined: Tue Mar 25, 2014 12:40 pm

Re: Share HDD with windows and Pi

Fri Jun 22, 2018 3:21 pm

topguy wrote:
Fri Jun 22, 2018 10:56 am
Possible yes.

But I am not clear which machine the HDD will be connected to, the Pi, the Windows machine or sometimes moved between them ?

I any case its about installing and setting up Samba ( aka: CIFS ) on the Pi.
- Either as a server for sharing the HDD to the Windows machine.
- Or as a client, getting access to the shared folder on the Windows machine.

Something like this should suffice:

https://www.bhphotovideo.com/c/product/ ... ral_2.html
Adieu

User avatar
Z80 Refugee
Posts: 358
Joined: Sun Feb 09, 2014 1:53 pm

Re: Share HDD with windows and Pi

Fri Jun 22, 2018 5:59 pm

The above is the equivalent of swapping the drive between computers, without the plugging and unplugging. It will not allow both computers to be connected and access the HDD simultaneously (yes, I know not even a NAS allows literally simultaneous access), but if that's all you need...
Military and Automotive Electronics Design Engineer (retired)

For the best service: make your thread title properly descriptive, and put all relevant details in the first post (including links - don't make us search)!

ejolson
Posts: 1899
Joined: Tue Mar 18, 2014 11:47 am

Re: Share HDD with windows and Pi

Fri Jun 22, 2018 7:56 pm

GAP wrote:
Fri Jun 22, 2018 6:19 am
Is there a way for me to used an external HHD and have it accessible with both my Pi and a Win machine?
There are two obvious approaches:

1. Connect the drive to your PC and share it over the local network to the Pi.

2. Connect the drive to your Pi and share it over the local network to the PC.

Option 1 will be faster but requires the PC to be turned on when accessing the drive from the Pi and consequently will consume more electricity. Option 2 will consume less electricity but PC access to the drive will be much slower. In either case, the software used to share the drive over the network would be CIFS and Samba.

n67
Posts: 803
Joined: Mon Oct 30, 2017 4:55 pm

Re: Share HDD with windows and Pi

Fri Jun 22, 2018 8:02 pm

Why do you say that X will be faster than Y, for fixed values of X and Y.

ITYM:

1) If you connect it directly to X and share it to Y, then accessing the drive from X will be faster than accessing it from Y.

2) If you connect it directly to Y and share it to X, then accessing the drive from Y will be faster than accessing it from X.
"L'enfer, c'est les autres"

If a post offends you, just put that poster on your foes list, and be done with it (and with them).

To do otherwise, risks being banned.

User avatar
topguy
Posts: 4864
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Share HDD with windows and Pi

Fri Jun 22, 2018 8:16 pm

On a Raspberry Pi the ethernet port is also connected to the USB bus so both reading from the HDD and sending the data over ethernet will be slowed down a bit when you try to do both at the same time.

If you share from the PC, it will not have this problem and the Pi will only need to use the ethernet for reading the file so this is the solution that should give you on average the fastest file access.

User avatar
thagrol
Posts: 858
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Share HDD with windows and Pi

Fri Jun 22, 2018 8:28 pm

fruitoftheloom wrote:
Fri Jun 22, 2018 3:21 pm
topguy wrote:
Fri Jun 22, 2018 10:56 am
Possible yes.

But I am not clear which machine the HDD will be connected to, the Pi, the Windows machine or sometimes moved between them ?

I any case its about installing and setting up Samba ( aka: CIFS ) on the Pi.
- Either as a server for sharing the HDD to the Windows machine.
- Or as a client, getting access to the shared folder on the Windows machine.

Something like this should suffice:

https://www.bhphotovideo.com/c/product/ ... ral_2.html
Depends on which machine formatted the HDD and which file system it's using. Don't expect windows to cope with ext* or linux to cope fully with exFAT or NTFS without additional drivers.

Edit: And you'd need to be sure that machine A has flushed it's cache before switching to machine B or you're asking for corruption.
Note to self: don't feed the trolls
If you believe "L'enfer, c'est les autres" (Hell is other people) have you considered that it may be of your own making?

GAP
Posts: 118
Joined: Thu Apr 12, 2018 9:18 am
Location: New South Wales Australia

Re: Share HDD with windows and Pi

Fri Jun 22, 2018 11:33 pm

topguy wrote:
Fri Jun 22, 2018 10:56 am
Possible yes.

But I am not clear which machine the HDD will be connected to, the Pi, the Windows machine or sometimes moved between them ?

I any case its about installing and setting up Samba ( aka: CIFS ) on the Pi.
- Either as a server for sharing the HDD to the Windows machine.
- Or as a client, getting access to the shared folder on the Windows machine.
Perhaps I should have provided more information about what I would like to do.

At present I have 2 HDD, one is connected to the Pi and the other to the Win machine.
I am using my Pi 3B+ as a desktop and it is connected to the net
The Win machine is running XP and is not upgradable because of its age.

What I would like to do is easily transfer information between both machines from one HDD instead of having to transfer the information via USB stick and having duplicate files.
For example I use the Win machine to program PICAXE microcontrollers but access the forum via the PI, if I have a question for the forum and have to put a sample of the program on the forum, I have to take it off the Win machine and transfer it to the PI either via USB stick or unplugging the HDD and plugging it into the pi so that I can then load it to the forum. I now have 3 copies of the program ( 1 on Win 1on Pi 1 on stick) and if I forget to delete the duplicates or delete the wrong one (which has happened) I can get into trouble.

My thinking is if both machines can access the same HDD the all I have to do is open the PICAXE file (a basic text file) and copy it for pasting on the forum.
There are other examples but I will not bore you people with them.

ejolson
Posts: 1899
Joined: Tue Mar 18, 2014 11:47 am

Re: Share HDD with windows and Pi

Sat Jun 23, 2018 1:03 am

GAP wrote:
Fri Jun 22, 2018 11:33 pm
The Win machine is running XP and is not upgradable because of its age.
Sounds like your PC is airgapped and you don't want to connect it to the internet. Is the Pi connected to the internet through WiFi or wired networking?

LTolledo
Posts: 637
Joined: Sat Mar 17, 2018 7:29 am

Re: Share HDD with windows and Pi

Sat Jun 23, 2018 1:17 am

Assuming the Windows PC and RPi 3B+ are connected to a home network with internet access, seems like you need a simple NAS solution for your problem

PICAXE data are stored in the NAS.
Windows XP access the PICAXE data from NAS, edit and save to NAS.
RPi access PICAXE data from NAS.

Either you get a commercial NAS solution or a DIY one.

Just for reference, the DIY NAS solution I've used and still using:
1. RPi B+ (yeah its old but I need to give it a task) and an old 250GB 3.5" HDD in powered enclosure. Headless configuration, installed Stretch and samba server.
2. Another SBC and 1TB 2.5"HDD. Headless configuration, installed Open Media Vault on that SBC.

The 2 systems above are used for and accessed by Kodi and Arduino IDE.

If windows pc is not connected to the home network then the solution provided by fruitoftheloom is the next best thing, as I have used a device with similar function before.
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

GAP
Posts: 118
Joined: Thu Apr 12, 2018 9:18 am
Location: New South Wales Australia

Re: Share HDD with windows and Pi

Sat Jun 23, 2018 1:35 am

LTolledo wrote:
Sat Jun 23, 2018 1:17 am
Assuming the Windows PC and RPi 3B+ are connected to a home network with internet access, seems like you need a simple NAS solution for your problem

PICAXE data are stored in the NAS.
Windows XP access the PICAXE data from NAS, edit and save to NAS.
RPi access PICAXE data from NAS.


Either you get a commercial NAS solution or a DIY one.

Just for reference, the DIY NAS solution I've used and still using:
1. RPi B+ (yeah its old but I need to give it a task) and an old 250GB 3.5" HDD in powered enclosure. Headless configuration, installed Stretch and samba server.
2. Another SBC and 1TB 2.5"HDD. Headless configuration, installed Open Media Vault on that SBC.

The 2 systems above are used for and accessed by Kodi and Arduino IDE.

If windows pc is not connected to the home network then the solution provided by fruitoftheloom is the next best thing, as I have used a device with similar function before.
Thanks,
In bold above is what I want to do, plus other data as well eg Open Office documents.

Tons of info more questions raised.
SBC = Single Board Computer ie Pi?
Headless Configuration = no mouse keyboard etc?

If I connect the Win and Pi together with an Ethernet cable is that a network?
If it is a network can I just access the HDD or do I need another Pi (SBC with headless config?) in between the 2 machines to run the HDD? The HDD is a USB external powered currently plugged into the Pi.
Can I store both windows and Linux programs on the HDD (its formatted as NTFS)?

LTolledo
Posts: 637
Joined: Sat Mar 17, 2018 7:29 am

Re: Share HDD with windows and Pi

Sat Jun 23, 2018 2:39 am

GAP wrote:
Sat Jun 23, 2018 1:35 am

SBC = Single Board Computer ie Pi?
Headless Configuration = no mouse keyboard etc?
Yes, SBC means Single Board Computers. RPi is one of those. Am using Nanopi Neo512 as my other SBC for NAS.
Headless configuration: no display monitor, mouse and keyboard. the SBC is accessed/configured over the network via SSH.
GAP wrote: If I connect the Win and Pi together with an Ethernet cable is that a network?
I doubt plugging one end of the ethernet cable to the windows PC and the other end of that same cable to the RPi will make it a network. I could be wrong though because I have not tried it yet

My simple network configuration is:
A Wifi Router (configured as DHCP server) connected to the internet,
Windows PC connected to WiFi router via ethernet cable
RPi connected to the WiFi router via ethernet cable
Nanopi Neo NAS (where the external HDD is connected) is connected to the WiFi router via ethernet cable.

Check out the guides in this forum or the internet on how to set up a simple home network...

In your case I would suggest:
A Wifi Router (configured as DHCP server) connected to the internet,
Windows PC connected to WiFi router via ethernet cable or Wifi
RPi (where the external HDD is connected) is connected to the WiFi router via ethernet cable (you can use Wifi connection if you dont mind the slow file transfer speeds over WiFi)
In the RPi, you must install samba server so you can share the contents of the USB connected HDD to the network so that windows can access it.

Check out the guides in this forum or the internet on how to setup samba shares on RPi

In the NTFS formatted HDD use the share folder to store data, that can be accessed by both the RPi and Windows. Just in case (if ever) you want to plug the external HDD back to windows, windows can still access the contents of the HDD because it is in NTFS format. Windows cannot read EXT4 formatted HDDs unless you install additional drivers.
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

ejolson
Posts: 1899
Joined: Tue Mar 18, 2014 11:47 am

Re: Share HDD with windows and Pi

Sat Jun 23, 2018 4:12 am

LTolledo wrote:
Sat Jun 23, 2018 2:39 am
GAP wrote:If I connect the Win and Pi together with an Ethernet cable is that a network?
I doubt plugging one end of the ethernet cable to the windows PC and the other end of that same cable to the RPi will make it a network. I could be wrong though because I have not tried it yet
Running a network cable directly from the PC to the Pi works fine, is what I'm doing and allows you to keep the Windows XP machine off the Internet.

Any network cable will work. In the distant past a crossover cable was needed, but the Pi is smart enough to automatically sense which wires to use for transmit and which for receive.

You will need to configure static IP addresses for the PC and the Pi, because there is no DHCP server on a network that consists of a single cable. A reasonable choice would be to assign the Pi a local IP number such as 192.168.56.1 and the PC a number in the same subnet, for example, 192.168.56.2. Without any additional configuration you should be able to reach the PC from the Pi over the network cable using the address 192.168.56.2. Similarly you should be able to reach the Pi from the PC using the address 192.168.56.1. Use ping to verify that everything is set up correctly.

Note, don't configure any forwarding, network address translation, bridge device or masquerade firewall on the Pi because you don't want Windows XP anywhere near the Internet, which the Pi can presumably reach using WiFi. No additional routes need to be set up either. Not configuring those things is easy.

After you have verified that the Pi and PC can talk to each other, set up a Windows share to transfer files. If you try this approach, feel free to post your progress here and any further questions.

GAP
Posts: 118
Joined: Thu Apr 12, 2018 9:18 am
Location: New South Wales Australia

Re: Share HDD with windows and Pi

Sat Jun 23, 2018 10:24 am

ejolson wrote:
Sat Jun 23, 2018 1:03 am
GAP wrote:
Fri Jun 22, 2018 11:33 pm
The Win machine is running XP and is not upgradable because of its age.
Sounds like your PC is airgapped and you don't want to connect it to the internet. Is the Pi connected to the internet through WiFi or wired networking?
Pi connected via WiFi Win is stand alone no Internet connection (security decision as XP is not supported).

GAP
Posts: 118
Joined: Thu Apr 12, 2018 9:18 am
Location: New South Wales Australia

Re: Share HDD with windows and Pi

Sat Jun 23, 2018 10:34 am

ejolson wrote:
Sat Jun 23, 2018 4:12 am
LTolledo wrote:
Sat Jun 23, 2018 2:39 am
GAP wrote:If I connect the Win and Pi together with an Ethernet cable is that a network?
I doubt plugging one end of the ethernet cable to the windows PC and the other end of that same cable to the RPi will make it a network. I could be wrong though because I have not tried it yet
Running a network cable directly from the PC to the Pi works fine, is what I'm doing and allows you to keep the Windows XP machine off the Internet.

Any network cable will work. In the distant past a crossover cable was needed, but the Pi is smart enough to automatically sense which wires to use for transmit and which for receive.

You will need to configure static IP addresses for the PC and the Pi, because there is no DHCP server on a network that consists of a single cable. A reasonable choice would be to assign the Pi a local IP number such as 192.168.56.1 and the PC a number in the same subnet, for example, 192.168.56.2. Without any additional configuration you should be able to reach the PC from the Pi over the network cable using the address 192.168.56.2. Similarly you should be able to reach the Pi from the PC using the address 192.168.56.1. Use ping to verify that everything is set up correctly.

Note, don't configure any forwarding, network address translation, bridge device or masquerade firewall on the Pi because you don't want Windows XP anywhere near the Internet, which the Pi can presumably reach using WiFi. No additional routes need to be set up either. Not configuring those things is easy.

After you have verified that the Pi and PC can talk to each other, set up a Windows share to transfer files. If you try this approach, feel free to post your progress here and any further questions.
Thank you,

I now just have to digest all this and figure out what a lot of this means (old guy almost comp illiterate here so please be patient) starting with learning about static IP addresses and subnet.

So I can connect the 2 together and after figuring out all the techno stuff it should work, yes?

The XP did connect to the net via Ethernet cable back in the day so as I have not change it that bit should still work.

Do I just leave the HDD connected to Pi and access it from XP via Ethernet?

n67
Posts: 803
Joined: Mon Oct 30, 2017 4:55 pm

Re: Share HDD with windows and Pi

Sat Jun 23, 2018 11:24 am

I love the implication that you are somehow safer (more secure) running Windows 10, than running XP.
"L'enfer, c'est les autres"

If a post offends you, just put that poster on your foes list, and be done with it (and with them).

To do otherwise, risks being banned.

ejolson
Posts: 1899
Joined: Tue Mar 18, 2014 11:47 am

Re: Share HDD with windows and Pi

Sat Jun 23, 2018 4:21 pm

n67 wrote:
Sat Jun 23, 2018 11:24 am
I love the implication that you are somehow safer (more secure) running Windows 10, than running XP.
The unmaintained Wheezy version of Raspbian is also considered less secure than the current Stretch version. At the same time, the additional complexity of systemd and friends in Stretch is different than the additional complexity of Windows 10.

Back on topic, I'd leave the hard disks plugged where they currently are. After the networking is figured out and everything is working, one can optimize for speed or power saving as preferred.

GAP
Posts: 118
Joined: Thu Apr 12, 2018 9:18 am
Location: New South Wales Australia

Re: Share HDD with windows and Pi

Sat Jun 23, 2018 9:50 pm

n67 wrote:
Sat Jun 23, 2018 11:24 am
I love the implication that you are somehow safer (more secure) running Windows 10, than running XP.
Just listening to all the warning put out by the experts.

My Win 10 has virus protection and is updated regularly, XP has no anti virus and is stand alone with no internet connection.

The Pi/XP setup is used for my hobby, so if any hacker wants to look at my garden railway he is quite welcome to do that. ;) ;)

GAP
Posts: 118
Joined: Thu Apr 12, 2018 9:18 am
Location: New South Wales Australia

Re: Share HDD with windows and Pi

Sun Jun 24, 2018 4:54 am

I connected the 2 computers together via an Ethernet cable and after searching the net tried to change the IP address.

when using sudo ifconfig I get this for the Pi

[email protected]:~ $ sudo ifconfig
eth0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether b8:27:eb:16:62:2e txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.47 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::806d:f84a:f896:1517 prefixlen 64 scopeid 0x20<link>
inet6 fd1d:263:6ddd:0:9275:d9ea:2cb6:e8d9 prefixlen 64 scopeid 0x0<global>
inet6 2001:8003:2528:2000:2669:3a9b:3e91:8d98 prefixlen 64 scopeid 0x0<global>
ether b8:27:eb:43:37:7b txqueuelen 1000 (Ethernet)
RX packets 9607 bytes 10828229 (10.3 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5543 bytes 722693 (705.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0


XP Network Connection Details are

Physical address 00-13-D3-29-00-B9
IP address 169.254.101.41
Submask 255.255.0.0

My XP is asking for an IP address and a DNS server address in Internet Protocol (TCP/IP) properties

I have no idea what all that means and I am now at out of my depth point

I am using XP professional if that helps.

Also if I change the Pi IP address can I still use it for the internet to send and recieve?

ejolson
Posts: 1899
Joined: Tue Mar 18, 2014 11:47 am

Re: Share HDD with windows and Pi

Sun Jun 24, 2018 7:22 am

GAP wrote:
Sun Jun 24, 2018 4:54 am
I connected the 2 computers together via an Ethernet cable and after searching the net tried to change the IP address.

when using sudo ifconfig I get this for the Pi

[email protected]:~ $ sudo ifconfig
eth0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether b8:27:eb:16:62:2e txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.47 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::806d:f84a:f896:1517 prefixlen 64 scopeid 0x20<link>
inet6 fd1d:263:6ddd:0:9275:d9ea:2cb6:e8d9 prefixlen 64 scopeid 0x0<global>
inet6 2001:8003:2528:2000:2669:3a9b:3e91:8d98 prefixlen 64 scopeid 0x0<global>
ether b8:27:eb:43:37:7b txqueuelen 1000 (Ethernet)
RX packets 9607 bytes 10828229 (10.3 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5543 bytes 722693 (705.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0


XP Network Connection Details are

Physical address 00-13-D3-29-00-B9
IP address 169.254.101.41
Submask 255.255.0.0

My XP is asking for an IP address and a DNS server address in Internet Protocol (TCP/IP) properties

I have no idea what all that means and I am now at out of my depth point

I am using XP professional if that helps.

Also if I change the Pi IP address can I still use it for the internet to send and recieve?
This is good progress. Yes, it is possible for the Pi to connect to the Internet using WiFi and to the PC using the wired connection at the same time.

Each network device has its own IP address. Your output indicates that the wlan0 WiFi device on your Pi currently has the address 10.0.0.47 which was probably assigned to it by your router. The eth0 device doesn't have an IP number, yet, and will need to be configured. On the XP end it looks like the networking has been configured with the IP address 169.254.101.41, which you probably don't need to change. This implies that a reasonable choice for the Pi's eth0 wired networking device would be 169.254.101.40 in the same subnet.

Once eth0 has been set up, the Pi should work as follows:

1. All data for any IP address of the form 192.168.xxx.yyy will be sent over the wired interface

2. All data for any IP address of the form 10.0.0.zzz will be sent over WiFi.

3. All other IP addresses will be sent to the default route over WiFi for forwarding to the Internet.

To check the default route on the Pi use the command called route. The output shouldn't contain anything secret and it would be helpful to post it here. The current version of Raspbian uses /etc/dhcpcd.conf to configure the network. While primarily designed for simple automated DHCP configurations, dhcpcd also has a provision for using static IP numbers. From my recollection, things were not as straightforward as one might hope and dhcpcd kept deleting the default route over wlan0 when I tried to add eth0. I will check my Pi and see how I managed to give eth0 a static IP number soon. Feel free to try it yourself in the meantime.

Ernst
Posts: 686
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Share HDD with windows and Pi

Sun Jun 24, 2018 8:12 am

ejolson wrote:
Sun Jun 24, 2018 7:22 am
GAP wrote:
Sun Jun 24, 2018 4:54 am
I connected the 2 computers together via an Ethernet cable and after searching the net tried to change the IP address.

when using sudo ifconfig I get this for the Pi

[email protected]:~ $ sudo ifconfig
eth0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether b8:27:eb:16:62:2e txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.47 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::806d:f84a:f896:1517 prefixlen 64 scopeid 0x20<link>
inet6 fd1d:263:6ddd:0:9275:d9ea:2cb6:e8d9 prefixlen 64 scopeid 0x0<global>
inet6 2001:8003:2528:2000:2669:3a9b:3e91:8d98 prefixlen 64 scopeid 0x0<global>
ether b8:27:eb:43:37:7b txqueuelen 1000 (Ethernet)
RX packets 9607 bytes 10828229 (10.3 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5543 bytes 722693 (705.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0


XP Network Connection Details are

Physical address 00-13-D3-29-00-B9
IP address 169.254.101.41
Submask 255.255.0.0

My XP is asking for an IP address and a DNS server address in Internet Protocol (TCP/IP) properties

I have no idea what all that means and I am now at out of my depth point

I am using XP professional if that helps.

Also if I change the Pi IP address can I still use it for the internet to send and recieve?
This is good progress. Yes, it is possible for the Pi to connect to the Internet using WiFi and to the PC using the wired connection at the same time.

Each network device has its own IP address. Your output indicates that the wlan0 WiFi device on your Pi currently has the address 10.0.0.47 which was probably assigned to it by your router. The eth0 device doesn't have an IP number, yet, and will need to be configured. On the XP end it looks like the networking has been configured with the IP address 169.254.101.41, which you probably don't need to change. This implies that a reasonable choice for the Pi's eth0 wired networking device would be 169.254.101.40 in the same subnet.

Once eth0 has been set up, the Pi should work as follows:

1. All data for any IP address of the form 192.168.xxx.yyy will be sent over the wired interface

2. All data for any IP address of the form 10.0.0.zzz will be sent over WiFi.

3. All other IP addresses will be sent to the default route over WiFi for forwarding to the Internet.

To check the default route on the Pi use the command called route. The output shouldn't contain anything secret and it would be helpful to post it here. The current version of Raspbian uses /etc/dhcpcd.conf to configure the network. While primarily designed for simple automated DHCP configurations, dhcpcd also has a provision for using static IP numbers. From my recollection, things were not as straightforward as one might hope and dhcpcd kept deleting the default route over wlan0 when I tried to add eth0. I will check my Pi and see how I managed to give eth0 a static IP number soon. Feel free to try it yourself in the meantime.
IMHO There is no need to change / configure anything in this configuration using a drop cable as it should work as is.
(for technical reasons I can not confirm this at the moment). Disclaimer: Last time I did confirm this was with Jessie.

The first requirement is that on all systems all interfaces are setup to receive an IP-addresses (and other configuration data) using DHCP from a DHCP server.

When the XP system is started it will try to access the DHCP server to obtain an IP-address, gateway address, DNS server, but there is no DHCP server on the other side of the cable so it will take a random 169.254.x.x private address and the gateway, DNS is left blank.

When the Pi system is started it will try to access an DHCP server on each interface to obtain an IP-address, gateway address, DNS server. But on the ethernet interface (drop cable) there is no DHCP server on the other side of the cable so it will take a random 169.254.x.x private address and the gateway, DNS is left blank. The WiFi interface should get the IP-address, gateway and DNS from the WiFi access point.

Now the problem will be identify the private address assigned to the ethernet interface on the Pi, this can be done by accessing the Pi with ssh using the WiFi path, or with the use of an bonjour browser (http://hobbyistsoftware.com/bonjourbrowser on the Windows XP system.

It is important to understand that using WiFi and Ethernet at the same time can cause problems if configured wrongly, in this configuration it will not because the gateway (route) will only be configured on the WiFi interface, routing to the ethernet interface will be limited on the 169.254.x.x network. It is better to let DHCP do the work if you do not have sufficient experience with TCP/IP networking because it easy to do it wrong and the road to TCP/IP hell is paved with static IP-addresses.
My first computer was an ICT1500, my first "personal" computer was the Science of Cambridge Mk14, followed by a TRS-80 Model I later

ejolson
Posts: 1899
Joined: Tue Mar 18, 2014 11:47 am

Re: Share HDD with windows and Pi

Sun Jun 24, 2018 4:53 pm

Ernst wrote:
Sun Jun 24, 2018 8:12 am
When the XP system is started it will try to access the DHCP server to obtain an IP-address, gateway address, DNS server, but there is no DHCP server on the other side of the cable so it will take a random 169.254.x.x private address and the gateway, DNS is left blank.

When the Pi system is started it will try to access an DHCP server on each interface to obtain an IP-address, gateway address, DNS server. But on the ethernet interface (drop cable) there is no DHCP server on the other side of the cable so it will take a random 169.254.x.x private address and the gateway, DNS is left blank. The WiFi interface should get the IP-address, gateway and DNS from the WiFi access point.
This is very interesting. I've never heard of using a random 169.254.x.x address when no DHCP server could be found. Indeed that seems to be what the XP system is doing. The Pi, unfortunately, did not do this, possibly because it already had a valid DHCP response on the WiFi. That means I was wrong in suggesting to assign a static IP in the same subnet to the PI. I wonder what can be done to get the Pi to choose a random address for eth0. Could you try this with the current Stretch based Raspbian in the case where WiFi on the Pi is already configured with the default route?

Presumably the random addresses are chosen from the remaining unused ones to prevent both systems from getting the same IP number. From this understanding, it would seem that either both the PC and the Pi should use randomly chosen but non clashing IP numbers of the form 169.254.x.x or they should both use statically assigned IP numbers from a different subnet, for example, of the form 192.168.56.x as suggested in my earlier post.

It's not clear to me which of these options is better. Does it slow down the boot process very much to check for a DHCP server, not find one, pick a random address, check that it is not already in use and then proceed?

User avatar
DougieLawson
Posts: 33846
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Share HDD with windows and Pi

Sun Jun 24, 2018 5:02 pm

169.254.xxx.xxx/16 addresses are chosen by the local TCP/IP stack with no external influence.

If your machine randomly picks the same 16-bit address (unlikely) as another on the network it'll re-run the automatic function and get a new address.

169.254.xxx.xxx is not routable.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

Return to “General discussion”

Who is online

Users browsing this forum: asavah, Palamedes and 37 guests