找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 38|回复: 2

proxmox 单网卡多IP如何配置?

[复制链接]

38

主题

724

回帖

1652

积分

金牌会员

积分
1652
发表于 2018-6-8 10:33:33 | 显示全部楼层 |阅读模式
多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
回复

使用道具 举报

44

主题

386

回帖

962

积分

高级会员

积分
962
发表于 2018-6-8 16:46:04 | 显示全部楼层


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

使用道具 举报

78

主题

242

回帖

760

积分

高级会员

积分
760
发表于 2018-6-8 10:54:07 | 显示全部楼层

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

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

大佬proxmox,好用 稳定不
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Discuz! X

GMT+8, 2025-4-20 00:37 , Processed in 0.015549 second(s), 3 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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