在ROS上设置多个公网IP+单网关
网吧或者企业的朋友都有自己的服务器希望外面不能直接攻击到自己的核心网络所以一般向ISP申请了多个公网的IP
这样的情况下,1个ROS如何去做到?
首先交代1下试验的环境
2个公网IP (10.0.0.216 and 10.0.0.217)
完全影射内网1个地址 192.168.0.4 到其中1个公网IP 10.0.0.216
而另外1个公网的IP 10.0.0.217 给ROS本身做地址伪装用。
步骤如下
1. 添加 10.0.0.216/24 and 10.0.0.217/24 地址给外网的网卡
把 192.168.0.254/24 添加到本地网卡:
ip address> add address=10.0.0.216/24 interface=Public
ip address> add address=10.0.0.217/24 interface=Public
ip address> add address=192.168.0.254/24 interface=Local
2. 添加默认路由给ROS,注意2个公网地址里面你必须定义1个作为对外网络的地址
ip route> add gateway=10.0.0.1 prefsrc=10.0.0.217
3. 添加影射 允许192.168.0.4被外网访问到
ip firewall nat> add action=dst-nat chain=dstnat \
dst-address=10.0.0.216/32 to-addresses=192.168.0.4
4. 添加源地址伪装给内部的服务器192.168.0.4,给它专门的IP通道去访问外部网络,而其他网段的IP走另外1个通道
ip firewall nat> add action=src-nat chain=srcnat \
src-address=192.168.0.4/32 to-addresses=10.0.0.216
ip firewall nat> add action=src-nat chain=srcnat \
src-address=192.168.0.0/24 to-addresses=10.0.0.217
页:
[1]