转载请注明出处: http://blog.csdn.net/zhangyang0402/archive/2010/06/25/5695050.aspx

 

一、网络拓扑

 

gateway 

二、配置网络

 

1A,GW1,GW2,B的网络配置

 

A:

   eth0:

       IPADDR :192.168.1.2

       NETMASK:255.255.255.0

       GATEWAY:192.168.1.1

 

GW1:

   eth0:

       IPADDR :172.16.113.173

       NETMASK:255.255.255.0

       GATEWAY:172.16.113.9

 

   eth1:

       IPADDR :192.168.1.1

       NETMASK:255.255.255.0

 

B:

   eth0:

       IPADDR :192.168.0.2

       NETMASK:255.255.255.0

       GATEWAY:192.168.0.1

GW2:

   eth0:

       IPADDR :172.16.113.163

       NETMASK:255.255.255.0

       GATEWAY:172.16.113.9

 

   eth1:

       IPADDR :192.168.0.1

       NETMASK:255.255.255.0

 

 

2GW1设置

(1)开启路由转发功能

# echo 1 > /proc/sys/net/ipv4/ip_forward

#vim /etc/sysctl.conf

net.ipv4.ip_forward = 0 --> net.ipv4.ip_forward = 1

 

(2)添加到192.168.0.0/24网段的路由

# route add -net 192.168.0.0 netmask 255.255.255.0 gw 172.16.113.163

 

 

3. GW2设置

(1)开启路由转发功能

# echo 1 > /proc/sys/net/ipv4/ip_forward

#vim /etc/sysctl.conf

net.ipv4.ip_forward = 0 --> net.ipv4.ip_forward = 1

 

(2)添加到192.168.1.0/24网段的路由

# route add -net 192.168.1.0 netmask 255.255.255.0 gw 172.16.113.173

 

三、测试网关

AB能相互ping通,则两个网关也配置成功了.

 

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐