Set nameserver for static IPs

This commit is contained in:
Joshua Boniface 2023-09-01 15:41:55 -04:00
parent 04c195e8b5
commit 9a7915e70c
1 changed files with 7 additions and 0 deletions

View File

@ -125,6 +125,9 @@ case ${target_netformat} in
formatted_ipaddr="$( sipcalc ${target_ipaddr} | grep -v '(' | awk '/Host address/{ print $NF }' )" formatted_ipaddr="$( sipcalc ${target_ipaddr} | grep -v '(' | awk '/Host address/{ print $NF }' )"
formatted_netmask="$( sipcalc ${target_ipaddr} | grep -v '(' | awk '/Network mask/{ print $NF }' )" formatted_netmask="$( sipcalc ${target_ipaddr} | grep -v '(' | awk '/Network mask/{ print $NF }' )"
target_interfaces_block="auto ${target_interface}\niface ${target_interface} inet ${target_netformat}\n\taddress ${formatted_ipaddr}\n\tnetmask ${formatted_netmask}\n\tgateway ${target_defgw}" target_interfaces_block="auto ${target_interface}\niface ${target_interface} inet ${target_netformat}\n\taddress ${formatted_ipaddr}\n\tnetmask ${formatted_netmask}\n\tgateway ${target_defgw}"
cat <<EOF >/etc/resolv.conf
nameserver 8.8.8.8
EOF
;; ;;
'dhcp') 'dhcp')
dhclient ${target_interface} >&2 dhclient ${target_interface} >&2
@ -363,6 +366,10 @@ echo -n "Setting hostname... "
echo "${target_hostname}" | tee ${target}/etc/hostname >&2 echo "${target_hostname}" | tee ${target}/etc/hostname >&2
echo "done." echo "done."
echo -n "Setting resolv.conf... "
echo "nameserver 8.8.8.8" | tee ${target}/etc/resolv.conf >&2
echo "done."
echo -n "Installing GRUB bootloader... " echo -n "Installing GRUB bootloader... "
mount --bind /dev ${target}/dev >&2 mount --bind /dev ${target}/dev >&2
mount --bind /dev/pts ${target}/dev/pts >&2 mount --bind /dev/pts ${target}/dev/pts >&2