Both sides previous revision Previous revision Next revision | Previous revision |
raspberry-pi:ipfire-on-rpicm4 [2023/12/17 17:41] – [Adjusting interfaces (important!)] Zyzonix | raspberry-pi:ipfire-on-rpicm4 [2025/04/13 12:02] (current) – [Adjusting Interfaces (MAC Addresses) (important!)] Samsoneko |
---|
| |
//Disclaimer: all provided links in this article **aren't** sponsored!// | //Disclaimer: all provided links in this article **aren't** sponsored!// |
<callout type="info" icon="true">Tutorial tested against a Raspberry Pi Compute Module 4 (4GB, rev. 1.2) and IPFire Core Update 179. During the setup a second Raspberry Pi 3A with local attached keyboard and monitor was used. </callout> | <callout type="info" icon="true">Tutorial tested against a Raspberry Pi Compute Module 4 (4GB, rev. 1.2) and IPFire Core Update 179. During the setup a second Raspberry Pi 3B+ with local attached keyboard and monitor was used. </callout> |
| |
→ IPFire's wiki can be found [[https://wiki.ipfire.org/|here]]. | → IPFire's wiki can be found [[https://wiki.ipfire.org/|here]]. |
* //HDMI-Cable// | * //HDMI-Cable// |
* //Keyboard// | * //Keyboard// |
| * //or USB2TTL Apdapter// |
| |
===== Download and flash the Image to the SD-Card ===== | ===== Download and flash the Image to the SD-Card ===== |
Now connect the following pins on your carrier board's GPIO and your second Pi's GPIO with three jumper wires (female to female): | Now connect the following pins on your carrier board's GPIO and your second Pi's GPIO with three jumper wires (female to female): |
<WRAP 40%> | <WRAP 40%> |
^ Carrier Board (CM4) ^ 2nd Raspberry Pi ^ Use ^ | ^ Carrier Board (CM4) ^ 2nd Raspberry Pi / USB2TTL ^ Use ^ |
| **''6''** | **''6''** | Ground | | | **''6''** | **''6''** / **''GND''** | Ground (GND) | |
| **''10''** | **''8''** | Receive and send | | | **''10''** | **''8''** / **''TX''** | Receive and send | |
| **''8''** | **''10''** | Send and receive | | | **''8''** | **''10''** / **''RX''** | Send and receive | |
</WRAP> | </WRAP> |
| |
| |
<callout type="warning" icon="true"> | <callout type="warning" icon="true"> |
When using a Raspberry Pi 4B also add the following lines to your ''config.txt'' to get a human-readable console: | When using a Raspberry Pi with bluetooth as second device also add the following lines to your ''config.txt'': |
<code bash> | <code bash> |
| # disable bluetooth via uart |
dtoverlay=pi3-disable-bt | dtoverlay=pi3-disable-bt |
dtoverlay=pi3-miniuart-bt | dtoverlay=pi3-miniuart-bt |
| dtoverlay=disable-bt |
| dtoverlay=miniuart-bt |
</code> | </code> |
In general there might be issues with newer versions of the Raspberry Pi, therefore consider using an older version as second device. Additionally do not dis- and reconnect to a running console session, otherwise your console might not be readable anymore for this session. | This will disable the bluetooth module, because this may break your serial connection as it also uses the uart console. |
| |
| In general there might be issues with the serial connection, it's recommended to firstly open the serial console on the second Pi and then booting up the CM4. Additionally **do not** dis- and reconnect to a running console session, otherwise your console might not be readable anymore for this session. |
</callout> | </callout> |
| |
Then you can execute the follwing command from the second Pi to connect to your serial console. It doens't matter if you're using an attached keyboard and monitor or a SSH-connection. | Then you can execute the follwing command from the second Pi to connect to your serial console. **It's strongly recommended to use a local attached keyboard and monitor on a Pi that boots to CLI(!) rather than creating the serial connection via SSH / Desktop.** |
<code bash>screen /dev/ttyS0 115200</code> | <code bash>screen /dev/ttyS0 115200</code> |
| (root-permission required!) |
→ you might install ''screen'' befire by running the following command: | → you might install ''screen'' befire by running the following command: |
<code bash>sudo apt install screen</code> | <code bash>sudo apt install screen</code> |
| If ''/dev/ttyS0'' doesn't work, use ''/dev/serial0''. In case you are using a USB2TTL-Card use ''/dev/ttyUSB0''. |
| |
Finally perform the setup of IPFire as usual! | Finally perform the setup of IPFire as usual! |
**Select the 3rd option, that contains ''serial console''!** | **Select the 3rd option, that contains ''serial console''!** |
| |
===== Adjusting interfaces (important!) ===== | ===== Adjusting Interfaces (MAC Addresses) (important!) ===== |
| |
As described also in this [[https://community.ipfire.org/t/rpi-cm4-red-interface-not-available-after-reboot/7119/3|blog post]] in IPFire's official forum, there are assigment issues with the carrier board's NICs. It seems that the second PCIe NIC gets a self-assignet MAC everytime the device boots up. This is followed by the host OS no longer recognizing the NIC. To solve this issue there is a more or less fancy workaround: | As described also in this [[https://community.ipfire.org/t/rpi-cm4-red-interface-not-available-after-reboot/7119/3|blog post]] in IPFire's official forum, there are assigment issues with the carrier board's NICs. It seems that the second PCIe NIC gets a self-assignet MAC everytime the device boots up. This is followed by the host OS no longer recognizing the NIC. To solve this issue there is a more or less fancy workaround here in this wiki: [[linux:linux-tutorials:set-persistent-mac-rtl8111|Set persistent MAC for RTL8111/8168/8411 (r8169) with udev]] (internal link). |
| |
First figure out which NIC causes the error, therefore reboot your machine, login via serial and execute the following command: | |
<code bash>ifconfig -a</code> | |
It will print all ethernet devices, no matter if active or inactive. | |
| |
The output should look like anything of this: no matter if selected the red or the green interface to be on the Pi's built-in NIC: | |
<code bash> | |
eth1: | |
[...] | |
lo: | |
[...] | |
red0: | |
[...] | |
</code> | |
<code bash> | |
eth1: | |
[...] | |
lo: | |
[...] | |
green0: | |
[...] | |
</code> | |
No matter if selected the red or the green interface to be on the Pi's built-in NIC, you will have an "unassigned" ''eth1'' interface, which is the second PCIe NIC. To make your now unassigned interface persistent after future reboots, add ''eth1'' to IPFire's ethernet config: | |
| |
<panel> | |
* **Case 1:** The <color #ed1c24>red</color> interface should be on the second NIC: | |
++++ Show/Hide | | |
<code bash>echo RED_DEV=eth1 >> /var/ipfire/ethernet/settings</code> | |
++++ | |
</panel> | |
| |
<panel> | |
* **Case 2:** The <color #22b14c>green</color> interface should be on the second NIC: | |
++++ Show/Hide | | |
<code bash>echo GREEN_DEV=eth1 >> /var/ipfire/ethernet/settings</code> | |
++++ | |
</panel> | |
| |
Verify your settings by running the following command: | |
<code bash>cat /var/ipfire/ethernet/settings</code> | |
| |
<callout type="warning" icon="true"> | |
Have a closer look at following lines: | |
| |
* ''GREEN_DEV'' | |
* ''GREEN_DESCRIPTION'' | |
* ''RED_DEV'' | |
* ''RED_DESCRIPTION'' | |
| |
**The device whose description starts with ''pci: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411'' should have the ''[...]_DEV'' set to ''[..]_DEV=eth1''.** | |
| |
Example: | |
| |
→ if ''GREEN_DESCRIPTION'' would start with ''pci: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411'', then ''GREEN_DEV'' should be ''GREEN_DEV=eth1'' | |
| |
</callout> | |
| |
Apply your changes either by rebooting or reinitializing the network manager: | It's also recommended to completely shut down again and reboot to verify the changes! |
<code bash>/etc/init.d/network restart</code> | |
| |
---- | ---- |