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.
18 lines
704 B
Plaintext
18 lines
704 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 NAT
|
|
- echo '#!/bin/bash' > /etc/networkd-dispatcher/routable.d/10-eth0-post-up
|
|
- echo 'echo 1 > /proc/sys/net/ipv4/ip_forward' >> /etc/networkd-dispatcher/routable.d/10-eth0-post-up
|
|
- echo 'iptables -t nat -A POSTROUTING -s ${network_ip_range} -o eth0 -j MASQUERADE' >> /etc/networkd-dispatcher/routable.d/10-eth0-post-up
|
|
- chmod +x /etc/networkd-dispatcher/routable.d/10-eth0-post-up
|
|
- /etc/networkd-dispatcher/routable.d/10-eth0-post-up
|