I want to use port 22 for my git-server, therefore I have to make this port free for use of kubernetes. This change allows this, so when I want to connect to the host-machines I'll use port 1022.
22 lines
813 B
Plaintext
22 lines
813 B
Plaintext
#cloud-config
|
|
packages:
|
|
- curl
|
|
users:
|
|
- name: cluster
|
|
shell: /bin/bash
|
|
runcmd:
|
|
# setup ssh over port 1022 instead of 22
|
|
- sed -i /etc/ssh/sshd_config -e 's/^#\{,1\}\( *Port\) [0-9]\+$/\1 1022/'
|
|
- systemctl daemon-reload
|
|
- systemctl restart ssh.socket
|
|
# configure correct routing via NAT
|
|
- ip route add default via ${network_gateway}
|
|
- NIC=$(ifconfig | grep -q enp7s0 && echo enp7s0 || echo ens10)
|
|
- echo "[Match]" > /etc/systemd/network/10-$NIC.network
|
|
- echo "Name=$NIC" >> /etc/systemd/network/10-$NIC.network
|
|
- echo "[Network]" >> /etc/systemd/network/10-$NIC.network
|
|
- echo "DHCP=yes" >> /etc/systemd/network/10-$NIC.network
|
|
- echo "Gateway=${network_gateway}" >> /etc/systemd/network/10-$NIC.network
|
|
- sed -e "s/#DNS=/DNS=${dns_servers}/" -i /etc/systemd/resolved.conf
|
|
- systemctl restart systemd-resolved
|