filmov
tv
VirtualBox For Development #3 - Forward Akses Internet
Показать описание
Ketika menggunakan linux, perlu untuk membuat rules packet filtering pada IPTables agar OS dalam VirtualBox bisa mendapatkan akses internet yang berasal dari mesin. Dibawah ini adalah isi file terkait dari penjelasan video.
#!/bin/sh -e
iptables -A FORWARD -o ppp0 -i enp0s25 -s 10.20.30.0/24 -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -o wlp4s0 -i enp0s25 -s 10.20.30.0/24 -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -F POSTROUTING
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o wlp4s0 -j MASQUERADE
exit 0
-----------------------------------------------------------------------------------------------------------
[Unit]
[Service]
Type=forking
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
-----------------------------------------------------------------------------------------------------------
Debian:
VirtualBox:
#!/bin/sh -e
iptables -A FORWARD -o ppp0 -i enp0s25 -s 10.20.30.0/24 -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -o wlp4s0 -i enp0s25 -s 10.20.30.0/24 -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -F POSTROUTING
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o wlp4s0 -j MASQUERADE
exit 0
-----------------------------------------------------------------------------------------------------------
[Unit]
[Service]
Type=forking
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
-----------------------------------------------------------------------------------------------------------
Debian:
VirtualBox: