Skip to content

Instantly share code, notes, and snippets.

@z3nth10n
Created July 23, 2019 11:22
Show Gist options
  • Select an option

  • Save z3nth10n/55cf273a7c084ce4425f38390d04597f to your computer and use it in GitHub Desktop.

Select an option

Save z3nth10n/55cf273a7c084ce4425f38390d04597f to your computer and use it in GitHub Desktop.

Revisions

  1. z3nth10n created this gist Jul 23, 2019.
    14 changes: 14 additions & 0 deletions etc_network_interfaces
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    auto vmbr1
    iface vmbr1 inet static
    address 192.168.xx.xx
    netmask 24
    bridge-ports none
    bridge-stp off
    bridge-fd 0
    post-up echo 1 > /proc/sys/net/ipv4/ip_forward
    post-up iptables -t nat -A POSTROUTING -s '192.168.xx.0/24' -o vmbr0 -j MASQUERADE
    post-down iptables -t nat -D POSTROUTING -s '192.168.xx.0/24' -o vmbr0 -j MASQUERADE
    post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 192.168.xx.10:80
    post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 192.168.xx.10:80
    post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 2222 -j DNAT --to 192.168.xx.10:22
    post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 2222 -j DNAT --to 192.168.xx.10:22