Skip to content

Commit

Permalink
Fix netplan configuration approach
Browse files Browse the repository at this point in the history
  • Loading branch information
erelson committed Feb 21, 2019
1 parent e850b7b commit d79d51b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 36 deletions.
22 changes: 4 additions & 18 deletions fetch_system_config/debian/fetch-melodic-config.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -96,29 +96,15 @@ case "$1" in
echo ${udev_line/MAC_ADDRESS/${mac_array[1]}}'"eth0"' >> /etc/udev/rules.d/70-persistent-net.rules
echo ${udev_line/MAC_ADDRESS/${mac_array[0]}}'"eth1"' >> /etc/udev/rules.d/70-persistent-net.rules
fi
# Add netplan to set static IPs
if [[ ! -f /etc/netplan/99-fetch-ethernet.yaml ]]; then
cat << EOF > /etc/netplan/99-fetch-ethernet.yaml
# Fetch research robots require the below configuration for eth1.
# The configuration for eth0 is left to DHCP by default, but can be set to
# another static IP by uncommenting the block below and running `sudo netplan try`.
network:
version: 2
ethernets:
#eth0:
# addresses: [172.42.42.1/24]
# gateway4: 172.42.42.1
eth1:
addresses: [10.42.42.1/24]
gateway4: 10.42.42.1
EOF
fi

# Add netplan to set static ethernet IPs; don't clobber existing modifications
cp -n /etc/netplan/99-fetch-ethernet.yaml.default /etc/netplan/99-fetch-ethernet.yaml

# Setup chrony to allow time jumps on start
if [ ! `grep makestep /etc/chrony/chrony.conf >/dev/null && echo $?` ]; then
echo '
# This lets the time jump at startup
makestep 1.0 100' >>/etc/chrony/chrony.conf
makestep 1.0 100' >> /etc/chrony/chrony.conf
fi

# Disable wifi power management in 18.04
Expand Down
22 changes: 4 additions & 18 deletions fetch_system_config/debian/freight-melodic-config.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -96,29 +96,15 @@ case "$1" in
echo ${udev_line/MAC_ADDRESS/${mac_array[1]}}'"eth0"' >> /etc/udev/rules.d/70-persistent-net.rules
echo ${udev_line/MAC_ADDRESS/${mac_array[0]}}'"eth1"' >> /etc/udev/rules.d/70-persistent-net.rules
fi
# Add netplan to set static IPs
if [[ ! -f /etc/netplan/99-fetch-ethernet.yaml ]]; then
cat << EOF > /etc/netplan/99-fetch-ethernet.yaml
# Fetch research robots require the below configuration for eth1.
# The configuration for eth0 is left to DHCP by default, but can be set to
# another static IP by uncommenting the block below and running `sudo netplan try`.
network:
version: 2
ethernets:
#eth0:
# addresses: [172.42.42.1/24]
# gateway4: 172.42.42.1
eth1:
addresses: [10.42.42.1/24]
gateway4: 10.42.42.1
EOF
fi

# Add netplan to set static ethernet IPs; don't clobber existing modifications
cp -n /etc/netplan/99-fetch-ethernet.yaml.default /etc/netplan/99-fetch-ethernet.yaml

# Setup chrony to allow time jumps on start
if [ ! `grep makestep /etc/chrony/chrony.conf >/dev/null && echo $?` ]; then
echo '
# This lets the time jump at startup
makestep 1.0 100' >>/etc/chrony/chrony.conf
makestep 1.0 100' >> /etc/chrony/chrony.conf
fi

# Disable wifi power management in 18.04
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Fetch research robots require the below configuration for eth1.
# The configuration for eth0 is left to DHCP by default, but can be set to
# another static IP by uncommenting the block below and running `sudo netplan apply`.
network:
version: 2
ethernets:
#eth0:
# addresses: [172.42.42.1/24]
# gateway4: 172.42.42.1
eth1:
addresses: [10.42.42.1/24]
gateway4: 10.42.42.1
EOF

0 comments on commit d79d51b

Please sign in to comment.