Local HTTP Server Only Access-able When Wifi is Turned Off - macos

This was woorking for me a week ago and I have no idea what changed.
I have a local http server on one device that I'm accessing with my Mac (through javascript),they are directly connected through Ethernet/a switch. I have the ethernet network on my mac set to a manual ip/mask to reflect the address of my server.
I can interact with my server perfectly when wifi is turned off on my mac, however, when I turn it on everything breaks and my requests to the server time out with no response (wifi is still functional).
Things I've tried:
Changing the network priority in network system preferences on my mac to make sure the wired Ethernet connection takes priority over WiFi. This changed nothing
Added a static route sudo route add -host [ip of http server] -interface en10. After I changed this, the server was unreachable even when wifi was down so I may have done something wrong
rebooted :)
I'm super lost here - any advice or any debugging tips would be much appreciated!

Related

Simpler method to redirect outgoing connection to localhost in Windows 10

Ok, so I have a program that talks with a device through Bluetooth and enables it to open a socket connection to an external host. I have a simulator that runs in my computer and I want to redirect the outgoing connection to the simulator running in localhost. Even for Windows, this seems more complicated that I think it should be.
Based in this I tried netsh int ip add addr 1 111.222.333.444/32 st=ac sk=tr
Based on this I tried netsh interface portproxy add v4tov4 listenaddress=111.222.333.444 listenport=15000 connectaddress=127.0.0.1 connectport=2405 protocol=tcp
While the outgoing connection always goes to port 15000, I can control the port where my simulator is listening. It is 2405 merely because the first version of the simulator used that port for some reason.
I tried with both active and forgot about them while I searched for alternatives.
I then found this link with no solution, but the OP said that he solved his problem with PassPort, which finally enabled the device's outgoing communication to reach my simulator.
When I tried to revert the netsh commands, I discovered out that I needed both commands active for PassPort to do its trick.
Isn't there a simpler method to achieve this? My system is Windows 10 21H1
I can't use the hosts file because the connection is made directly to the IP, not to a hostname.
Edit: apologies, I just realized that this might have been better to ask in superuser... can I move it or need to delete/recreate?

How to force MacOS to send network packets to local proxy even when Wi-Fi is not connected

MacOS version: Mojave
I have a program listening on a local port(2080). I would like to forward all network requests to this program.
In order to accomplish this, I have configured the Wi-Fi network service to use a socks5 proxy as well as dns server pointing to local host.
This works as long as the Wi-Fi network service is connected to any network, regardless wether that network is connected to the internet. (For instance, a chromecast).
Is there a way to force the packages to the program without having to connect to a network?
Previous attempts include creating a network service attached to the lookback device, lo0, with the proxy and dns settings as before (couldn't get any packets to be routed through the program, network panel says not connected) And installing tun/tap discussed in this question.(Virtual network interface in Mac OS X).
The device will show up in ifconfig, but not in network services after editing the SystemConfiguration/preferences.plist
Any guidance is welcomed.
Nevermind I figured it out. The Tun/Tap will work, just need to configure the virtual network service with correct DNS and proxy settings.

Raspberry Pi SSH connection over Ethernet fails

I'm trying to establish a connection over SSH from my Win 8.1 laptop to my raspberry pi 3 model B as the host. Connecting over wifi works flawlessly each time, however I need to demo projects in class and the campus wifi does not play well with SSH, our professor stated that we must use an Ethernet connection. I have tried both putty and Bitvise SSH clients with same results - either "connection refused" or "no connection could be made because the machine actively refused it".
I have tried:
Enabling internet sharing on the Ethernet connection and enabling the SSH services (port 22 both TCP and UDP)
Disabling wifi on Win
Forgetting wifi on raspberry
Manually activating SSH server on raspberry even though I'm pretty sure it was activated already.
Deleting SSH keys from the wifi sessions
Completely disabling the firewall
ipconfig /release ipconfig /renew
Restarting both machines after every of the above
Reimaging memory card with newest Raspbian
Any help would be greatly appreciated.
Edit: The link What can be the reasons of connection refused errors? did not help, the listed reasons are closed ports or firewall and as I already said I tried to open the required ports through the shared Ethernet connection and turned off Windows firewall completely with no other firewall programs running. From my understanding Raspbian doesn't come with any enabled firewalls and allows all traffic. Can someone correct me if I'm wrong?
I finally found a guide that works: http://www.circuitbasics.com/how-to-connect-to-a-raspberry-pi-directly-with-an-ethernet-cable/
The crucial step was to set the static IP address of the pi to my laptop's Ethernet adapter address but modify the last part. You're welcome, all you poor souls from the future.

How does my computer know that it is connected to the Internet?

Sorry for asking such a mundane question, but I'm suddenly curious. If I open the network connections dialog on my Windows machine, it shows me a cute little picture of my computer connecting to a router and then to a globe (labeled Internet). What is Windows trying to connect to in order for it to decide that the computer has Internet connectivity? I assume there is no IP4 address for 'The Internet', so where is it going? Is it just sending a ping to an address back at the Microsoft home office? If that address were to disappear, would my window's machine suddenly decide that it no longer has a route to the Internet? Would Windows boxes that were 'close' to that address incorrectly report that they could get to the Internet when they couldn't.
I'll stop now before this gets too silly. But seriously, what criteria does a Windows box use to determine that it has Internet connectivity? I'm assuming that Linux and iOS systems have an equivalent feature. Do they use the same criteria?
The general IP address that is used for 'the internet' is 8.8.8.8 - or Google.com.
If you can ping it, and get a web page from it, then there's a pretty good chance you can get to at least some of the internet.
But for specifically Windows - Network Connectivity Status Indicator - it uses a different domain: dns.msftncsi.com
It will (unless disabled by GPO):
resolve the name, and verify it has the 'right' IP (131.107.255.255
fd3e:4f5a:5b81::1 )
Perform a HTTP get to this address and check it gets a result. NCSI
Presumably if different responses are retrieved, then it can tell if it has a wi-fi login or similar.
Your intuitions seem correct. I am not on a Windows machine but you could find out by firing netstat and then connecting.
If I was programming this I'd make Ping, TCP and HTTP requests. Some devices are connected through proxies such as firewalls, captive portals and others. the only way to be sure is to send something and receive a reply.
My Android device for example can detect captive portals. It probably does that by trying to HTTP connect somewhere.

Setting up domain name redirection on Mac OSX for all! domains

im trying to setup a redirection towards an app that im writing in Java. This app opens a port 8443 on my laptop (which is a MacOS 10.10 Yosemite) and offers a HTTPS service.
The big plan is to have another device connecting to an access point that im setting up on my laptop and when it connects to any ip/domain on 443 this traffic is redirected to my local machine on port 8443.
I need to redirect traffic that im getting on 443 to 8443. I kinda might have gotten a solution for this using the following guide: http://www.abetobing.com/node/81, and changed the rule to rdr pass on lo0 inet proto tcp from any to any port 443 -> 127.0.0.1 port 8443
But this rule only works locally if im right about that. So only traffic coming from my own laptop is redirected. if im trying to open https://192.168.178.25/ on another machine it doesn't work, but https://192.168.178.25:8443/ does.
Additionally i also was able to change a domain via the /etc/hosts file. That only works for local connections and for single domains if im right. So the second step would be to redirect ALL possible domain names to my ip. I think this should be possible with kinda of a proxy service, but since i am new to this topic I haven't found a solution that is working for me.
At the moment I am using 2 Wifi devices and the MacOS Internet share. My USB wifi card is connected to a router and internet. My internal wifi card opens an access point (it says hotspot) and offers the internet connection of the other device. This is annoying, since the USB wifi connection always has to work, otherwise MacOS will shut down the access point. The best solution would be a software opening a reliable access point with the internal wifi card (haven't had any success with the Mac OS ad-hoc network)
I would be so glad if someone would be able to help me out with any of the 3 single parts. Thank you already :)

Resources