set static IP in network hook

Kostas Katsaros kostas at nomail.gr
Sun Jan 23 13:36:42 CET 2022


Hi there,

This is quite an old tutorial, but was my starting point too so I'm happy to help! :-)
Try to follow the latest official instructions for the server/client installation, use official repositories for keeping your software current etc, rather than relying in obsolete hacks (I know, this tutorial is still one of few around...).

Given that, and for the current Mandos release (1.8.14), I think you need to fix the client configuration. This is what I use to wake the one and only encrypted DHCP server in my network:
#####################
root at server.example.com:/etc/mandos/network-hooks.d # cat emp6s0.sh 
# ...
# Exit immediately if a command exits with a non-zero status
#set -e

do_start(){
ip link set enp6s0 up
sleep 5
ipconfig 192.168.1.99::192.168.1.1:255.255.255.0:server.example.com:enp6s0:none
sleep 2
}

do_stop(){
ip addr flush dev enp6s0
sleep 2
ip link set enp6s0 down
}

case "${MODE:-$1}" in
start|stop)
do_"${MODE:-$1}"
;;
esac
#####################

After that, you need to issue:
# update-initramfs -u

Please, note:
1. enp6s0 is my main (physical) network interface, yours could be different so you need to adapt the text.
2. The IP 192.168.1.99 is different from my baremetal server IP (f.i. 192.168.1.100), in order not to deal with a hanging IP for some seconds.
3. My OS is Proxmox VE (based on Debian 11). Proxmox heavily changes the network configuration in order to fit with their goals, so I hope those changes don't affect your setup.

Also, have in mind that I'm not a network administrator, I just share my working conf. I would feel more safe if someone with more experience in networks review this and make remarks.

Hope this help!
-- 
K.

On Κυριακή, 23 Ιανουαρίου 2022 1:05:46 Μ.Μ. EET Mahmoud Orabi wrote:
> hi dear ,
> iam trying to set mandos for WAN connection
> using this tutorial
> 
> https://blog.boyeau.com/booting-an-unattended-full-disk-encrypted-server-ubuntu-server-16-04-setup-with-mandos/
> 
> every thing working fine with dhcp
> but i want to change the network-hook to static IP
> 
> i cannot configure the code
> 
> any help
> thanks,
> yours mahmoud
> 




More information about the Mandos-Dev mailing list