You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However there are a few issues that prevent us the MSX users to reach the absolute networking happiness:
At the time of this writing, there isn't any solution for wireless Internet for MSX, only Ethernet hardware.
InterNestor Lite, the TCP/IP stack for MSX, doesn't support TLS. It's not that the developer (me!) is too lazy to implement it, it's just that a Z80 can't handle the required encryption algorythms. Trust me, I tried.
So after thinking about how to solve these issues and some work I came up with a solution. This set of documents will explain you:
How to use a Raspberry Pi to provide WiFi connectivity to an Ethernet-only device. This isn't (or shouldn't be, I haven't really tested it) MSX exclusive, this method should work for any Ethernet-only device.
How to use the SOCKS5 client capability of InterNestor Lite + a modified version of stunnel, running on the Raspberry Pi itself, to provide indirect TLS support for MSX computers.
How to use a Raspberry Pi to provide WiFi for Ethernet-only devices
Here I'll explain how to configure a Raspberry Pi to act as a "WiFi dongle" for TCP/IP capable but Ethernet-only devices. For my tests I have used a Raspberry Pi Zero W with an OTG USB Ethernet adapter (4€ in eBay), but any other model of Pi should work as long as it has Ethernet and WiFi. You'll need a tool to connect to the Pi via SSH (I recommend MobaXTerm if you use Windows).
I'm sure that someone has done this before and has published it somewhere, but I weren't able to find it. What I did find was this article in Raspberry Pi HQ about how to turn a Pi into a WiFi router, but what this article explains is how to turn a Pi connected to the router via Ethernet into a WiFi access point for other devices; we need exactly the opposite, but I used the information in that article as a starting point, modifying what I needed.
Flash the image file in the SD card using balena Etcher
Reinsert the SD card in your computer, Windows will create a few drive letters and tell you that all are unformatted but one. In that one create an empty file named ssh (withot any extension), and a file named wpa_supplicant.conf with the details of your WiFi access point as follows:
country=<ISO code of your country>
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
scan_ssid=1
ssid="<the name of your WiFi network>"
psk="<the password for your WiFi network>"
}
Insert the SD card in your Pi and let it boot. Wait one minute or so.
If you install bonjour you'll be able to fin your Pi by the name raspberrypi.local. Otherwise you need to get the IP that the Pi got by using a network scanner (there are plenty for Android, for example).
If everything went well you should now be able to SSH to your Pi using pi as the user name and raspberry as the password. Hooray!
The next steps are to be done via the SSH prompt directly in the Pi. To edit files text you can use the pico editor by running sudo pico filename.
Step 1: Setup DHCP
First we need to configure the DHCP client so that the Ethernet port of the Pi gets a fixed IP address and network mask. Edit the /etc/dhcp/dhcpd.conf file and add the following content to it:
interface eth0
static ip_address=192.168.34.1/24
We'll use the 192.168.34.x as the IPs range for the network attached to the Ethernet port. And why the 34, you might ask? It's for important historical reasons.
Next, we need to configure a DHCP server so that the device connected to the Ethernet port gets its IP configuration by using itw oen DHCP client. First, install the DHCP server:
sudo apt-get install isc-dhcp-server
Then edit the /etc/dhcp/dhcpd.conf file by adding the following:
Now edit the /etc/default/isc-dhcp-server file and add set the line starting with INTERFACESv4 as follows:
INTERFACESv4="eth0"
And with this, the DHCP configuration is finished. To start the DHCP server run this: service isc-dhcp-server start.
Step 2: configure IP forwarding
Now we need to configure IP forwarding: we want all the network traffic coming from the Ethernet port to be forwarded to the WiFi network, and viceversa. These commands will do the trick:
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sudo iptables -A FORWARD -i wlan0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i eht0 -o wlan0 -j ACCEPT
Also we need to add the following at the end of the /etc/sysctl.conf file in order to actually enable IP forwarding:
net.ipv4.ip_forward=1
Step 3: Set the WiFi network as the main route
A problem I had the first time I played around with my Pi + the Ethernet adapter is that Raspbian was using the Ethenet port for the default entry in the IP routing table. This of course doesn't work, since the outside world is visible in the WiFi network, not in the Ethernet port where there's just a poor MSX sitting.
Eventually I flashed Raspbian again to have a fresh start after having messed things around... and this time Raspbian had configured, correctly, the wlan0 interface as the one for the default entry in the IP routing table.
So just in case, run these commands. If the interface for the main entry is wlan0, nothing will happen; otherwise, wlan0 will be set as such:
DEFAULT_IFACE=`route -n | grep -E "^0.0.0.0 .+UG" | awk '{print $8}'`
if [ "$DEFAULT_IFACE" != "wlan0" ]
then
GW=`route -n | grep -E "^0.0.0.0 .+UG .+wlan0$" | awk '{print $2}'`
echo Setting default route to wlan0 via $GW
sudo route del default $DEFAULT_IFACE
sudo route add default gw $GW wlan0
fi
Step 4: Set everything at boot time
The last step is to set Raspbian to configure all of this automatically when the Pi boots. We'll do this with crontab.
First, create a new file named ~/router with the following contents (the echo statements aren't necessary, but may be useful for testing):
echo Starting DHCP server
service isc-dhcp-server start
echo Setting NAT routing
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
iptables -A FORWARD -i wlan0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eht0 -o wlan0 -j ACCEPT
DEFAULT_IFACE=`route -n | grep -E "^0.0.0.0 .+UG" | awk '{print $8}'`
if [ "$DEFAULT_IFACE" != "wlan0" ]
then
GW=`route -n | grep -E "^0.0.0.0 .+UG .+wlan0$" | awk '{print $2}'`
echo Setting default route to wlan0 via $GW
route del default $DEFAULT_IFACE
route add default gw $GW wlan0
fi
Don't forget to make the file executable with chmod +x ~/router after creating it.
Now run crontab -e and when the text editor opens add the following:
@reboot sudo /home/pi/router
Step 5: Try it!
Reboot your Pi and connect its Ethernet port to your Ethernet-only device. If everything goes as planned now your device has an IP address in the range 192.168.34.x and has Internet access thanks the Pi's WiFi interface. Celebrate and party!
How to use stunnel with SSL SOCKS support + InterNestor Lite
The previous is document explains how to use a modified version of stunnel, combined with the SOCKS client support provided by InterNestor Lite, to perform TLS connections from a MSX computer using InterNestor Lite. This assumes that you have an MSX with an Ethernet card and InterNestor Lite, and a Raspberry Pi configured to provide Internet access via WiFi as explained in the previous document.
Step 1: get and configure stunnel
All the commands are to be executed from the Pi itself via a SSH connection.
Finally, let's instruct the Pi to run stunnel at boot. Run crontab -e and when the text editor appears add the following at the end:
@reboot /home/pi/stunnel /home/pi/stunnel.conf
Step 2: Configure InterNestor Lite
Once InterNestor Lite is installed, run the following in the MSX-DOS prompt to configure it as a SOCKS server, using the instance of stunnel running on the Pi as the server:
inl tcp x2 192.168.34.1 1443
Alternatively, if you create a text file named inl.cfg containing the line tcp x2 192.168.34.1 1443 and put it in the same directory of inl.com, this will be configured automatically when InterNestor is installed.
Note that this image still has the default password for the pi user in Raspbian, you may want to change it and maybe perform other adjustments and optimizations; that's outside the scope of this documentation.
Guys can you help me pls? I followed the tutorial, fixed the typo (/etc/dhcpcd.conf), everything works, but after reboot, DHCP server won't start automatically, I need to write "sudo service isc-dhcp-server start". I think there is a problem with authentication. Can you help me fix it? Thanks.
Guys can you help me pls? I followed the tutorial, fixed the typo (/etc/dhcpcd.conf), everything works, but after reboot, DHCP server won't start automatically, I need to write "sudo service isc-dhcp-server start". I think there is a problem with authentication. Can you help me fix it? Thanks.
Try to use
systemctl isc-dhcp-server enable
systemctl isc-dhcp-server start
systemctl isc-dhcp-server status
I have an issue. This simply will not work for me, and I have even downloaded the IMG file. When plugging into an end device it says: unidentified no internet access.
For me it also doesn't work. I have tried settings things manually and using the image (but with altered IP address range) and whenever I try to nmap the RPI it says port closed even thought the port to the device on the RPI is open and forwarding is turned on.
Update: I have got the raspberry pi up and running at is working flawlessly. Here is what I did in layman's terms:
I issued a Sudo raspi-config and configured everything for the country that I am in (United States). It was previously configured for Europe.
Once I did that, I saved and rebooted.
I noticed that every time that I started up the machine, the DHCP service failed to initiate(I am not sure why). This is what was causing the issues for the PI not getting internet access. In order to fix this problem do:
Su root --> enter root password
Once you have elevated access do: service isc-dhcp-server start
Plug in your device that you want connected to ethernet and enjoy. You will now have internet access.
To set a static IP address on the eth0 interface you need to edit
/etc/dhcpcd.conf
, not/etc/dhcp/dhcpd.conf
. Just a typo on your end im sure