Le 16/06/2018 à 06:58, Steve Litt a écrit :
Meanwhile, if whatever distro you're working with does weird stuff when
all you want is a hard coded IPV4 address, consider the following
distro-independent shellscript, which can be run at boot and also any
time some foolish daemon thinks it knows more about your desired IP
address than you do:
================================================================
#!/bin/sh
hostname=`grep -v "^\s*#" /etc/hostname | head -n1`
ip link set dev lo up
ip link set dev eno1 down
ip addr add 192.168.100.6/24 dev eno1
ip addr add 192.168.100.106/24 dev eno1
ip link set dev eno1 up
ip route add default via 192.168.100.96
================================================================
The preceding sets the box's IP at 192.168.100.6 with an alias at 106,
and sets the default gateway to 192.168.100.96. The assumed device name
here is eno1. Obviously, you need to modify it to fit your needs, but
after that, you can override the inconveniences almost every distro
throws at you if all you want is a fixed IP address. I've used this
shellscript in several distros.
Thanks for the script, Steve. It gives instructive examples of
using the ip command (I'm still using old ifconfig, shame on me), beside
being a ready-made rescue method.
But I'm afraid unless you uninstall the foolish daemon, it will
undo what your script has done.
Note that, if you want to edit the interfaces file and have it used
to configure the network, you need to install net-tools, which isn't
done by default anymore, and now deserves some hack since it has been
fitted to systemd although systemd doesn't use it. It's the binaries and
script in net-tools which will actually read the interfaces file. And,
of course, you must remove the foolish daemon.
Didier
_______________________________________________
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng