Admins 发表于 2018-6-8 10:33:33

ahao358 发表于 2018-6-8 16:46:04

多IP服务器通过NAT共享网络
以下配置实现3个外网IP 11.11.11.11、22.22.22.22、33.33.33.33分别通过不同的内网网段 192.168.X.1 进行共享网络。


auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 11.11.11.11
        netmask 255.255.255.0
        gateway 11.11.11.1

auto eth0:1
iface eth0:1 inet static
        address 22.22.22.22
        netmask 255.255.255.0
        gateway 22.22.22.1

auto eth0:2
iface eth0:2 inet static
        address 33.33.33.33
        netmask 255.255.255.0
        gateway 33.33.33.1

auto vmbr0
#private sub network
iface vmbr0 inet static
        address 192.168.0.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.0.0/24 -j SNAT --to-source 11.11.11.11
        post-down iptables -t nat -D POSTROUTING -s 192.168.0.0/24 -j SNAT --to-source 11.11.11.11

auto vmbr1
#private sub network
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 -j SNAT --to-source 22.22.22.22
        post-down iptables -t nat -D POSTROUTING -s 192.168.1.0/24 -j SNAT --to-source 22.22.22.22

auto vmbr2
#private sub network
iface vmbr2 inet static
        address 192.168.2.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.2.0/24 -j SNAT --to-source 33.33.33.33
        post-down iptables -t nat -D POSTROUTING -s 192.168.2.0/24 -j SNAT --to-source 33.33.33.33
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 11.11.11.11
        netmask 255.255.255.0
        gateway 11.11.11.1

auto eth0:1
iface eth0:1 inet static
        address 22.22.22.22
        netmask 255.255.255.0
        gateway 22.22.22.1

auto eth0:2
iface eth0:2 inet static
        address 33.33.33.33
        netmask 255.255.255.0
        gateway 33.33.33.1

auto vmbr0
#private sub network
iface vmbr0 inet static
        address 192.168.0.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.0.0/24 -j SNAT --to-source 11.11.11.11
        post-down iptables -t nat -D POSTROUTING -s 192.168.0.0/24 -j SNAT --to-source 11.11.11.11

auto vmbr1
#private sub network
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 -j SNAT --to-source 22.22.22.22
        post-down iptables -t nat -D POSTROUTING -s 192.168.1.0/24 -j SNAT --to-source 22.22.22.22

auto vmbr2
#private sub network
iface vmbr2 inet static
        address 192.168.2.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.2.0/24 -j SNAT --to-source 33.33.33.33
        post-down iptables -t nat -D POSTROUTING -s 192.168.2.0/24 -j SNAT --to-source 33.33.33.33


多单网卡多IP共享给小鸡的,具体请看:https://www.ahao.me/archives/1136

suzizi 发表于 2018-6-8 10:54:07

mulincheng8 发表于 2018-6-8 10:58:05

oldj 发表于 2018-6-8 15:49:43

yc011t 如果是online hz那种mac自动分配ip的话可以看看我写的https://by.cx/2018/05/10/hetzner-proxmox/

coolsd 发表于 2018-6-8 16:16:09

oldj 发表于 2018-6-8 15:49
如果是online hz那种mac自动分配ip的话可以看看我写的https://by.cx/2018/05/10/hetzner-proxmox/ ...

大佬proxmox,好用 稳定不
页: [1]
查看完整版本: proxmox 单网卡多IP如何配置?