{"id":737,"date":"2023-07-06T23:26:41","date_gmt":"2023-07-06T22:26:41","guid":{"rendered":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/?p=737"},"modified":"2023-08-10T23:44:04","modified_gmt":"2023-08-10T22:44:04","slug":"connecting-a-raspberry-pi-etc-direct-to-a-pc","status":"publish","type":"post","link":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/connecting-a-raspberry-pi-etc-direct-to-a-pc\/","title":{"rendered":"Connecting a Raspberry Pi (etc) Direct to a PC with a USB-LAN Adapter"},"content":{"rendered":"<p>There are a number of articles on the web which describe how to connect a Raspberry Pi direct to a Windows PC with a USB to LAN adapter. This can be quite handy when tinkering, especially with an original version 1. <a href=\"https:\/\/alexanderhoughton.co.uk\/blog\/connecting-to-raspberry-pi-direct-to-pc-via-ethernet\/\">This article is quite good<\/a> but I struggled to make it work. This article explains the problem and solution&#8230; but read that article first, as I don&#8217;t explain a few things!<\/p>\n<p>The root of the problem is that I was using a USB to LAN adapter. It appears that Windows (Windows 11 at least) does not trust these devices because the network is fixed as being &#8220;Public&#8221;; I could not find a way to change this. The second part of my initial downfall was that when TFTPD64* started up, and Windows Firewall popped up the &#8220;public or private network&#8221; challenge, I thought nothing of allowing it to proceed with &#8220;private&#8221;. Thus, the firewall is between my USB-LAN dongle and the DHCP server.<\/p>\n<p>* &#8211; an alternative is OpenDHCPServer.<\/p>\n<p>If, like me, you missed the chance to choose &#8220;public&#8221; when starting the DHCP server software, you need to find your way into Windows &#8220;Settings&#8221;, then &#8220;Privacy &amp; Security &gt; Windows Security &gt; Firewall &amp; network Protection &gt; Allow an app through firewall&#8221; (take a breath)&#8230; click the &#8220;Change settings&#8221; button then scroll down the list and enable the entry for tftpd64 or opendhcpserver for &#8220;public&#8221;.<\/p>\n<p>Oh: one thing which the article above was not clear on was to use a different subnet ip address for the USB-LAN dongle than the PC is on. e.g. if your PC is 192.168.1.4, don&#8217;t use any 192.168.1.* address for the static IP entry.<\/p>\n<h2>And What About Internet Connection?<\/h2>\n<p>While the procedure in the above-mentioned article is fine for accessing the Pi from your PC, as soon as you need to access the internet from the Pi, it is aparrent that you can&#8217;t! Network interactions time out because there is no route for network traffic from the dongle adapter to the PC&#8217;s LAN\/WiFi.<\/p>\n<p>This is easily solved using &#8220;Sharing&#8221;. First thing: shut the Pi down. Starting with your PC&#8217;s &#8220;real&#8221; network adapter, right-click &gt; Properties &gt; Sharing (tab) &gt; select the top &#8220;Allow&#8221; and choose the dongle for &#8220;Home networking connection&#8221;.<\/p>\n<p>This will change the dongle&#8217;s IP addres so a return to TFTPD64 will be required to change settings, after which the Pi can be powered on again to get its new IP address. Changed settings I used:<\/p>\n<ul>\n<li>IP pool start address = 192.168.137.100<\/li>\n<li>Def router (Opt3) = 192.168.137.1<\/li>\n<\/ul>\n<p>Watching the TFTPD64 log I noticed that it allocates two IP addresses. I suspect the first one (it had MAC address 00:AB:00:00:00:00, which is not normal!) is part of WIndows&#8217; sharing magic. The other one should have your usual (and of course remembered!) Pi&#8217;s MAC. For me this was 192.168.137.101<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are a number of articles on the web which describe how to connect a Raspberry Pi direct to a&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37],"tags":[],"class_list":["post-737","post","type-post","status-publish","format-standard","hentry","category-raspberry-pi","post-archive"],"_links":{"self":[{"href":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-json\/wp\/v2\/posts\/737","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-json\/wp\/v2\/comments?post=737"}],"version-history":[{"count":5,"href":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-json\/wp\/v2\/posts\/737\/revisions"}],"predecessor-version":[{"id":798,"href":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-json\/wp\/v2\/posts\/737\/revisions\/798"}],"wp:attachment":[{"href":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-json\/wp\/v2\/media?parent=737"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-json\/wp\/v2\/categories?post=737"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hilltop-cottage.info\/blogs\/adam\/wp-json\/wp\/v2\/tags?post=737"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}