0

I'm trying to configure my Raspberry Pi 4B running Ubuntu 18.04 with a static IP address (to then configure a DHCP server) and use the WiFi for internet traffic (routing any clients connecting to the DHCP through to the WiFi connection) but I cannot define a static IP address for the LAN, using netplan I have the config: `network: #LAN connection for ipv4 DHCP server version: 2 renderer: networkd ethernets: eth0 addresses: - 10.0.0.1/24 gateway4: 10.0.0.1 nameservers: addresses: [8.8.8.8, 4.4.4.4.4]

    # LAN connection ipv6 - using for DHCP Server
    version: 2
    renderer: networkd
    ethernets:
            eth0:
    addresses:
            - 2001:1::1/64
    gateway6: 2001:1::2
    nameservers:
            addresses: [8.8.8.8, 4.4.4.4]

    # wifi connection
    wifis:
            wlan0
    dhcp4: true
    dhcp6: true
    access-points:
            "SSID-name"
    password: "WiFi Password"

I keep getting indentation errors when I try to apply the plan. The indentation is that which is created when I manually type in the details.

sudo netplan -debug generate
/etc/netplan/50-cloud-init.yaml:11:17: Error in network definition: expected mapping (check indentation)
                eth0
                ^

1 Answers1

0

This is my currently working netplan file. I've managed also to set the WiFi as the default internet connection which is what I want in order to use the eth0 connection for the DHCP server (once that's installed).

    network:
    # wifi connection
    version: 2
    renderer: NetworkManager
    wifis:
            wlan0:
                    dhcp4: true
                    dhcp6: true
                    access-points:
                            "SSID-Name":
                                    password: "password"

    #LAN connection for ipv4 DHCP server
    version: 2
    renderer: NetworkManager
    ethernets:
            eth0:
                    dhcp4: no
                    addresses:
                            - 10.0.0.1/24
                    nameservers:
                            addresses: [8.8.8.8,4.4.4.4]

    # LAN connection ipv6 - using for DHCP Server
    version: 2
    renderer: NetworkManager
    ethernets:
            eth0:
                    dhcp6: no
                    addresses:
                         - 2001:1::1/64
                    nameservers:
                            addresses: [8.8.8.8,4.4.4.4]

I also opted to set NetworkManager as the renderer because I plan to use the GUI on this Pi so will be able to see at a glance what the WiFi status is.