Ubuntu 20.04 LTS enable Routing & NAT

sysctl net.ipv4.ip_forward
sysctl -w net.ipv4.ip_forward=1

vi /lib/systemd/system/rc-local.service
[Install]
WantedBy=multi-user.target
Alias=rc-local.service

vi /etc/rc.local
#!/bin/sh -e
sysctl -w net.ipv4.ip_forward=1

chmod +x /etc/rc.local

systemctl enable rc-local
systemctl start rc-local

NAT
vi /etc/rc.local
iptables -t nat -A POSTROUTING -j MASQUERADE

Comments

No comments yet. Why don’t you start the discussion?

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

*