Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...



default config


Code Block
titlecode
collapsetrue
ubuntu@ip-10-0-11-132:~$ more /etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    version: 2
    ethernets:
        eth0:
            dhcp4: true
            match:
                macaddress: 0a:0a:b0:22:e4:a8
            set-name: eth0


changes


Code Block
titlechange netplan
ubuntu@ip-10-0-11-132:~$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 0a:0a:b0:22:e4:a8 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 0a:fe:87:e3:4c:de brd ff:ff:ff:ff:ff:ff

>>>> New interface and Mac@: 0a:fe:87:e3:4c:de 

network:
    version: 2
    ethernets:
        eth0:
            dhcp4: true
            match:
                macaddress: 0a:0a:b0:22:e4:a8
            set-name: eth0
        eth1:
            dhcp4: true
            match:
                macaddress: 0a:fe:87:e3:4c:de
            set-name: eth1


Code Block
titlenetplan try
collapsetrue
ubuntu@ip-10-0-11-132:~$ sudo netplan try
Warning: Stopping systemd-networkd.service, but it can still be activated by:
  systemd-networkd.socket
Do you want to keep these settings?


Press ENTER before the timeout to accept the new configuration


Changes will revert in 113 seconds
Configuration accepted.



ubuntu@ip-10-0-11-132:~$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc fq_codel state UP group default qlen 1000
    link/ether 0a:0a:b0:22:e4:a8 brd ff:ff:ff:ff:ff:ff
    inet 10.0.11.132/24 brd 10.0.11.255 scope global dynamic eth0
       valid_lft 3588sec preferred_lft 3588sec
    inet6 fe80::80a:b0ff:fe22:e4a8/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc fq_codel state UP group default qlen 1000
    link/ether 0a:fe:87:e3:4c:de brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.31/24 brd 10.0.2.255 scope global dynamic eth1
       valid_lft 3588sec preferred_lft 3588sec
    inet6 fe80::8fe:87ff:fee3:4cde/64 scope link
       valid_lft forever preferred_lft forever


apply changes
sudo netplan try