Skip to content

Instantly share code, notes, and snippets.

@sutlxwhx
Last active August 26, 2025 05:09
Show Gist options
  • Select an option

  • Save sutlxwhx/176198f9ffbdd40eec178817b3d9b988 to your computer and use it in GitHub Desktop.

Select an option

Save sutlxwhx/176198f9ffbdd40eec178817b3d9b988 to your computer and use it in GitHub Desktop.

Revisions

  1. sutlxwhx revised this gist Aug 21, 2018. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -61,12 +61,12 @@ Now we will need to save this file and enable the custom network interface that
    ```shell
    ifup vmbr1
    ```
    If you want to use RDP for your virtual Windows OS you need to create this port forwading rule for a default 3389 Windows RDP port:
    If you want to use RDP for your virtual Windows OS machine you need to create this port forwading rule for a default 3389 Windows RDP port:
    ```shell
    iptables -t nat -A PREROUTING -i eno1 -p tcp --dport 13389 -j DNAT --to 192.168.1.2:3389
    ```
    Repeat that as a template to any other port / application you need. I just appended 1 to the 3389 port and now I can acess my Windows virtual machine at $IP:13389
    <br/>If you want to use RDP for your virtual Ubuntu OS you need to setup the neccessary environment:
    Repeat that as a template for any other port / application you need. I just appended 1 to the 3389 port and now I can acess my Windows virtual machine at $IP:13389
    <br/>If you want to use RDP for your virtual Ubuntu OS machine you need to setup the neccessary environment:
    ```shell
    apt-get -y update
    apt-get -y install openssh-server
  2. sutlxwhx revised this gist Aug 21, 2018. 1 changed file with 26 additions and 26 deletions.
    52 changes: 26 additions & 26 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    ## Introduction

    This tuturial will help you configure network your new Proxmox istallation.
    <br/>Be aware Proxmox configuration was made using [this](https://gist.github.com/sutlxwhx/e3b828dd8d18a04c693f4e5c7688e582) tutorial.
    This tuturial will help you configure network for your fresh Proxmox istallation.
    <br/>Be aware that Proxmox configuration was made using [this](https://gist.github.com/sutlxwhx/e3b828dd8d18a04c693f4e5c7688e582) tutorial.

    ## Installation
    Backup your current /etc/network/interfaces using this command:
    @@ -20,6 +20,7 @@ iface lo inet loopback
    iface lo inet6 loopback

    # The followind three things will be here somewhere when you open this file for the first time.
    # Depending on your server provider you may not be needed to change anything in this section
    # $IP - your IP address.
    # $GT - your network gateway.
    # $NT - your network netmask.
    @@ -28,16 +29,21 @@ iface lo inet6 loopback

    auto eno1
    iface eno1 inet static
    address $IP
    netmask $NT
    gateway $GT
    up route add -net $RT netmask $NT gw $GT dev eno1
    address $IP
    netmask $NT
    gateway $GT
    up route add -net $RT netmask $NT gw $GT dev eno1

    # Here you will have your own default IPv6 settings
    # If you don't need to customize IPv6 access for your Proxmox then leave the default settings

    iface eno1 inet6 static
    address aaaa:bbb:ccc:ddd::2
    netmask 64
    gateway fe80::1
    address aaaa:bbb:ccc:ddd::2
    netmask 64
    gateway eeee::1

    # In the following section we will setup new network interface for our virtual machines
    # I used it with Intel network adapter for my Windows virtual machine in Proxmox

    auto vmbr1
    iface vmbr1 inet static
    @@ -50,30 +56,24 @@ post-up echo 1 > /proc/sys/net/ipv4/ip_forward
    post-up iptables -t nat -A POSTROUTING -s '192.168.1.0/24' -o eno1 -j MASQUERADE
    post-down iptables -t nat -D POSTROUTING -s '192.168.1.0/24' -o eno1 -j MASQUERADE
    ```
    Now we will need to enable custom network interface that we created earlier.
    <br/>Use the following command to to this:
    Now we will need to save this file and enable the custom network interface that we created earlier.
    <br/>Use the following command to do this:
    ```shell
    ifup vmbr1
    ```
    Then we will need to make port forwarding rules to each of yours virtual machines:
    If you want to use RDP for your virtual Windows OS you need to create this port forwading rule for a default 3389 Windows RDP port:
    ```shell
    iptables -t nat -A PREROUTING -i eno1 -p tcp --dport 13389 -j DNAT --to 192.168.1.2:3389
    iptables -t nat -A PREROUTING -i eno1 -p tcp --dport 23389 -j DNAT --to 192.168.1.3:3389
    #ssh
    iptables -t nat -A PREROUTING -i eno1 -p tcp --dport 20022 -j DNAT --to 192.168.1.3:22
    #nginx
    iptables -t nat -A PREROUTING -i eno1 -p tcp --dport 20080 -j DNAT --to 192.168.1.3:80
    #mysql
    iptables -t nat -A PREROUTING -i eno1 -p tcp --dport 23306 -j DNAT --to 192.168.1.3:3306
    ```
    Repeat that as a template to any other port / application you need. I just appended 1 to the 3389 port and now I can acess my Windows virtual machine at $IP:13389
    <br/>If you want to use RDP for your virtual Ubuntu OS you need to setup the neccessary environment:
    ```shell
    apt-get -y update
    apt-get -y install openssh-server
    apt-get -y install xrdp
    apt-get -y install mate-core mate-desktop-environment mate-notification-daemon
    # Дописать nano /etc/xrdp/startwm.sh в конец mate-session
    echo -e "mate-session" >> /etc/xrdp/startwm.sh
    service xrdp restart
    #https://abc-server.com/ru/blog/administration/install-xrdp/
    iptables -t nat -A PREROUTING -i eno1 -p tcp --dport 25901 -j DNAT --to 192.168.1.4:5901
    iptables -t nat -A PREROUTING -i eno1 -p tcp --dport 35901 -j DNAT --to 192.168.1.4:5901
    iptables -t nat -A PREROUTING -i eno1 -p tcp --dport 33389 -j DNAT --to 192.168.1.3:3389
    iptables -t nat -A PREROUTING -i eno1 -p tcp --dport 43389 -j DNAT --to 192.168.1.4:3389
    ```
    iptables -t nat -A PREROUTING -i eno1 -p tcp --dport 23389 -j DNAT --to 192.168.1.4:3389
    ```
    Here I appended 2 to the 3389 port so my Ubuntu OS was accessible at $IP:23399
  3. sutlxwhx revised this gist Aug 21, 2018. No changes.
  4. sutlxwhx created this gist Aug 21, 2018.
    79 changes: 79 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,79 @@
    ## Introduction

    This tuturial will help you configure network your new Proxmox istallation.
    <br/>Be aware Proxmox configuration was made using [this](https://gist.github.com/sutlxwhx/e3b828dd8d18a04c693f4e5c7688e582) tutorial.

    ## Installation
    Backup your current /etc/network/interfaces using this command:
    ```shell
    cp /etc/network/interfaces /etc/network/interfaces.backup
    ```
    Download it to your local machine. You may need it for debugging later.
    <br/>Then you need to configure your /etc/network/interfaces as in the following example:
    ```shell
    ### Hetzner Online GmbH installimage

    source /etc/network/interfaces.d/*

    auto lo
    iface lo inet loopback
    iface lo inet6 loopback

    # The followind three things will be here somewhere when you open this file for the first time.
    # $IP - your IP address.
    # $GT - your network gateway.
    # $NT - your network netmask.
    # $RT - you network route. It consist of first three values from your IP and the last one is used from your netmask.
    # For example if you have IP 111.2.33.4 and netmask 255.255.255.666 your RT will look like 111.2.33.666

    auto eno1
    iface eno1 inet static
    address $IP
    netmask $NT
    gateway $GT
    up route add -net $RT netmask $NT gw $GT dev eno1

    # Here you will have your own default IPv6 settings
    iface eno1 inet6 static
    address aaaa:bbb:ccc:ddd::2
    netmask 64
    gateway fe80::1

    auto vmbr1
    iface vmbr1 inet static
    address 192.168.1.1
    netmask 255.255.255.0
    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.1.0/24' -o eno1 -j MASQUERADE
    post-down iptables -t nat -D POSTROUTING -s '192.168.1.0/24' -o eno1 -j MASQUERADE
    ```
    Now we will need to enable custom network interface that we created earlier.
    <br/>Use the following command to to this:
    ```shell
    ifup vmbr1
    ```
    Then we will need to make port forwarding rules to each of yours virtual machines:
    iptables -t nat -A PREROUTING -i eno1 -p tcp --dport 13389 -j DNAT --to 192.168.1.2:3389
    iptables -t nat -A PREROUTING -i eno1 -p tcp --dport 23389 -j DNAT --to 192.168.1.3:3389
    #ssh
    iptables -t nat -A PREROUTING -i eno1 -p tcp --dport 20022 -j DNAT --to 192.168.1.3:22
    #nginx
    iptables -t nat -A PREROUTING -i eno1 -p tcp --dport 20080 -j DNAT --to 192.168.1.3:80
    #mysql
    iptables -t nat -A PREROUTING -i eno1 -p tcp --dport 23306 -j DNAT --to 192.168.1.3:3306
    ```shell
    apt-get -y update
    apt-get -y install openssh-server
    apt-get -y install xrdp
    apt-get -y install mate-core mate-desktop-environment mate-notification-daemon
    # Дописать nano /etc/xrdp/startwm.sh в конец mate-session
    service xrdp restart
    #https://abc-server.com/ru/blog/administration/install-xrdp/
    iptables -t nat -A PREROUTING -i eno1 -p tcp --dport 25901 -j DNAT --to 192.168.1.4:5901
    iptables -t nat -A PREROUTING -i eno1 -p tcp --dport 35901 -j DNAT --to 192.168.1.4:5901
    iptables -t nat -A PREROUTING -i eno1 -p tcp --dport 33389 -j DNAT --to 192.168.1.3:3389
    iptables -t nat -A PREROUTING -i eno1 -p tcp --dport 43389 -j DNAT --to 192.168.1.4:3389
    ```