Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This is more of a 'Is it possible question' and what is the best way to do it.

I am running Ubuntu 10.10 (64bit) on my desktop pc. I am currently connected to the internet with a static IP address from my router. I have 2 WAN IP addresses available ( xxx.xxx.xxx.101 and xxx.xxx.xxx.102).

My router is configured to use the .101 WAN IP address. Is it possible for my computer to use both the static IP address from my router and the external .102 WAN address together?

Thanks.

share|improve this question

migrated from serverfault.com Nov 21 '11 at 16:01

This question came from our site for professional system and network administrators.

1 Answer 1

I don't think it's possible if the two gateways are on the same subnet.

Here's a script I found on the Internet that should work for your with a few changes according to your network setup (but you will have to change one of your two WANs to another subnet ie xxx.xxx.10.101 & xxx.xxx.11.102)

#!/bin/sh

# split access
# http://lartc.org/howto/lartc.rpdb.multiple-links.html#AEN268
# http://tldp.org/HOWTO/Adv-Routing-HOWTO/lartc.rpdb.multiple-links.html
# GoneVertical.org

# 1. One creates two additional routing tables, say T1 and T2. These are added in /etc/iproute2/rt_tables. Then you set up routing in these tables as follows:
# echo 1 T1 >> /etc/iproute2/rt_tables
# echo 2 T2 >> /etc/iproute2/rt_tables

# interface
IF0=lo
IF1=eth0
IF2=eth1

# ips
IP1=192.168.12.100
IP2=192.168.10.100

# gateways
P1=192.168.12.1
P2=192.168.10.1

# ip network
P0_NET=0.0.0.0
P1_NET=192.168.12.0
P2_NET=192.168.10.0

#echo $IF0 $IF1 $IF2
#echo $IP1 $IP2
#echo $P0_NET $P1_NET $P2_NET

# create routing tables
ip route add $P1_NET dev $IF1 src $IP1 table T1
ip route add default via $P1 table T1
ip route add $P2_NET dev $IF2 src $IP2 table T2
ip route add default via $P2 table T2

# create routing for local requests
# not sure if i need this
#ip route add $P0_NET dev $IF0 table T1
#ip route add $P2_NET dev $IF2 table T1
#ip route add 127.0.0.0/8 dev lo table T1
#ip route add $P0_NET dev $IF0 table T2
#ip route add $P1_NET dev $IF1 table T2
#ip route add 127.0.0.0/8 dev lo table T2


# main routing table
ip route add $P1_NET dev $IF1 src $IP1
ip route add $P2_NET dev $IF2 src $IP2

# default route preference
ip route add default via $P1

# routing rules
ip rule add from $IP1 table T1
ip rule add from $IP2 table T2

Source: Code Tips

Another nice HOWTO can be found here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.