-1

i need to configure multiple gateways in my ubuntu 12.04 server.For example i have two network card with different subnet ip address.172.10.10.0/24 subnet traffic should go via eth0 and 172.20.20.0/24 subnet traffic should go via eth1.

       172.10.10.1------>eth0

       172.20.20.1------>eth1

Both gateway should work simultaneously.

Please any one help me how to set this on ubuntu server.

Regards shafi

  • Please edit your question to add the output of sudo route -n so we know how your routes are configured currently. – fkraiem Sep 17 '14 at 19:05

1 Answers1

1

A gateway computer provides a local network with access to another network or the Internet.

To configure a Linux server as a gateway:

Firts You must enable IP forwarding:

sudo -i
echo 1 > /proc/sys/net/ipv4/ip_forward

Second You must configure the gateway for each subnet:

sudo -i
nano /etc/network/interfaces

The file must change lines cards:

auto eth0   
iface eth0 inet static
address 172.10.10.1
netmask 255.255.255.0
network 172.10.10.0/24
broadcast 172.10.10.255

auto eth1  
iface eth1 inet static 
address 172.20.20.1
netmask 255.255.255.0
network 172.20.20.0/24
broadcast 172.20.20.255

Control + O, save file. Control + X, close nano.

For the subnets to communicate or to access the Internet, you must also do NAT with iptables:

Configure Nat in Ubuntu 12.04

kyodake
  • 15,401