This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Network Config

Giving your Pi information to connect to the network

    Setting up network interfaces

    With cloud-init (first-time setup)

    The preferred way to setup network interfaces is by providing them in the network-config file read by cloud-init when first setting up the Pi.

    An example is shown below:

    # This file contains a netplan-compatible configuration which cloud-init will
    # apply on first-boot (note: it will *not* update the config after the first
    # boot). Please refer to the cloud-init documentation and the netplan reference
    # for full details:
    #
    # https://cloudinit.readthedocs.io/en/latest/topics/network-config.html
    # https://cloudinit.readthedocs.io/en/latest/topics/network-config-format-v2.html
    # https://netplan.io/reference
    
    version: 2
    ethernets:
      eth0:  # Your ethernet name.
        dhcp4: no
        addresses: [192.168.11.137/24]
        gateway4: 192.168.11.1
        nameservers:
          addresses: [8.8.8.8,8.8.4.4]
    wifis:
      renderer: networkd
      wlan0:
        dhcp4: true
        optional: true
        access-points:
          "<YOUR WIFI SSID HERE>":
            password: "<YOUR WIFI PASSWORD HERE>"
    

    The above configuration sets up a static IP over the ethernet interface. It also configures 192.168.11.1 as the default gateway. This allows for sharing an internet connection from a computer over this interface if desired.

    The configuration also provides an SSID and password for a WiFi network. In practice, we configure this to the settings for a phone hotspot that can be used to get internet when WiFi is not otherwise available. This is also a simpler setup for getting the Pi on the internet when needed.

    Reconfiguring with netplan

    By default, network interfaces are configured with netplan. See the netplan documentation for more details.

    By default, the cloud-init script sets up a static IP of 192.168.11.137, but you could choose to configure this to something different for each payload box.

    Our usual way of connecting is by plugging an ethernet cable into the Pi and connecting it to a laptop. You can read about all the networking options here.

    Back to Raspberry Pi Setup or continue to Connecting the SDR.