Skip to content

Instantly share code, notes, and snippets.

@chihchun
Last active April 17, 2018 11:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chihchun/d6bca207df50ccdbd9a1cc30d1b47d0e to your computer and use it in GitHub Desktop.
Save chihchun/d6bca207df50ccdbd9a1cc30d1b47d0e to your computer and use it in GitHub Desktop.
Static IP settings in Ubuntu Core
% echo "unit b\nprint" | parted pc.img
WARNING: You are not superuser. Watch out for permissions.
GNU Parted 3.2
Using /home/chihchun/workspace/canonical/snappy/sampleimage/pc.img
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit b
(parted) print
Model: (file)
Disk /home/chihchun/workspace/canonical/snappy/sampleimage/pc.img: 4294967296B
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1048576B 2097151B 1048576B BIOS Boot bios_grub
2 2097152B 54525951B 52428800B fat32 EFI System boot, esp
3 54525952B 785576447B 731050496B ext4 writable
% sudo mount -o loop,offset=54525952 pc.img /mnt
% sudo mkdir -p /mnt/system-data/etc/netplan
% sudo tee /mnt/system-data/etc/netplan/00-snapd-config.yaml <<EOF
network:
version: 2
ethernets:
eth0:
addresses: [192.168.0.1/24]
nameservers:
addresses: [1.1.1.1]
eth1:
addresses: []
dhcp4: true
EOF
% sudo umount /mnt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment