全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 20721|回复: 5

proxmox 单网卡多IP如何配置?

[复制链接]
Admins 该用户已被删除
发表于 2018-6-8 10:33:33 | 显示全部楼层 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
发表于 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 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2018-6-8 15:49:43 | 显示全部楼层
如果是online hz那种mac自动分配ip的话可以看看我写的https://by.cx/2018/05/10/hetzner-proxmox/
发表于 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,好用 稳定不
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-3-19 18:55 , Processed in 0.070708 second(s), 11 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表