More Related Content
Similar to Proxmox: 建立自己的虛擬主機
Similar to Proxmox: 建立自己的虛擬主機 (20)
Proxmox: 建立自己的虛擬主機
- 13. IP 好少 O_Q
auto
lo
iface
lo
inet
loopback
!
auto
eth0
iface
eth0
inet
static
address
192.168.1.1
netmask
255.255.255.0
gateway
192.168.1.254
post-‐up
echo
1
>
/proc/sys/net/ipv4/conf/eth0/proxy_arp
!
auto
vmbr0
iface
vmbr0
inet
static
address
10.10.10.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
'10.10.10.0/24'
-‐o
eth0
-‐j
MASQUERADE
post-‐down
iptables
-‐t
nat
-‐D
POSTROUTING
-‐s
'10.10.10.0/24'
-‐o
eth0
-‐j
MASQUERADE
#
port
forwarding
post-‐up
iptables
-‐t
nat
-‐A
PREROUTING
-‐i
eth0
-‐p
tcp
-‐-‐dport
10122
-‐j
DNAT
-‐-‐to
10.10.10.101:22
post-‐up
iptables
-‐t
nat
-‐A
PREROUTING
-‐i
eth0
-‐p
tcp
-‐-‐dport
10222
-‐j
DNAT
-‐-‐to
10.10.10.102:22
13
- 14. 只好 port-forwarding
vmbr0 是虛擬機與實體機設定 bridge mode 時共
用的虛擬網卡
host IP 設定為 10.10.10.1 (gateway)
vm IP 設定為 10.10.10.101/255.255.255.0,
gateway 為 10.10.10.1
最後面兩條規則將連線到外部 IP 的 port 10122
重導到內網 10.10.10.101 的 port 22
14
- 17. 建立 OpenVZ container
於 http://pve.proxmox.com/wiki/
Category:Virtual_Appliances 下載 template
設定密碼、網路
收工!
17