Content-Length: 72281 | pFad | http://dev.to/sertxudev/netplan-set-static-ip-address-2kdh

10 Netplan: Set static IP address - DEV Community

Forem

Cover image for Netplan: Set static IP address
Sergio Peris
Sergio Peris

Posted on • Originally published at sertxu.dev

Netplan: Set static IP address

In order to set a static IP address to an interface using Netplan, we have to edit the desired Netplan yaml file.

Here is an example for configuring the interface eth0 with a static IP address.

network:
    version: 2
    renderer: networkd
    ethernets:
        eth0:
            dhcp4: false
            dhcp6: false
            addresses:
                - 192.168.1.100/24
            routes:
                - to: default
                  via: 192.168.1.1
            nameservers:
                addresses: [1.1.1.1, 8.8.8.8]
Enter fullscreen mode Exit fullscreen mode

Here we're setting the IP 192.168.1.100 as the static IP, 192.168.1.1 as the gateway, 1.1.1.1 and 8.8.8.8 as the DNS servers.

To apply the changes, we should run the command:

netplan apply
Enter fullscreen mode Exit fullscreen mode

Top comments (0)









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://dev.to/sertxudev/netplan-set-static-ip-address-2kdh

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy