Skip to content

Commit

Permalink
Add Ubuntu 24.04 in cloud-init
Browse files Browse the repository at this point in the history
  • Loading branch information
svenja11 committed Aug 21, 2024
1 parent c0ecb4f commit 90d5ed2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
15 changes: 7 additions & 8 deletions tutorials/how-to-set-up-nat-for-cloud-networks/01.de.md
Original file line number Diff line number Diff line change
Expand Up @@ -486,25 +486,24 @@ Wenn Sie die Routen nicht manuell hinzufügen möchten, können Sie beim Erstell
<details>
<summary>Ubuntu 22.04</summary>
<summary>Ubuntu 22.04 / 24.04</summary>
* **NAT-Server**
> Ersetzen Sie `10.0.0.0/16` falls nötig.
```bash
#cloud-config
packages:
- ifupdown
package_update: true
package_upgrade: true
runcmd:
- |
cat <<'EOF' >> /etc/network/interfaces
auto eth0
iface eth0 inet dhcp
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/16' -o eth0 -j MASQUERADE
cat <<'EOF' >> /etc/networkd-dispatcher/routable.d/10-eth0-post-up
#!/bin/bash
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s '10.0.0.0/16' -o eth0 -j MASQUERADE
EOF
chmod +x /etc/networkd-dispatcher/routable.d/10-eth0-post-up
- reboot
```
Expand Down
15 changes: 7 additions & 8 deletions tutorials/how-to-set-up-nat-for-cloud-networks/01.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -486,25 +486,24 @@ If you don't want to setup the routes manually, you can use cloud-init and add t
<details>
<summary>Ubuntu 22.04</summary>
<summary>Ubuntu 22.04 / 24.04</summary>
* **NAT server**
> Replace `10.0.0.0/16` as needed.
```bash
#cloud-config
packages:
- ifupdown
package_update: true
package_upgrade: true
runcmd:
- |
cat <<'EOF' >> /etc/network/interfaces
auto eth0
iface eth0 inet dhcp
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/16' -o eth0 -j MASQUERADE
cat <<'EOF' >> /etc/networkd-dispatcher/routable.d/10-eth0-post-up
#!/bin/bash
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s '10.0.0.0/16' -o eth0 -j MASQUERADE
EOF
chmod +x /etc/networkd-dispatcher/routable.d/10-eth0-post-up
- reboot
```
Expand Down

0 comments on commit 90d5ed2

Please sign in to comment.