This following is an updated guide based on the DreamPi 1.8 DLE image. Although the risk of making such changes should be minimal, your setup may differ and therefore the results may as well.
There are a minimum of three IP addresses when using a DreamPi:
- The IP address of the DreamPi primary network interface
- The IP address of the DreamPi for the point-to-point network interface with the Dreamcast
- The IP address of the Dreamcast for the point-to-point network interface with the DreamPi
If all you are concerned with is ensuring that the Dreamcast has a static IP address so that you can forward ports to it or put your Dreamcast in the DMZ of your router, then all you will need to complete this this first section.
Section 1
Update the dreampi auto configuration script
When you connect to a Dreamcast game online, the dreampi script creates the point-to-point connection between the DreamPi and the Dreamcast. The resulting network interface, ppp0, consists of two IP addresses.
The default behavior of the DreamPi script is to identify two IP addresses that are available on your local network. It starts at .100 and counts down in increments of 1. In the vast majority of cases, this will result in an IP address ending in .99 for the DreamPi and .98 for the Dreamcast in the point-to-point, ppp0, network interface.
If you want to set these statically, the changes that need to be made are pretty simple.
Open the dreampi script in a text editor:
Find the lines of code that read:
Code: Select all
this_ip = find_next_unused_ip(".".join(subnet) + ".100")
dreamcast_ip = find_next_unused_ip(this_ip)
Change the lines to read:
Code: Select all
this_ip = "10.16.8.19"
dreamcast_ip = "10.16.8.20"
You will want to ensure that you are using your local network details for both addresses. The IP addresses can really be whatever you want as long as they are valid for your network and do not conflict with each other or any other devices.
If you are anal-retentive like I am and you don't want the now unused functions for ip_exists and find_next_unused_ip sitting there in the code without a purpose, you can either comment it out or remove it entirely. If you do not know what this means, don't worry about it.
Once done editing the /usr/local/bin/dreampi file, press Ctrl + X at the same time, type "y" or "yes" at the prompt to save modified buffer, and press Enter to write and close.
Reboot your Raspberry Pi by entering:
To verify that your changes have taken effect, simply connect to a Dreamcast game online and run the following command:
The result should include at least 3 network interfaces including the point-to-point, ppp0, network interface.
Code: Select all
3: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 3
link/ppp
inet 10.16.8.19 peer 10.16.8.20/32 scope global ppp0
valid_lft forever preferred_lft forever
As you can see, per my setup, my DreamPi has an IP address of 10.16.8.19 and my Dreamcast has an IP address of 10.16.8.20.
I can now forward my ports to 10.16.8.20 or set my DMZ to that value on my router.
Section 2 optional
If you want the DreamPi primary network interface to have a static IP address as well, you can configure that through the networking service. My reasoning for doing this is so that I can manage the DreamPi headlessly (i.e. without a monitor connected) over SSH. It is a lot easier to know the IP address than to have to look up the IP address on my router each time I want to connect.
Note: I have a Raspberry Pi B+ with ethernet only. If you use a Raspberry Pi with a wireless network as your primary network interface, the steps you will need to follow may differ.
Disable dhcpcd
When installed on a Linux installation, dhcpcd is responsible for configuring a computer's network interface(s) to work on any attached network(s). It retrieves the gateway, IP address, and DNS information from your DHCP server, likely your router, and configures automatically configures your computer accordingly.
For me, with the DreamPi 1.8 DLE image defaults, dhcpcd fails to start upon boot. Therefore, disabling it here will likely not matter, but I am going to disable it anyways because I won't need it after setting a static IP address.
To disable the dhcpcd systemd service, enter:
To validate that the command worked and the dhcpcd systemd service is disabled, enter:
If successful, something along the lines of the following will be displayed:
Code: Select all
Warning: dhcpcd.service changed on disk. Run 'systemctl daemon-reload' to reload units.
● dhcpcd.service - dhcpcd on all interfaces
Loaded: loaded (/lib/systemd/system/dhcpcd.service; disabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/dhcpcd.service.d
└─wait.conf
Active: inactive (dead)
Update the /etc/network/interfaces configuration
It appears the DreamPi 1.8 DLE image is using the standard Debian network manager to configure the network interface(s). This is great because it is a very simple and straight-forward way to manage a network interface from the command line.
Open the interfaces file in a text editor:
Upon opening it, it should read along the lines of:
Code: Select all
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
dns-nameserver 127.0.0.1
manual eth0
allow-hotplug eth0
iface eth0 inet dhcp
dns-nameserver 127.0.0.1
The first section of "wlan0" is for a wireless network interface and the second section of "eth0" is for a wired network interface.
To configure a static IP address for the wired network interface of "eth0", comment out everything in the file by adding a leading "#" to each line and then add the following:
Code: Select all
auto eth0
iface eth0 inet static
address 10.16.8.18
netmask 255.255.255.0
gateway 10.16.8.1
Again, you will want to ensure that you are using your local network details for address, netmask, and gateway.
Once done editing the /etc/network/interfaces file, press Ctrl + X at the same time, type "y" or "yes" at the prompt to save modified buffer, and press Enter to write and close.
Reboot your Raspberry Pi by entering:
To verify that your changes have taken effect, run the following command:
The result should include at least 2 network interfaces including the eth0 primary network interface.
Code: Select all
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether b8:27:eb:3b:3e:45 brd ff:ff:ff:ff:ff:ff
inet 10.16.8.18/24 brd 10.16.8.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::ba27:ebff:fe3b:3e45/64 scope link
valid_lft forever preferred_lft forever
That's it. Now you should always be able to connect to your DreamPi via SSH at the same IP address.