Skip to content

P4Pi Configuration

signorello edited this page Aug 23, 2022 · 14 revisions

P4Pi Configuration

Connecting to P4Pi through WiFi

P4Pi will come up as a hotspot as soon as you turn it on, when using an unmodified image of P4Pi.

The initial wireless network name (SSID) will be p4pi and the initial password will be raspberry (You should change this password to avoid security vulnerabilities).

It is possible to configure P4Pi using either ssh or its web interface.

P4Pi Web Interface

To connect to P4Pi's web interface, use your browser to access the url http://192.168.4.1, the default user is pi and the initial password is raspberry.

In addition to setting certain configuration options for P4Pi, the web interface allows you to upload, compile and run a P4 program on any of the available P4 targets.

SSH

It is possible to connect to P4Pi using ssh and port 22.

The default user is pi and the initial password is raspberry. You should change the password after the first login, using the passwd command.

ssh pi@192.168.4.1

Access Point

The access point configuration can be updated either via the "Network->Wireless Access Point" page of the web interface or via ssh by editing /etc/hostapd/hostapd.conf and restarting the hostapd service.

systemctl restart hostapd.service

DHCP

P4Pi runs a DHCP daemon (dnsmasq) to assign IP addresses to devices connected through WiFi.

By default, P4Pi has the following configuration stored in /etc/dnsmasq.d/p4pi.conf.

resolv-file=/etc/resolv.conf
interface=br0
dhcp-range=set:br0,192.168.4.2,192.168.4.20,255.255.255.0,24h
dhcp-lease-max=160
domain=p4pi
address=/gw.p4pi/192.168.4.1
server=1.1.1.1

Direct Ethernet connection

  1. Connect your Raspberry Pi to a PC with Ethernet.
  2. On Linux, select the "Shared to other computers" option

Screenshot

  1. On your PC you can find the IP address associated to the Raspberry Pi using arp-scan
sudo arp-scan -l -I <Ethernet interface>
  1. You can connect to the Raspberry Pi ssh as follows:
ssh pi@<IP address>

Deploying a Custom P4 Program

You can upload your P4 program as a single P4 file via the P4Pi web interface. If your program consists or multiple files or for any other reason, you can deploy and run your custom program manually as described in Start a new P4 project on P4Pi.

Clone this wiki locally