Reprinted:
Http://blog.csdn.net/zhangyang0402/archive/2010/06/25/5695050.aspx
I. Network Topology
2. Configure the network
1.Network Configuration of A, gw1, gw2, and 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 settings
(1)Enable route forwarding
# Echo 1>/proc/sys/NET/IPv4/ip_forward
Or
# Vim/etc/sysctl. conf
Net. ipv4.ip _ forward = 0 --> net. ipv4.ip _ forward = 1
(2)Route entry added to CIDR Block 192.168.0.0/24
# Route add-net 192.168.0.0 netmask 255.255.255.0 GW 172.16.113.163
3.Gw2 settings
(1)Enable route forwarding
# Echo 1>/proc/sys/NET/IPv4/ip_forward
Or
# Vim/etc/sysctl. conf
Net. ipv4.ip _ forward = 0 --> net. ipv4.ip _ forward = 1
(2)Route entry added to 192.168.1.0/24 CIDR Block
# Route add-net 192.168.1.0 netmask 255.255.255.0 GW 172.16.113.173
Iii. Test Gateway
If a and B can ping each other, the two gateways are configured successfully.
I. Network Topology
2. Configure the network
1.Network Configuration of A, gw1, gw2, and 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 settings
(1)Enable route forwarding
# Echo 1>/proc/sys/NET/IPv4/ip_forward
Or
# Vim/etc/sysctl. conf
Net. ipv4.ip _ forward = 0 --> net. ipv4.ip _ forward = 1
(2)Route entry added to CIDR Block 192.168.0.0/24
# Route add-net 192.168.0.0 netmask 255.255.255.0 GW 172.16.113.163
3.Gw2 settings
(1)Enable route forwarding
# Echo 1>/proc/sys/NET/IPv4/ip_forward
Or
# Vim/etc/sysctl. conf
Net. ipv4.ip _ forward = 0 --> net. ipv4.ip _ forward = 1
(2)Route entry added to 192.168.1.0/24 CIDR Block
# Route add-net 192.168.1.0 netmask 255.255.255.0 GW 172.16.113.173
Iii. Test Gateway
If a and B can ping each other, the two gateways are configured successfully.