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
                ^
  • Netplan is very specific about indentation. It works with the indentation IT wants and not with the indentation YOU want. I suggest that you refer to the provided examples here and amend your yaml file accordingly: netplan.io/examples Welcome to Ask Ubuntu. – chili555 Mar 20 at 15:34
  • I was referring to netplan.io/examples (one of the first places I looked for info) and it wasn't very helpful. All indentations were created whenever I hit the 'enter' key and began typing the new line. I've finally managed to create a working config. I had a few issues trying to get the WiFi to be the default network configuration but have resolved that also. I'll see if I can upload my working netplan file. – cybernyte Mar 20 at 15:50
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.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.