轉載:
http://blog.csdn.net/zhangyang0402/archive/2010/06/25/5695050.aspx
一、網路拓撲
二、配置網路
1.A,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
2.GW1設定
(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
三、測試網關
若A,B能相互ping通,則兩個網關也配置成功了.
一、網路拓撲
二、配置網路
1.A,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
2.GW1設定
(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
三、測試網關
若A,B能相互ping通,則兩個網關也配置成功了.