1

I'm using Ubuntu for my OS and I'm struggling to set my host name and hosts to a mac address automatically any help on this would be great.

NAME=$GATEWAY_MAC| sed s/://g
hostnamectl set-hostname $NAME
sed -i '2d' /etc/hosts
ed /etc/hosts <<-'EOF'
/127.0.0.1/a 127.0.1.1 $NAME 
. wq
EOF
cat /etc/hostname cat /etc/hosts
1
  • the mac tag is specifically for Apple computers running Ubuntu, not for mac addresses. You can see this in the tag wiki for mac (or if you hover over the tag).
    – Esther
    Jul 15, 2022 at 17:08

0

You must log in to answer this question.

Browse other questions tagged .