How can I use two Internet connections in Ubuntu?
- by Martin
My goal is to be able to do something like this:
curl google.com --interface ppp0
curl google.com --interface p2p2
ppp0 is a DSL connection, and p2p2 is a separate direct Internet connection. Currently I can only get one of these to work at a time. When I enable one, the other one stops working.
/etc/network/interfaces:
# The loopback network interface
auto lo
iface lo inet loopback
# DSL
auto p2p1
iface p2p1 inet manual
auto dsl-provider
iface dsl-provider inet ppp
pre-up /sbin/ifconfig p2p1 up # line maintained by pppoeconf
provider dsl-provider
# DIRECT
auto p2p2
iface p2p2 inet dhcp
ifconfig:
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
p2p1 Link encap:Ethernet
inet6 addr: fe80::20a:ebff:fe21:99c6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
p2p2 Link encap:Ethernet
inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20a:ebff:fe17:1249/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
ppp0 Link encap:Point-to-Point Protocol
inet addr:53.193.231.167 P-t-P:53.193.224.1 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 ppp0
10.0.10.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
53.193.224.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 p2p2
By default, only ppp0 works. If I run "route add default gw 192.168.1.1 p2p2" then I can use p2p2 but ppp0 stops working. If I then run "route add default gw 53.193.224.1 ppp0" then I can use ppp0 again but p2p2 stops working.
What can I do to be able to use both interfaces selectively?